bridge.h

Go to the documentation of this file.
00001 /* $Id: bridge.h 15434 2009-02-09 21:20:05Z rubidium $ */
00002 
00005 #ifndef BRIDGE_H
00006 #define BRIDGE_H
00007 
00008 #include "gfx_type.h"
00009 #include "direction_type.h"
00010 #include "tile_cmd.h"
00011 
00016 enum BridgePieces {
00017   BRIDGE_PIECE_NORTH = 0,
00018   BRIDGE_PIECE_SOUTH,
00019   BRIDGE_PIECE_INNER_NORTH,
00020   BRIDGE_PIECE_INNER_SOUTH,
00021   BRIDGE_PIECE_MIDDLE_ODD,
00022   BRIDGE_PIECE_MIDDLE_EVEN,
00023   BRIDGE_PIECE_HEAD,
00024   BRIDGE_PIECE_INVALID,
00025 };
00026 
00027 DECLARE_POSTFIX_INCREMENT(BridgePieces);
00028 
00029 enum {
00030   MAX_BRIDGES = 13
00031 };
00032 
00033 typedef uint BridgeType;
00034 
00037 struct BridgeSpec {
00038   Year avail_year;             
00039   byte min_length;             
00040   byte max_length;             
00041   uint16 price;                
00042   uint16 speed;                
00043   SpriteID sprite;             
00044   SpriteID pal;                
00045   StringID material;           
00046   StringID transport_name[2];  
00047   PalSpriteID **sprite_table;  
00048   byte flags;                  
00049 };
00050 
00051 extern BridgeSpec _bridge[MAX_BRIDGES];
00052 
00053 Foundation GetBridgeFoundation(Slope tileh, Axis axis);
00054 bool HasBridgeFlatRamp(Slope tileh, Axis axis);
00055 
00056 static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
00057 {
00058   assert(i < lengthof(_bridge));
00059   return &_bridge[i];
00060 }
00061 
00062 void DrawBridgeMiddle(const TileInfo *ti);
00063 
00064 bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags = DC_NONE);
00065 int CalcBridgeLenCostFactor(int x);
00066 
00067 void ResetBridges();
00068 
00069 #endif /* BRIDGE_H */

Generated on Tue Dec 1 00:06:14 2009 for OpenTTD by  doxygen 1.5.6