bridge.h

Go to the documentation of this file.
00001 /* $Id: bridge.h 21270 2010-11-20 14:15:02Z alberth $ */
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 BRIDGE_H
00013 #define BRIDGE_H
00014 
00015 #include "gfx_type.h"
00016 #include "tile_cmd.h"
00017 
00023 enum BridgePieces {
00024   BRIDGE_PIECE_NORTH = 0,
00025   BRIDGE_PIECE_SOUTH,
00026   BRIDGE_PIECE_INNER_NORTH,
00027   BRIDGE_PIECE_INNER_SOUTH,
00028   BRIDGE_PIECE_MIDDLE_ODD,
00029   BRIDGE_PIECE_MIDDLE_EVEN,
00030   BRIDGE_PIECE_HEAD,
00031   BRIDGE_PIECE_INVALID,
00032 };
00033 
00034 DECLARE_POSTFIX_INCREMENT(BridgePieces)
00035 
00036 static const uint MAX_BRIDGES = 13; 
00037 
00038 typedef uint BridgeType; 
00039 
00043 struct BridgeSpec {
00044   Year avail_year;             
00045   byte min_length;             
00046   byte max_length;             
00047   uint16 price;                
00048   uint16 speed;                
00049   SpriteID sprite;             
00050   PaletteID pal;               
00051   StringID material;           
00052   StringID transport_name[2];  
00053   PalSpriteID **sprite_table;  
00054   byte flags;                  
00055 };
00056 
00057 extern BridgeSpec _bridge[MAX_BRIDGES];
00058 
00059 Foundation GetBridgeFoundation(Slope tileh, Axis axis);
00060 bool HasBridgeFlatRamp(Slope tileh, Axis axis);
00061 
00062 static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
00063 {
00064   assert(i < lengthof(_bridge));
00065   return &_bridge[i];
00066 }
00067 
00068 void DrawBridgeMiddle(const TileInfo *ti);
00069 
00070 CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags = DC_NONE);
00071 int CalcBridgeLenCostFactor(int x);
00072 
00073 void ResetBridges();
00074 
00075 static const uint MAX_BRIDGE_LENGTH             =  16; 
00076 static const uint MAX_BRIDGE_LENGTH_LONGBRIDGES = 100; 
00077 
00078 #endif /* BRIDGE_H */

Generated on Sun Jan 9 16:01:52 2011 for OpenTTD by  doxygen 1.6.1