bridge.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef BRIDGE_H
00013 #define BRIDGE_H
00014
00015 #include "gfx_type.h"
00016 #include "tile_cmd.h"
00017
00022 enum BridgePieces {
00023 BRIDGE_PIECE_NORTH = 0,
00024 BRIDGE_PIECE_SOUTH,
00025 BRIDGE_PIECE_INNER_NORTH,
00026 BRIDGE_PIECE_INNER_SOUTH,
00027 BRIDGE_PIECE_MIDDLE_ODD,
00028 BRIDGE_PIECE_MIDDLE_EVEN,
00029 BRIDGE_PIECE_HEAD,
00030 BRIDGE_PIECE_INVALID,
00031 };
00032
00033 DECLARE_POSTFIX_INCREMENT(BridgePieces);
00034
00035 enum {
00036 MAX_BRIDGES = 13
00037 };
00038
00039 typedef uint BridgeType;
00040
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 SpriteID 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 bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags = DC_NONE);
00071 int CalcBridgeLenCostFactor(int x);
00072
00073 void ResetBridges();
00074
00075 #endif