2005-08-02 15:12:36 +00:00
|
|
|
/* $Id$ */
|
2005-08-01 20:23:38 +00:00
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
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"
|
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,
|
|
|
|
};
|
|
|
|
|
2010-03-23 22:25:43 +00:00
|
|
|
DECLARE_POSTFIX_INCREMENT(BridgePieces)
|
2008-07-15 00:34:34 +00:00
|
|
|
|
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
|
2010-01-21 01:38:13 +00:00
|
|
|
PaletteID pal; ///< the palette which is used in the GUI
|
2008-02-12 03:05:27 +00:00
|
|
|
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
|
|
|
|
2010-04-04 14:22:55 +00:00
|
|
|
CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags = DC_NONE);
|
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 */
|