mirror of https://github.com/OpenTTD/OpenTTD
(svn r12111) -Codechange: Rename Bridge to BridgeSpec, out of consistensy with other Specs in used.
parent
1011ac353b
commit
cc2b8b574a
|
@ -17,7 +17,7 @@ typedef uint BridgeType;
|
||||||
|
|
||||||
/** Struct containing information about a single bridge type
|
/** Struct containing information about a single bridge type
|
||||||
*/
|
*/
|
||||||
struct Bridge {
|
struct BridgeSpec {
|
||||||
Year avail_year; ///< the year where it becomes available
|
Year avail_year; ///< the year where it becomes available
|
||||||
byte min_length; ///< the minimum length (not counting start and end tile)
|
byte min_length; ///< the minimum length (not counting start and end tile)
|
||||||
byte max_length; ///< the maximum length (not counting start and end tile)
|
byte max_length; ///< the maximum length (not counting start and end tile)
|
||||||
|
@ -32,12 +32,12 @@ struct Bridge {
|
||||||
byte flags; ///< bit 0 set: disable drawing of far pillars.
|
byte flags; ///< bit 0 set: disable drawing of far pillars.
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Bridge _bridge[MAX_BRIDGES];
|
extern BridgeSpec _bridge[MAX_BRIDGES];
|
||||||
|
|
||||||
Foundation GetBridgeFoundation(Slope tileh, Axis axis);
|
Foundation GetBridgeFoundation(Slope tileh, Axis axis);
|
||||||
bool HasBridgeFlatRamp(Slope tileh, Axis axis);
|
bool HasBridgeFlatRamp(Slope tileh, Axis axis);
|
||||||
|
|
||||||
static inline const Bridge *GetBridgeSpec(BridgeType i)
|
static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
|
||||||
{
|
{
|
||||||
assert(i < lengthof(_bridge));
|
assert(i < lengthof(_bridge));
|
||||||
return &_bridge[i];
|
return &_bridge[i];
|
||||||
|
|
|
@ -79,7 +79,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
uint y = 15;
|
uint y = 15;
|
||||||
for (uint i = 0; (i < w->vscroll.cap) && ((i + w->vscroll.pos) < _bridgedata.count); i++) {
|
for (uint i = 0; (i < w->vscroll.cap) && ((i + w->vscroll.pos) < _bridgedata.count); i++) {
|
||||||
const Bridge *b = GetBridgeSpec(_bridgedata.indexes[i + w->vscroll.pos]);
|
const BridgeSpec *b = GetBridgeSpec(_bridgedata.indexes[i + w->vscroll.pos]);
|
||||||
|
|
||||||
SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]);
|
SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]);
|
||||||
SetDParam(1, b->speed * 10 / 16);
|
SetDParam(1, b->speed * 10 / 16);
|
||||||
|
@ -191,7 +191,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
|
||||||
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
|
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
|
||||||
if (CheckBridge_Stuff(brd_type, bridge_len)) {
|
if (CheckBridge_Stuff(brd_type, bridge_len)) {
|
||||||
/* bridge is accepted, add to list */
|
/* bridge is accepted, add to list */
|
||||||
const Bridge *b = GetBridgeSpec(brd_type);
|
const BridgeSpec *b = GetBridgeSpec(brd_type);
|
||||||
/* Add to terraforming & bulldozing costs the cost of the
|
/* Add to terraforming & bulldozing costs the cost of the
|
||||||
* bridge itself (not computed with DC_QUERY_COST) */
|
* bridge itself (not computed with DC_QUERY_COST) */
|
||||||
_bridgedata.costs[j] = ret.GetCost() + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8);
|
_bridgedata.costs[j] = ret.GetCost() + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8);
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numinfo; i++) {
|
for (int i = 0; i < numinfo; i++) {
|
||||||
Bridge *bridge = &_bridge[brid + i];
|
BridgeSpec *bridge = &_bridge[brid + i];
|
||||||
|
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case 0x08: // Year of availability
|
case 0x08: // Year of availability
|
||||||
|
|
|
@ -723,7 +723,7 @@ static const PalSpriteID * const * const _bridge_sprite_table[MAX_BRIDGES] = {
|
||||||
#define MB(y, mnl, mxl, p, mxs, spr, plt, dsc, nrl, nrd) \
|
#define MB(y, mnl, mxl, p, mxs, spr, plt, dsc, nrl, nrd) \
|
||||||
{y, mnl, mxl, p, mxs, spr, plt, dsc, nrl, nrd, NULL, 0}
|
{y, mnl, mxl, p, mxs, spr, plt, dsc, nrl, nrd, NULL, 0}
|
||||||
|
|
||||||
const Bridge _orig_bridge[] = {
|
const BridgeSpec _orig_bridge[] = {
|
||||||
/*
|
/*
|
||||||
year of availablity
|
year of availablity
|
||||||
| minimum length
|
| minimum length
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "table/bridge_land.h"
|
#include "table/bridge_land.h"
|
||||||
|
|
||||||
Bridge _bridge[MAX_BRIDGES];
|
BridgeSpec _bridge[MAX_BRIDGES];
|
||||||
|
|
||||||
/** Reset the data been eventually changed by the grf loaded. */
|
/** Reset the data been eventually changed by the grf loaded. */
|
||||||
void ResetBridges()
|
void ResetBridges()
|
||||||
|
@ -99,7 +99,7 @@ bool HasBridgeFlatRamp(Slope tileh, Axis axis)
|
||||||
|
|
||||||
static inline const PalSpriteID *GetBridgeSpriteTable(int index, byte table)
|
static inline const PalSpriteID *GetBridgeSpriteTable(int index, byte table)
|
||||||
{
|
{
|
||||||
const Bridge *bridge = GetBridgeSpec(index);
|
const BridgeSpec *bridge = GetBridgeSpec(index);
|
||||||
assert(table < 7);
|
assert(table < 7);
|
||||||
if (bridge->sprite_table == NULL || bridge->sprite_table[table] == NULL) {
|
if (bridge->sprite_table == NULL || bridge->sprite_table[table] == NULL) {
|
||||||
return _bridge_sprite_table[index][table];
|
return _bridge_sprite_table[index][table];
|
||||||
|
@ -153,7 +153,7 @@ static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, uint *z)
|
||||||
|
|
||||||
bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len)
|
bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len)
|
||||||
{
|
{
|
||||||
const Bridge *b = GetBridgeSpec(bridge_type);
|
const BridgeSpec *b = GetBridgeSpec(bridge_type);
|
||||||
uint max; // max possible length of a bridge (with patch 100)
|
uint max; // max possible length of a bridge (with patch 100)
|
||||||
|
|
||||||
if (bridge_type >= MAX_BRIDGES) return false;
|
if (bridge_type >= MAX_BRIDGES) return false;
|
||||||
|
|
Loading…
Reference in New Issue