src/bridge.h
author KUDr
Fri, 20 Apr 2007 19:43:06 +0000
changeset 6513 454347ca3dfb
parent 6248 e4a2ed7e5613
child 7318 632cd0497770
permissions -rw-r--r--
(svn r9697) -Fix [YAPF](r9694): 'unused variable' warning (glx)
2268
052f106e6e6a (svn r2788) Fix Id tag
tron
parents: 2263
diff changeset
     1
/* $Id$ */
2262
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     2
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     3
/** @file bridge.h Header file for bridges */
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     4
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     5
#ifndef BRIDGE_H
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     6
#define BRIDGE_H
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     7
3359
633290bf1117 (svn r4154) -Moved MAX_BRIDGES in bridge.h and made it an enum. This makes two drops ...
celestar
parents: 3355
diff changeset
     8
enum {
633290bf1117 (svn r4154) -Moved MAX_BRIDGES in bridge.h and made it an enum. This makes two drops ...
celestar
parents: 3355
diff changeset
     9
	MAX_BRIDGES = 13
633290bf1117 (svn r4154) -Moved MAX_BRIDGES in bridge.h and made it an enum. This makes two drops ...
celestar
parents: 3355
diff changeset
    10
};
633290bf1117 (svn r4154) -Moved MAX_BRIDGES in bridge.h and made it an enum. This makes two drops ...
celestar
parents: 3355
diff changeset
    11
2262
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    12
/** Struct containing information about a single bridge type
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    13
 */
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6160
diff changeset
    14
struct Bridge {
4293
4b7006c1b5eb (svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents: 3977
diff changeset
    15
	Year avail_year;     ///< the year in which the bridge becomes available
2262
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    16
	byte min_length;     ///< the minimum length of the bridge (not counting start and end tile)
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    17
	byte max_length;     ///< the maximum length of the bridge (not counting start and end tile)
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    18
	uint16 price;        ///< the relative price of the bridge
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    19
	uint16 speed;        ///< maximum travel speed
5668
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5475
diff changeset
    20
	SpriteID sprite;     ///< the sprite which is used in the GUI
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5475
diff changeset
    21
	SpriteID pal;        ///< the palette which is used in the GUI
2262
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    22
	StringID material;   ///< the string that contains the bridge description
2478
cd6a02ba3853 (svn r3004) -Feature, NewGRF: Support loading of bridge attributes and tables from GRF. Currently drawing tall pillars uses old data.
peter1138
parents: 2268
diff changeset
    23
	PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
cd6a02ba3853 (svn r3004) -Feature, NewGRF: Support loading of bridge attributes and tables from GRF. Currently drawing tall pillars uses old data.
peter1138
parents: 2268
diff changeset
    24
	byte flags;          ///< bit 0 set: disable drawing of far pillars.
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6160
diff changeset
    25
};
2262
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    26
2478
cd6a02ba3853 (svn r3004) -Feature, NewGRF: Support loading of bridge attributes and tables from GRF. Currently drawing tall pillars uses old data.
peter1138
parents: 2268
diff changeset
    27
extern const Bridge orig_bridge[MAX_BRIDGES];
2763
a4d065e3261b (svn r3308) BAD
tron
parents: 2478
diff changeset
    28
extern Bridge _bridge[MAX_BRIDGES];
2262
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    29
3636
a36cc46e754d (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents: 3359
diff changeset
    30
uint GetBridgeFoundation(Slope tileh, Axis axis);
6141
bd1637f172b4 (svn r8884) -Fix
tron
parents: 5668
diff changeset
    31
bd1637f172b4 (svn r8884) -Fix
tron
parents: 5668
diff changeset
    32
static inline const Bridge *GetBridge(uint i)
bd1637f172b4 (svn r8884) -Fix
tron
parents: 5668
diff changeset
    33
{
bd1637f172b4 (svn r8884) -Fix
tron
parents: 5668
diff changeset
    34
	assert(i < lengthof(_bridge));
bd1637f172b4 (svn r8884) -Fix
tron
parents: 5668
diff changeset
    35
	return &_bridge[i];
bd1637f172b4 (svn r8884) -Fix
tron
parents: 5668
diff changeset
    36
}
3355
e414a0b104a6 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 2763
diff changeset
    37
6160
fa42299e967e (svn r8908) -Codechange: declaration of DrawBridgeMiddle does not belong in a map accessors header.
rubidium
parents: 6141
diff changeset
    38
void DrawBridgeMiddle(const TileInfo* ti);
fa42299e967e (svn r8908) -Codechange: declaration of DrawBridgeMiddle does not belong in a map accessors header.
rubidium
parents: 6141
diff changeset
    39
2262
252cfd94c54d (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    40
#endif /* BRIDGE_H */