depot.cpp

Go to the documentation of this file.
00001 /* $Id$ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #include "stdafx.h"
00013 #include "depot_base.h"
00014 #include "order_func.h"
00015 #include "window_func.h"
00016 #include "core/pool_func.hpp"
00017 #include "vehicle_gui.h"
00018 
00019 DepotPool _depot_pool("Depot");
00020 INSTANTIATE_POOL_METHODS(Depot)
00021 
00022 
00025 Depot::~Depot()
00026 {
00027   if (CleaningPool()) return;
00028 
00029   /* Clear the depot from all order-lists */
00030   RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
00031 
00032   /* Delete the depot-window */
00033   DeleteWindowById(WC_VEHICLE_DEPOT, this->xy);
00034 
00035   /* Delete the depot list */
00036   WindowNumber wno = (this->index << 16) | VLW_DEPOT_LIST | GetTileOwner(this->xy);
00037   switch (GetTileType(this->xy)) {
00038     default: break; // It can happen there is no depot here anymore (TTO/TTD savegames)
00039     case MP_RAILWAY: DeleteWindowById(WC_TRAINS_LIST,  wno | (VEH_TRAIN << 11)); break;
00040     case MP_ROAD:    DeleteWindowById(WC_ROADVEH_LIST, wno | (VEH_ROAD  << 11)); break;
00041     case MP_WATER:   DeleteWindowById(WC_SHIPS_LIST,   wno | (VEH_SHIP  << 11)); break;
00042   }
00043 }
00044 
00045 void InitializeDepots()
00046 {
00047   _depot_pool.CleanPool();
00048 }

Generated on Wed Dec 30 20:40:01 2009 for OpenTTD by  doxygen 1.5.6