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@8123: #include "gfx_type.h" rubidium@8222: #include "direction_type.h" rubidium@8138: #include "tile_cmd.h" rubidium@8123: belugas@9642: /** This enum is related to the definition of bridge pieces, belugas@9642: * which is used to determine the proper sprite table to use belugas@9642: * while drawing a given bridge part. belugas@9642: */ belugas@9642: enum BridgePieces { belugas@9642: BRIDGE_PIECE_NORTH = 0, belugas@9642: BRIDGE_PIECE_SOUTH, belugas@9642: BRIDGE_PIECE_INNER_NORTH, belugas@9642: BRIDGE_PIECE_INNER_SOUTH, belugas@9642: BRIDGE_PIECE_MIDDLE_ODD, belugas@9642: BRIDGE_PIECE_MIDDLE_EVEN, belugas@9642: BRIDGE_PIECE_HEAD, belugas@9642: BRIDGE_PIECE_INVALID, belugas@9642: }; belugas@9642: belugas@9642: DECLARE_POSTFIX_INCREMENT(BridgePieces); belugas@9642: celestar@3359: enum { celestar@3359: MAX_BRIDGES = 13 celestar@3359: }; celestar@3359: belugas@8532: typedef uint BridgeType; belugas@8532: celestar@2262: /** Struct containing information about a single bridge type celestar@2262: */ belugas@8535: struct BridgeSpec { belugas@8540: Year avail_year; ///< the year where it becomes available belugas@8540: byte min_length; ///< the minimum length (not counting start and end tile) belugas@8540: byte max_length; ///< the maximum length (not counting start and end tile) belugas@8540: uint16 price; ///< the price multiplier belugas@8540: uint16 speed; ///< maximum travel speed belugas@8540: SpriteID sprite; ///< the sprite which is used in the GUI belugas@8540: SpriteID pal; ///< the palette which is used in the GUI belugas@8540: StringID material; ///< the string that contains the bridge description belugas@8540: StringID transport_name[2]; ///< description of the bridge, when built for road or rail belugas@8540: PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge belugas@8540: byte flags; ///< bit 0 set: disable drawing of far pillars. rubidium@6248: }; celestar@2262: belugas@8535: extern BridgeSpec _bridge[MAX_BRIDGES]; celestar@2262: rubidium@7335: Foundation GetBridgeFoundation(Slope tileh, Axis axis); frosch@8379: bool HasBridgeFlatRamp(Slope tileh, Axis axis); tron@6141: belugas@8535: static inline const BridgeSpec *GetBridgeSpec(BridgeType i) tron@6141: { tron@6141: assert(i < lengthof(_bridge)); tron@6141: return &_bridge[i]; tron@6141: } celestar@3355: rubidium@7318: void DrawBridgeMiddle(const TileInfo *ti); rubidium@6160: rubidium@9578: bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, uint32 flags = 0); rubidium@8119: int CalcBridgeLenCostFactor(int x); rubidium@8119: belugas@8489: void ResetBridges(); belugas@8489: celestar@2262: #endif /* BRIDGE_H */