diff options
author | truelight <truelight@openttd.org> | 2006-08-26 14:44:55 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-26 14:44:55 +0000 |
commit | f73a2829f364b07d6f944b8b49e156b9774db39b (patch) | |
tree | 8b932464c532068bc8cf1bd6798a38de736ed602 /depot.c | |
parent | 7a58659fefe7e007b4cd3d13bed21831e6c27171 (diff) | |
download | openttd-f73a2829f364b07d6f944b8b49e156b9774db39b.tar.xz |
(svn r6141) -Codechange: introduced DepotID and used it as much as possible
-Codechange: DeleteDepot removes a depot from the pool
-Codechange: DestroyDepot is called by DeleteDepot to remove all things where a depot depends on.
Last 2 changes to prepare for new pool system. Not pretty now, will be soon.
-Codechange: Removed DoDeleteDepot as it was stupid
Diffstat (limited to 'depot.c')
-rw-r--r-- | depot.c | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -59,7 +59,7 @@ Depot *AllocateDepot(void) * TODO - This is just a temporary stage, this will be removed. */ for (d = GetDepot(0); d != NULL; d = (d->index + 1 < GetDepotPoolSize()) ? GetDepot(d->index + 1) : NULL) { if (!IsValidDepot(d)) { - uint index = d->index; + DepotID index = d->index; memset(d, 0, sizeof(Depot)); d->index = index; @@ -75,26 +75,18 @@ Depot *AllocateDepot(void) } /** - * Delete a depot + * Clean up a depot */ -void DoDeleteDepot(TileIndex tile) +void DestroyDepot(Depot *depot) { - Depot *depot; - - /* Get the depot */ - depot = GetDepotByTile(tile); - /* Clear the tile */ - DoClearSquare(tile); - - /* Clear the depot */ - depot->xy = 0; + DoClearSquare(depot->xy); /* Clear the depot from all order-lists */ RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, depot->index); /* Delete the depot-window */ - DeleteWindowById(WC_VEHICLE_DEPOT, tile); + DeleteWindowById(WC_VEHICLE_DEPOT, depot->xy); } void InitializeDepots(void) |