Mercurial > hg > openttd
annotate src/rail.h @ 13748:4f41c01242a8 draft
(svn r18273) -Codechange: do not require widget numbers for default widgets (close, sticky, resize buttons and the caption), except when you want to use SetStringParameter for the caption ofcourse. Also remove the requirement for some of the WDF flags; no need to test for both the flag whether a feature is used and whether the feature is in action.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 24 Nov 2009 17:13:24 +0000 |
parents | 59959bee9f95 |
children | 31d285a8abf8 |
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 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12435
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12435
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12435
diff
changeset
|
5 * 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. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12435
diff
changeset
|
6 * 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. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12435
diff
changeset
|
7 * 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/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12435
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12435
diff
changeset
|
9 |
9111
d48433370037
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents:
9034
diff
changeset
|
10 /** @file rail.h Rail specific functions. */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 #ifndef RAIL_H |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 #define RAIL_H |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 |
8101
b222582555cb
(svn r11662) -Codechange: move some rail types/related functions around.
rubidium <rubidium@openttd.org>
parents:
8100
diff
changeset
|
15 #include "rail_type.h" |
b222582555cb
(svn r11662) -Codechange: move some rail types/related functions around.
rubidium <rubidium@openttd.org>
parents:
8100
diff
changeset
|
16 #include "track_type.h" |
8119
b6ec923e9fa8
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium <rubidium@openttd.org>
parents:
8116
diff
changeset
|
17 #include "vehicle_type.h" |
8123
c26c28875749
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
8121
diff
changeset
|
18 #include "gfx_type.h" |
8113
c35412099303
(svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium <rubidium@openttd.org>
parents:
8108
diff
changeset
|
19 #include "core/bitmath_func.hpp" |
8123
c26c28875749
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
8121
diff
changeset
|
20 #include "economy_func.h" |
9154
046d0b6e0218
(svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz <smatz@openttd.org>
parents:
9111
diff
changeset
|
21 #include "slope_type.h" |
12228
240adc64d01a
(svn r16643) -Codechange: replace GetStationByTile() by Station::GetByTile()
smatz <smatz@openttd.org>
parents:
11987
diff
changeset
|
22 #include "strings_type.h" |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 |
8860
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
24 enum RailTypeFlag { |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
25 RTF_CATENARY = 0, ///< Set if the rail type should have catenary drawn |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
26 }; |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
27 |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
28 enum RailTypeFlags { |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
29 RTFB_NONE = 0, |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
30 RTFB_CATENARY = 1 << RTF_CATENARY, |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
31 }; |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
32 DECLARE_ENUM_AS_BIT_SET(RailTypeFlags); |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
33 |
10718
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
34 /** Offsets from base sprite for fence sprites. These are in the order of |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
35 * the sprites in the original data files. |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
36 */ |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
37 enum RailFenceOffset { |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
38 RFO_FLAT_X, |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
39 RFO_FLAT_Y, |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
40 RFO_FLAT_VERT, |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
41 RFO_FLAT_HORZ, |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
42 RFO_SLOPE_SW, |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
43 RFO_SLOPE_SE, |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
44 RFO_SLOPE_NE, |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
45 RFO_SLOPE_NW, |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
46 }; |
1649a83f7b39
(svn r15050) -Codechange: Use one absolute SpriteID with offsets to draw track fences.
peter1138 <peter1138@openttd.org>
parents:
10225
diff
changeset
|
47 |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
48 /** This struct contains all the info that is needed to draw and construct tracks. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
49 */ |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6162
diff
changeset
|
50 struct RailtypeInfo { |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
51 /** Struct containing the main sprites. @note not all sprites are listed, but only |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
52 * the ones used directly in the code */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
53 struct { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
54 SpriteID track_y; ///< single piece of rail in Y direction, with ground |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
55 SpriteID track_ns; ///< two pieces of rail in North and South corner (East-West direction) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
56 SpriteID ground; ///< ground sprite for a 3-way switch |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
57 SpriteID single_y; ///< single piece of rail in Y direction, without ground |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
58 SpriteID single_x; ///< single piece of rail in X direction |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
59 SpriteID single_n; ///< single piece of rail in the northern corner |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
60 SpriteID single_s; ///< single piece of rail in the southern corner |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
61 SpriteID single_e; ///< single piece of rail in the eastern corner |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
62 SpriteID single_w; ///< single piece of rail in the western corner |
9493
83bad4f336b3
(svn r13469) -Codechange: add support for loading Action 0x05, type 0F: "tracks for slopes". It's not useful right now, but it will be in the future.
rubidium <rubidium@openttd.org>
parents:
9154
diff
changeset
|
63 SpriteID single_sloped;///< single piecs of rail for slopes |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
64 SpriteID crossing; ///< level crossing, rail in X direction |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
65 SpriteID tunnel; ///< tunnel sprites base |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
66 } base_sprites; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
67 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
68 /** struct containing the sprites for the rail GUI. @note only sprites referred to |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
69 * directly in the code are listed */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
70 struct { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
71 SpriteID build_ns_rail; ///< button for building single rail in N-S direction |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
72 SpriteID build_x_rail; ///< button for building single rail in X direction |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
73 SpriteID build_ew_rail; ///< button for building single rail in E-W direction |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
74 SpriteID build_y_rail; ///< button for building single rail in Y direction |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
75 SpriteID auto_rail; ///< button for the autorail construction |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
76 SpriteID build_depot; ///< button for building depots |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
77 SpriteID build_tunnel; ///< button for building a tunnel |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
78 SpriteID convert_rail; ///< button for converting rail |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
79 } gui_sprites; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
80 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
81 struct { |
7396
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
82 CursorID rail_ns; ///< Cursor for building rail in N-S direction |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
83 CursorID rail_swne; ///< Cursor for building rail in X direction |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
84 CursorID rail_ew; ///< Cursor for building rail in E-W direction |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
85 CursorID rail_nwse; ///< Cursor for building rail in Y direction |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
86 CursorID autorail; ///< Cursor for autorail tool |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
87 CursorID depot; ///< Cursor for building a depot |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
88 CursorID tunnel; ///< Cursor for building a tunnel |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
89 CursorID convert; ///< Cursor for converting track |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
90 } cursor; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
91 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
92 struct { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
93 StringID toolbar_caption; |
10000
4b2c65748b47
(svn r14157) -Codechange: Add and use string properties for rail types instead of relying on consecutive string IDs.
peter1138 <peter1138@openttd.org>
parents:
9775
diff
changeset
|
94 StringID menu_text; |
4b2c65748b47
(svn r14157) -Codechange: Add and use string properties for rail types instead of relying on consecutive string IDs.
peter1138 <peter1138@openttd.org>
parents:
9775
diff
changeset
|
95 StringID build_caption; |
4b2c65748b47
(svn r14157) -Codechange: Add and use string properties for rail types instead of relying on consecutive string IDs.
peter1138 <peter1138@openttd.org>
parents:
9775
diff
changeset
|
96 StringID replace_text; |
4b2c65748b47
(svn r14157) -Codechange: Add and use string properties for rail types instead of relying on consecutive string IDs.
peter1138 <peter1138@openttd.org>
parents:
9775
diff
changeset
|
97 StringID new_loco; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
98 } strings; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
99 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
100 /** sprite number difference between a piece of track on a snowy ground and the corresponding one on normal ground */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
101 SpriteID snow_offset; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
102 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
103 /** bitmask to the OTHER railtypes on which an engine of THIS railtype generates power */ |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
104 RailTypes powered_railtypes; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
105 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
106 /** bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel */ |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
107 RailTypes compatible_railtypes; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
108 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
109 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
110 * Offset between the current railtype and normal rail. This means that:<p> |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
111 * 1) All the sprites in a railset MUST be in the same order. This order |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
112 * is determined by normal rail. Check sprites 1005 and following for this order<p> |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
113 * 2) The position where the railtype is loaded must always be the same, otherwise |
6420
080aae477331
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas <belugas@openttd.org>
parents:
6248
diff
changeset
|
114 * the offset will fail. |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
115 * @note: Something more flexible might be desirable in the future. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
116 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
117 SpriteID total_offset; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
118 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
119 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
120 * Bridge offset |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
121 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
122 SpriteID bridge_offset; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
123 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
124 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
125 * Offset to add to ground sprite when drawing custom waypoints / stations |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
126 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
127 byte custom_ground_offset; |
8169
7962907a27a1
(svn r11732) -Fix (r4150): elrail merge gave elrail, monorail & maglev unintended speed bonuses for curves, as the bonus was based on the railtype index. The bonus is now specified by a property of the railtype.
peter1138 <peter1138@openttd.org>
parents:
8138
diff
changeset
|
128 |
7962907a27a1
(svn r11732) -Fix (r4150): elrail merge gave elrail, monorail & maglev unintended speed bonuses for curves, as the bonus was based on the railtype index. The bonus is now specified by a property of the railtype.
peter1138 <peter1138@openttd.org>
parents:
8138
diff
changeset
|
129 /** |
7962907a27a1
(svn r11732) -Fix (r4150): elrail merge gave elrail, monorail & maglev unintended speed bonuses for curves, as the bonus was based on the railtype index. The bonus is now specified by a property of the railtype.
peter1138 <peter1138@openttd.org>
parents:
8138
diff
changeset
|
130 * Multiplier for curve maximum speed advantage |
7962907a27a1
(svn r11732) -Fix (r4150): elrail merge gave elrail, monorail & maglev unintended speed bonuses for curves, as the bonus was based on the railtype index. The bonus is now specified by a property of the railtype.
peter1138 <peter1138@openttd.org>
parents:
8138
diff
changeset
|
131 */ |
7962907a27a1
(svn r11732) -Fix (r4150): elrail merge gave elrail, monorail & maglev unintended speed bonuses for curves, as the bonus was based on the railtype index. The bonus is now specified by a property of the railtype.
peter1138 <peter1138@openttd.org>
parents:
8138
diff
changeset
|
132 byte curve_speed; |
8860
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
133 |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
134 /** |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
135 * Bit mask of rail type flags |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
136 */ |
c55cd1fe12f3
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
peter1138 <peter1138@openttd.org>
parents:
8732
diff
changeset
|
137 RailTypeFlags flags; |
10002
139ef0c97e94
(svn r14160) -Codechange: Move _railtype_cost_multipliers into the rail type information struct.
peter1138 <peter1138@openttd.org>
parents:
10001
diff
changeset
|
138 |
139ef0c97e94
(svn r14160) -Codechange: Move _railtype_cost_multipliers into the rail type information struct.
peter1138 <peter1138@openttd.org>
parents:
10001
diff
changeset
|
139 /** |
139ef0c97e94
(svn r14160) -Codechange: Move _railtype_cost_multipliers into the rail type information struct.
peter1138 <peter1138@openttd.org>
parents:
10001
diff
changeset
|
140 * Cost multiplier for building this rail type |
139ef0c97e94
(svn r14160) -Codechange: Move _railtype_cost_multipliers into the rail type information struct.
peter1138 <peter1138@openttd.org>
parents:
10001
diff
changeset
|
141 */ |
139ef0c97e94
(svn r14160) -Codechange: Move _railtype_cost_multipliers into the rail type information struct.
peter1138 <peter1138@openttd.org>
parents:
10001
diff
changeset
|
142 uint8 cost_multiplier; |
11076
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
143 |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
144 /** |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
145 * Unique 32 bit rail type identifier |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
146 */ |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
147 RailTypeLabel label; |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6162
diff
changeset
|
148 }; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
149 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
150 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
151 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
152 * Returns a pointer to the Railtype information for a given railtype |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
153 * @param railtype the rail type which the information is requested for |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
154 * @return The pointer to the RailtypeInfo |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
155 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
156 static inline const RailtypeInfo *GetRailTypeInfo(RailType railtype) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
157 { |
6162
d7bcc0708818
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium <rubidium@openttd.org>
parents:
6156
diff
changeset
|
158 extern RailtypeInfo _railtypes[RAILTYPE_END]; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
159 assert(railtype < RAILTYPE_END); |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
160 return &_railtypes[railtype]; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
161 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
162 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
163 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
164 * Checks if an engine of the given RailType can drive on a tile with a given |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
165 * RailType. This would normally just be an equality check, but for electric |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
166 * rails (which also support non-electric engines). |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
167 * @return Whether the engine can drive on this tile. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
168 * @param enginetype The RailType of the engine we are considering. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
169 * @param tiletype The RailType of the tile we are considering. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
170 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
171 static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
172 { |
7928
4e8dfd103163
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7833
diff
changeset
|
173 return HasBit(GetRailTypeInfo(enginetype)->compatible_railtypes, tiletype); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
174 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
175 |
7396
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
176 /** |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
177 * Checks if an engine of the given RailType got power on a tile with a given |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
178 * RailType. This would normally just be an equality check, but for electric |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
179 * rails (which also support non-electric engines). |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
180 * @return Whether the engine got power on this tile. |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
181 * @param enginetype The RailType of the engine we are considering. |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
182 * @param tiletype The RailType of the tile we are considering. |
57ff3c1c55de
(svn r10765) -Documentation [FS#1100]: of rail.h. Based on a patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7335
diff
changeset
|
183 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
184 static inline bool HasPowerOnRail(RailType enginetype, RailType tiletype) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
185 { |
7928
4e8dfd103163
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7833
diff
changeset
|
186 return HasBit(GetRailTypeInfo(enginetype)->powered_railtypes, tiletype); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
187 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
188 |
7730
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
189 /** |
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
190 * Returns the cost of building the specified railtype. |
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
191 * @param railtype The railtype being built. |
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
192 * @return The cost multiplier. |
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
193 */ |
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
194 static inline Money RailBuildCost(RailType railtype) |
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
195 { |
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
196 assert(railtype < RAILTYPE_END); |
13486
f2535c5098a0
(svn r18005) -Codechange: Convert the Prices struct into an array and an enum.
frosch <frosch@openttd.org>
parents:
13070
diff
changeset
|
197 return (_price[PR_BUILD_RAIL] * GetRailTypeInfo(railtype)->cost_multiplier) >> 3; |
7730
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
198 } |
b2ca338938ed
(svn r11265) -Feature: Make more advanced rail types more expensive to build.
maedhros <maedhros@openttd.org>
parents:
7703
diff
changeset
|
199 |
8043
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
200 /** |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
201 * Calculates the cost of rail conversion |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
202 * @param from The railtype we are converting from |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
203 * @param to The railtype we are converting to |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
204 * @return Cost per TrackBit |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
205 */ |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
206 static inline Money RailConvertCost(RailType from, RailType to) |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
207 { |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
208 /* rail -> el. rail |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
209 * calculate the price as 5 / 4 of (cost build el. rail) - (cost build rail) |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
210 * (the price of workers to get to place is that 1/4) |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
211 */ |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
212 if (HasPowerOnRail(from, to)) { |
10004
4e67bcb0c5b1
(svn r14162) -Fix: Allow rail type conversion if the rail type cost multipliers are the same.
peter1138 <peter1138@openttd.org>
parents:
10002
diff
changeset
|
213 Money cost = ((RailBuildCost(to) - RailBuildCost(from)) * 5) >> 2; |
4e67bcb0c5b1
(svn r14162) -Fix: Allow rail type conversion if the rail type cost multipliers are the same.
peter1138 <peter1138@openttd.org>
parents:
10002
diff
changeset
|
214 if (cost != 0) return cost; |
8043
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
215 } |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
216 |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
217 /* el. rail -> rail |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
218 * calculate the price as 1 / 4 of (cost build el. rail) - (cost build rail) |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
219 * (the price of workers is 1 / 4 + price of copper sold to a recycle center) |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
220 */ |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
221 if (HasPowerOnRail(to, from)) { |
10004
4e67bcb0c5b1
(svn r14162) -Fix: Allow rail type conversion if the rail type cost multipliers are the same.
peter1138 <peter1138@openttd.org>
parents:
10002
diff
changeset
|
222 Money cost = (RailBuildCost(from) - RailBuildCost(to)) >> 2; |
4e67bcb0c5b1
(svn r14162) -Fix: Allow rail type conversion if the rail type cost multipliers are the same.
peter1138 <peter1138@openttd.org>
parents:
10002
diff
changeset
|
223 if (cost != 0) return cost; |
8043
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
224 } |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
225 |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
226 /* make the price the same as remove + build new type */ |
13486
f2535c5098a0
(svn r18005) -Codechange: Convert the Prices struct into an array and an enum.
frosch <frosch@openttd.org>
parents:
13070
diff
changeset
|
227 return RailBuildCost(to) + _price[PR_CLEAR_RAIL]; |
8043
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
228 } |
ec0309fb003a
(svn r11603) -Fix [FS#1481]: make price for railtype conversion more realistic
smatz <smatz@openttd.org>
parents:
7929
diff
changeset
|
229 |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
230 void DrawTrainDepotSprite(int x, int y, int image, RailType railtype); |
9775
c3caa51b9888
(svn r13912) -Codechange: remove some casts by returning the proper type instead of void*.
rubidium <rubidium@openttd.org>
parents:
9493
diff
changeset
|
231 Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data); |
11987
81554d4e6d76
(svn r16393) -Codechange: move VehicleRail to Train.
rubidium <rubidium@openttd.org>
parents:
11076
diff
changeset
|
232 int TicksToLeaveDepot(const Train *v); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
233 |
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:
7155
diff
changeset
|
234 Foundation GetRailFoundation(Slope tileh, TrackBits bits); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
235 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
236 |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
237 /** |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
238 * Finds out if a company has a certain railtype available |
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
239 * @param company the company in question |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
240 * @param railtype requested RailType |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
241 * @return true if company has requested RailType available |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
242 */ |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
243 bool HasRailtypeAvail(const CompanyID company, const RailType railtype); |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
244 |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
245 /** |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
246 * Validate functions for rail building. |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
247 * @param rail the railtype to check. |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
248 * @return true if the current company may build the rail. |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
249 */ |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
250 bool ValParamRailtype(const RailType rail); |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
251 |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
252 /** |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
253 * Returns the "best" railtype a company can build. |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
254 * As the AI doesn't know what the BEST one is, we have our own priority list |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
255 * here. When adding new railtypes, modify this function |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
256 * @param company the company "in action" |
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
257 * @return The "best" railtype a company has available |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
258 */ |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
259 RailType GetBestRailtype(const CompanyID company); |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
260 |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
261 /** |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10004
diff
changeset
|
262 * Get the rail types the given company can build. |
13070
1c4c4ae8d716
(svn r17570) -Fix: a number of Doxygen warnings about missing parameters, which were sometimes missing and sometimes just typos
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
263 * @param c the company to get the rail types for. |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
264 * @return the rail types. |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
265 */ |
10225
fe1681c9d05b
(svn r14448) -Codechange [FS#2328]: rename a few variables (based on a patch by planetmaker)
smatz <smatz@openttd.org>
parents:
10207
diff
changeset
|
266 RailTypes GetCompanyRailtypes(const CompanyID c); |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8211
diff
changeset
|
267 |
10001
5f7a84c30cdf
(svn r14158) -Codechange: Initialization of rail type data from static source, so data can be changed.
peter1138 <peter1138@openttd.org>
parents:
10000
diff
changeset
|
268 /** |
11076
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
269 * Get the rail type for a given label. |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
270 * @param label the railtype label. |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
271 * @return the railtype. |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
272 */ |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
273 RailType GetRailTypeByLabel(RailTypeLabel label); |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
274 |
3ce92d721ce1
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
peter1138 <peter1138@openttd.org>
parents:
10718
diff
changeset
|
275 /** |
10001
5f7a84c30cdf
(svn r14158) -Codechange: Initialization of rail type data from static source, so data can be changed.
peter1138 <peter1138@openttd.org>
parents:
10000
diff
changeset
|
276 * Reset all rail type information to its default values. |
5f7a84c30cdf
(svn r14158) -Codechange: Initialization of rail type data from static source, so data can be changed.
peter1138 <peter1138@openttd.org>
parents:
10000
diff
changeset
|
277 */ |
5f7a84c30cdf
(svn r14158) -Codechange: Initialization of rail type data from static source, so data can be changed.
peter1138 <peter1138@openttd.org>
parents:
10000
diff
changeset
|
278 void ResetRailTypes(); |
5f7a84c30cdf
(svn r14158) -Codechange: Initialization of rail type data from static source, so data can be changed.
peter1138 <peter1138@openttd.org>
parents:
10000
diff
changeset
|
279 |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
280 #endif /* RAIL_H */ |