depot.cpp

Go to the documentation of this file.
00001 /* $Id: depot.cpp 20772 2010-09-08 21:37:13Z rubidium $ */
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_backup.h"
00015 #include "order_func.h"
00016 #include "window_func.h"
00017 #include "core/pool_func.hpp"
00018 #include "vehicle_gui.h"
00019 #include "vehiclelist.h"
00020 
00021 DepotPool _depot_pool("Depot");
00022 INSTANTIATE_POOL_METHODS(Depot)
00023 
00024 
00027 Depot::~Depot()
00028 {
00029   if (CleaningPool()) return;
00030 
00031   /* Clear the order backup. */
00032   OrderBackup::Reset(this->xy, false);
00033 
00034   /* Clear the depot from all order-lists */
00035   RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
00036 
00037   /* Delete the depot-window */
00038   DeleteWindowById(WC_VEHICLE_DEPOT, this->xy);
00039 
00040   /* Delete the depot list */
00041   VehicleType vt;
00042   switch (GetTileType(this->xy)) {
00043     default: return; // It can happen there is no depot here anymore (TTO/TTD savegames)
00044     case MP_RAILWAY: vt = VEH_TRAIN; break;
00045     case MP_ROAD:    vt = VEH_ROAD;  break;
00046     case MP_WATER:   vt = VEH_SHIP;  break;
00047   }
00048   DeleteWindowById(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_DEPOT_LIST, vt, GetTileOwner(this->xy), this->index).Pack());
00049 }
00050 
00051 void InitializeDepots()
00052 {
00053   _depot_pool.CleanPool();
00054 }

Generated on Fri Dec 31 17:15:30 2010 for OpenTTD by  doxygen 1.6.1