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
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 uint16 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
00067 static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
00068 {
00069 assert(i < lengthof(_bridge));
00070 return &_bridge[i];
00071 }
00072
00073 void DrawBridgeMiddle(const TileInfo *ti);
00074
00075 CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags = DC_NONE);
00076 int CalcBridgeLenCostFactor(int x);
00077
00078 void ResetBridges();
00079
00080 #endif