|
@@ -16,48 +16,50 @@
|
|
|
|
|
|
DEFINE_OLD_POOL_GENERIC(Depot, Depot)
|
|
|
|
|
|
/**
|
|
|
* Gets a depot from a tile
|
|
|
*
|
|
|
* @return Returns the depot if the tile had a depot, else it returns NULL
|
|
|
*/
|
|
|
Depot *GetDepotByTile(TileIndex tile)
|
|
|
{
|
|
|
Depot *depot;
|
|
|
|
|
|
FOR_ALL_DEPOTS(depot) {
|
|
|
if (depot->xy == tile) return depot;
|
|
|
}
|
|
|
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Clean up a depot
|
|
|
*/
|
|
|
Depot::~Depot()
|
|
|
{
|
|
|
if (CleaningPool()) return;
|
|
|
|
|
|
/* Clear the depot from all order-lists */
|
|
|
RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
|
|
|
|
|
|
/* Delete the depot-window */
|
|
|
DeleteWindowById(WC_VEHICLE_DEPOT, this->xy);
|
|
|
this->xy = 0;
|
|
|
}
|
|
|
|
|
|
void InitializeDepots()
|
|
|
{
|
|
|
_Depot_pool.CleanPool();
|
|
|
_Depot_pool.AddBlockToPool();
|
|
|
}
|
|
|
|
|
|
|
|
|
static const SaveLoad _depot_desc[] = {
|
|
|
SLE_CONDVAR(Depot, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
|
|
|
SLE_CONDVAR(Depot, xy, SLE_UINT32, 6, SL_MAX_VERSION),
|
|
|
SLE_VAR(Depot, town_index, SLE_UINT16),
|
|
|
SLE_END()
|
|
|
};
|
|
|
|
|
|
static void Save_DEPT()
|
|
|
{
|