depot_map.h

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 #ifndef DEPOT_MAP_H
00013 #define DEPOT_MAP_H
00014 
00015 #include "road_map.h"
00016 #include "rail_map.h"
00017 #include "water_map.h"
00018 #include "station_map.h"
00019 
00023 static inline bool IsDepotTypeTile(TileIndex tile, TransportType type)
00024 {
00025   switch (type) {
00026     default: NOT_REACHED();
00027     case TRANSPORT_RAIL:
00028       return IsRailDepotTile(tile);
00029 
00030     case TRANSPORT_ROAD:
00031       return IsRoadDepotTile(tile);
00032 
00033     case TRANSPORT_WATER:
00034       return IsShipDepotTile(tile);
00035   }
00036 }
00037 
00043 static inline bool IsDepotTile(TileIndex tile)
00044 {
00045   return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile);
00046 }
00047 
00054 static inline DepotID GetDepotIndex(TileIndex t)
00055 {
00056   /* Hangars don't have a Depot class, thus store no DepotID. */
00057   assert(IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t));
00058   return _m[t].m2;
00059 }
00060 
00061 #endif /* DEPOT_MAP_H */

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