tron@2268: /* $Id$ */ celestar@2262: celestar@2262: /** @file bridge.h Header file for bridges */ celestar@2262: celestar@2262: #ifndef BRIDGE_H celestar@2262: #define BRIDGE_H celestar@2262: rubidium@8619: #include "gfx_type.h" rubidium@8718: #include "direction_type.h" rubidium@8634: #include "tile_cmd.h" rubidium@8619: belugas@11147: /** This enum is related to the definition of bridge pieces, belugas@11147: * which is used to determine the proper sprite table to use belugas@11147: * while drawing a given bridge part. belugas@11147: */ belugas@11147: enum BridgePieces { belugas@11147: BRIDGE_PIECE_NORTH = 0, belugas@11147: BRIDGE_PIECE_SOUTH, belugas@11147: BRIDGE_PIECE_INNER_NORTH, belugas@11147: BRIDGE_PIECE_INNER_SOUTH, belugas@11147: BRIDGE_PIECE_MIDDLE_ODD, belugas@11147: BRIDGE_PIECE_MIDDLE_EVEN, belugas@11147: BRIDGE_PIECE_HEAD, belugas@11147: BRIDGE_PIECE_INVALID, belugas@11147: }; belugas@11147: belugas@11147: DECLARE_POSTFIX_INCREMENT(BridgePieces); belugas@11147: celestar@3359: enum { celestar@3359: MAX_BRIDGES = 13 celestar@3359: }; celestar@3359: belugas@9028: typedef uint BridgeType; belugas@9028: celestar@2262: /** Struct containing information about a single bridge type celestar@2262: */ belugas@9031: struct BridgeSpec { belugas@9036: Year avail_year; ///< the year where it becomes available belugas@9036: byte min_length; ///< the minimum length (not counting start and end tile) belugas@9036: byte max_length; ///< the maximum length (not counting start and end tile) belugas@9036: uint16 price; ///< the price multiplier belugas@9036: uint16 speed; ///< maximum travel speed belugas@9036: SpriteID sprite; ///< the sprite which is used in the GUI belugas@9036: SpriteID pal; ///< the palette which is used in the GUI belugas@9036: StringID material; ///< the string that contains the bridge description belugas@9036: StringID transport_name[2]; ///< description of the bridge, when built for road or rail belugas@9036: PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge belugas@9036: byte flags; ///< bit 0 set: disable drawing of far pillars. rubidium@6574: }; celestar@2262: belugas@9031: extern BridgeSpec _bridge[MAX_BRIDGES]; celestar@2262: rubidium@7831: Foundation GetBridgeFoundation(Slope tileh, Axis axis); frosch@8875: bool HasBridgeFlatRamp(Slope tileh, Axis axis); tron@6467: belugas@9031: static inline const BridgeSpec *GetBridgeSpec(BridgeType i) tron@6467: { tron@6467: assert(i < lengthof(_bridge)); tron@6467: return &_bridge[i]; tron@6467: } celestar@3355: rubidium@7814: void DrawBridgeMiddle(const TileInfo *ti); rubidium@6486: rubidium@11054: bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, uint32 flags = 0); rubidium@8615: int CalcBridgeLenCostFactor(int x); rubidium@8615: belugas@8985: void ResetBridges(); belugas@8985: celestar@2262: #endif /* BRIDGE_H */