# depot.cpp

Go to the documentation of this file.

    00001 /* $Id: depot.cpp 15299 2009-01-31 20:16:06Z smatz $ */
    00002
    00005 #include "stdafx.h"
    00006 #include "depot_base.h"
    00007 #include "order_func.h"
    00008 #include "window_func.h"
    00009 #include "oldpool_func.h"
    00010
    00011 DEFINE_OLD_POOL_GENERIC(Depot, Depot)
    00012
    00013
    00018 Depot *GetDepotByTile(TileIndex tile)
    00019 {
    00020   Depot *depot;
    00021
    00022   FOR_ALL_DEPOTS(depot) {
    00023     if (depot->xy == tile) return depot;
    00024   }
    00025
    00026   return NULL;
    00027 }
    00028
    00032 Depot::~Depot()
    00033 {
    00034   if (CleaningPool()) return;
    00035
    00036   /* Clear the depot from all order-lists */
    00037   RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
    00038
    00039   /* Delete the depot-window */
    00040   DeleteWindowById(WC_VEHICLE_DEPOT, this->xy);
    00041   this->xy = INVALID_TILE;
    00042 }
    00043
    00044 void InitializeDepots()
    00045 {
    00046   _Depot_pool.CleanPool();
    00047   _Depot_pool.AddBlockToPool();
    00048 }