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 "station_map.h"
00016 
00020 static inline bool IsDepotTypeTile(TileIndex tile, TransportType type)
00021 {
00022   switch (type) {
00023     default: NOT_REACHED();
00024     case TRANSPORT_RAIL:
00025       return IsRailDepotTile(tile);
00026 
00027     case TRANSPORT_ROAD:
00028       return IsRoadDepotTile(tile);
00029 
00030     case TRANSPORT_WATER:
00031       return IsShipDepotTile(tile);
00032   }
00033 }
00034 
00040 static inline bool IsDepotTile(TileIndex tile)
00041 {
00042   return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile);
00043 }
00044 
00051 static inline DepotID GetDepotIndex(TileIndex t)
00052 {
00053   /* Hangars don't have a Depot class, thus store no DepotID. */
00054   assert(IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t));
00055   return _m[t].m2;
00056 }
00057 
00058 #endif /* DEPOT_MAP_H */

Generated on Sun Jan 23 01:49:01 2011 for OpenTTD by  doxygen 1.6.1