Mercurial > hg > openttd
annotate src/bridge.h @ 10123:57aa34285d05 draft
(svn r14307) -Fix: when deleting a station, remove news items regarding it
author | smatz <smatz@openttd.org> |
---|---|
date | Sat, 13 Sep 2008 10:19:51 +0000 |
parents | b4caf5c04b2f |
children | df23c4e04638 |
rev | line source |
---|---|
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
3 /** @file bridge.h Header file for bridges */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
4 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
5 #ifndef BRIDGE_H |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
6 #define BRIDGE_H |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
7 |
8123
c26c28875749
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
8119
diff
changeset
|
8 #include "gfx_type.h" |
8222
927d1c80aab4
(svn r11785) -Codechange: remove some unneeded includes.
rubidium <rubidium@openttd.org>
parents:
8138
diff
changeset
|
9 #include "direction_type.h" |
8138
60ea0f95de91
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium <rubidium@openttd.org>
parents:
8123
diff
changeset
|
10 #include "tile_cmd.h" |
8123
c26c28875749
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
8119
diff
changeset
|
11 |
9642
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
12 /** This enum is related to the definition of bridge pieces, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
13 * which is used to determine the proper sprite table to use |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
14 * while drawing a given bridge part. |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
15 */ |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
16 enum BridgePieces { |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
17 BRIDGE_PIECE_NORTH = 0, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
18 BRIDGE_PIECE_SOUTH, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
19 BRIDGE_PIECE_INNER_NORTH, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
20 BRIDGE_PIECE_INNER_SOUTH, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
21 BRIDGE_PIECE_MIDDLE_ODD, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
22 BRIDGE_PIECE_MIDDLE_EVEN, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
23 BRIDGE_PIECE_HEAD, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
24 BRIDGE_PIECE_INVALID, |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
25 }; |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
26 |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
27 DECLARE_POSTFIX_INCREMENT(BridgePieces); |
b4caf5c04b2f
(svn r13705) -Codechange: Define and use BridgePieces enum, which will remove a few more magic numbers
belugas <belugas@openttd.org>
parents:
9578
diff
changeset
|
28 |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
29 enum { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
30 MAX_BRIDGES = 13 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
31 }; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
32 |
8532
b3bd4f1ed981
(svn r12107) -Codechange: Add and use the typedef BridgeType
belugas <belugas@openttd.org>
parents:
8491
diff
changeset
|
33 typedef uint BridgeType; |
b3bd4f1ed981
(svn r12107) -Codechange: Add and use the typedef BridgeType
belugas <belugas@openttd.org>
parents:
8491
diff
changeset
|
34 |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
35 /** Struct containing information about a single bridge type |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
36 */ |
8535
c026695bee6c
(svn r12111) -Codechange: Rename Bridge to BridgeSpec, out of consistensy with other Specs in used.
belugas <belugas@openttd.org>
parents:
8532
diff
changeset
|
37 struct BridgeSpec { |
8540
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
38 Year avail_year; ///< the year where it becomes available |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
39 byte min_length; ///< the minimum length (not counting start and end tile) |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
40 byte max_length; ///< the maximum length (not counting start and end tile) |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
41 uint16 price; ///< the price multiplier |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
42 uint16 speed; ///< maximum travel speed |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
43 SpriteID sprite; ///< the sprite which is used in the GUI |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
44 SpriteID pal; ///< the palette which is used in the GUI |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
45 StringID material; ///< the string that contains the bridge description |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
46 StringID transport_name[2]; ///< description of the bridge, when built for road or rail |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
47 PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge |
5de93bf73609
(svn r12118) -Codechange: Put the two descriptions of bridges in an array instead of two single variables, following the transport type it represents
belugas <belugas@openttd.org>
parents:
8535
diff
changeset
|
48 byte flags; ///< bit 0 set: disable drawing of far pillars. |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6160
diff
changeset
|
49 }; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
50 |
8535
c026695bee6c
(svn r12111) -Codechange: Rename Bridge to BridgeSpec, out of consistensy with other Specs in used.
belugas <belugas@openttd.org>
parents:
8532
diff
changeset
|
51 extern BridgeSpec _bridge[MAX_BRIDGES]; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
52 |
7335
0090d1c6b978
(svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium <rubidium@openttd.org>
parents:
7318
diff
changeset
|
53 Foundation GetBridgeFoundation(Slope tileh, Axis axis); |
8379
bf751c81fa2f
(svn r11946) -Fix: slope detection of bridge ramps.
frosch <frosch@openttd.org>
parents:
8222
diff
changeset
|
54 bool HasBridgeFlatRamp(Slope tileh, Axis axis); |
6141 | 55 |
8535
c026695bee6c
(svn r12111) -Codechange: Rename Bridge to BridgeSpec, out of consistensy with other Specs in used.
belugas <belugas@openttd.org>
parents:
8532
diff
changeset
|
56 static inline const BridgeSpec *GetBridgeSpec(BridgeType i) |
6141 | 57 { |
58 assert(i < lengthof(_bridge)); | |
59 return &_bridge[i]; | |
60 } | |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
61 |
7318
5305f52bed67
(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium <rubidium@openttd.org>
parents:
6248
diff
changeset
|
62 void DrawBridgeMiddle(const TileInfo *ti); |
6160
6bb39697173c
(svn r8908) -Codechange: declaration of DrawBridgeMiddle does not belong in a map accessors header.
rubidium <rubidium@openttd.org>
parents:
6141
diff
changeset
|
63 |
9578
b455ef88d6fe
(svn r13611) -Fix [FS#2100]: if the first bridge can't be build for a given length, then none of the other bridges can. Effectively meaning that if someone replaces the first bridge with a bridge that can be only 3 tiles longs then only other bridges that can be 3 tiles long will be buildable, but only if they are 3 tiles long.
rubidium <rubidium@openttd.org>
parents:
8540
diff
changeset
|
64 bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, uint32 flags = 0); |
8119
b6ec923e9fa8
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
65 int CalcBridgeLenCostFactor(int x); |
b6ec923e9fa8
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
66 |
8489
bcc7ea0c669d
(svn r12064) -Codechange : Give grf bridges their own ResetBridges function, and put bridge spec in table/bridge_land.h, where it should be.
belugas <belugas@openttd.org>
parents:
8475
diff
changeset
|
67 void ResetBridges(); |
bcc7ea0c669d
(svn r12064) -Codechange : Give grf bridges their own ResetBridges function, and put bridge spec in table/bridge_land.h, where it should be.
belugas <belugas@openttd.org>
parents:
8475
diff
changeset
|
68 |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
69 #endif /* BRIDGE_H */ |