2005-08-02 15:12:36 +00:00
|
|
|
/* $Id$ */
|
2005-08-01 20:23:38 +00:00
|
|
|
|
|
|
|
/** @file bridge.h Header file for bridges */
|
|
|
|
|
|
|
|
#ifndef BRIDGE_H
|
|
|
|
#define BRIDGE_H
|
|
|
|
|
2007-12-23 10:56:02 +00:00
|
|
|
#include "gfx_type.h"
|
2008-01-09 00:59:02 +00:00
|
|
|
#include "direction_type.h"
|
2007-12-25 23:42:52 +00:00
|
|
|
#include "tile_cmd.h"
|
2007-12-23 10:56:02 +00:00
|
|
|
|
2008-07-15 00:34:34 +00:00
|
|
|
/** This enum is related to the definition of bridge pieces,
|
|
|
|
* which is used to determine the proper sprite table to use
|
|
|
|
* while drawing a given bridge part.
|
|
|
|
*/
|
|
|
|
enum BridgePieces {
|
|
|
|
BRIDGE_PIECE_NORTH = 0,
|
|
|
|
BRIDGE_PIECE_SOUTH,
|
|
|
|
BRIDGE_PIECE_INNER_NORTH,
|
|
|
|
BRIDGE_PIECE_INNER_SOUTH,
|
|
|
|
BRIDGE_PIECE_MIDDLE_ODD,
|
|
|
|
BRIDGE_PIECE_MIDDLE_EVEN,
|
|
|
|
BRIDGE_PIECE_HEAD,
|
|
|
|
BRIDGE_PIECE_INVALID,
|
|
|
|
};
|
|
|
|
|
|
|
|
DECLARE_POSTFIX_INCREMENT(BridgePieces);
|
|
|
|
|
2006-03-29 19:03:47 +00:00
|
|
|
enum {
|
|
|
|
MAX_BRIDGES = 13
|
|
|
|
};
|
|
|
|
|
2008-02-11 04:12:30 +00:00
|
|
|
typedef uint BridgeType;
|
|
|
|
|
2005-08-01 20:23:38 +00:00
|
|
|
/** Struct containing information about a single bridge type
|
|
|
|
*/
|
2008-02-11 17:35:15 +00:00
|
|
|
struct BridgeSpec {
|
2008-02-12 03:05:27 +00:00
|
|
|
Year avail_year; ///< the year where it becomes available
|
|
|
|
byte min_length; ///< the minimum length (not counting start and end tile)
|
|
|
|
byte max_length; ///< the maximum length (not counting start and end tile)
|
|
|
|
uint16 price; ///< the price multiplier
|
|
|
|
uint16 speed; ///< maximum travel speed
|
|
|
|
SpriteID sprite; ///< the sprite which is used in the GUI
|
|
|
|
SpriteID pal; ///< the palette which is used in the GUI
|
|
|
|
StringID material; ///< the string that contains the bridge description
|
|
|
|
StringID transport_name[2]; ///< description of the bridge, when built for road or rail
|
|
|
|
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
|
|
|
|
byte flags; ///< bit 0 set: disable drawing of far pillars.
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2005-08-01 20:23:38 +00:00
|
|
|
|
2008-02-11 17:35:15 +00:00
|
|
|
extern BridgeSpec _bridge[MAX_BRIDGES];
|
2005-08-01 20:23:38 +00:00
|
|
|
|
2007-07-26 16:51:10 +00:00
|
|
|
Foundation GetBridgeFoundation(Slope tileh, Axis axis);
|
2008-01-22 16:08:17 +00:00
|
|
|
bool HasBridgeFlatRamp(Slope tileh, Axis axis);
|
2007-02-24 18:44:30 +00:00
|
|
|
|
2008-02-11 17:35:15 +00:00
|
|
|
static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
|
2007-02-24 18:44:30 +00:00
|
|
|
{
|
|
|
|
assert(i < lengthof(_bridge));
|
|
|
|
return &_bridge[i];
|
|
|
|
}
|
2006-03-29 16:30:26 +00:00
|
|
|
|
2007-07-24 17:01:23 +00:00
|
|
|
void DrawBridgeMiddle(const TileInfo *ti);
|
2007-02-26 18:25:03 +00:00
|
|
|
|
2008-06-23 08:38:07 +00:00
|
|
|
bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, uint32 flags = 0);
|
2007-12-21 22:50:51 +00:00
|
|
|
int CalcBridgeLenCostFactor(int x);
|
|
|
|
|
2008-02-05 04:48:56 +00:00
|
|
|
void ResetBridges();
|
|
|
|
|
2005-08-01 20:23:38 +00:00
|
|
|
#endif /* BRIDGE_H */
|