author | truebrain |
Mon, 30 Jun 2008 21:31:23 +0000 | |
branch | noai |
changeset 11111 | 1b984dab8cec |
parent 10920 | e33442a2b239 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10355
diff
changeset
|
3 |
/** @file rail.h Rail specific functions. */ |
2232
0c63dce21e30
(svn r2752) -Doc: Added some doxygen stuff to rail.h. I'm gonna mess around with this file and wanted to get rid of this first
celestar
parents:
2186
diff
changeset
|
4 |
|
1942
634961366cdc
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
5 |
#ifndef RAIL_H |
634961366cdc
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
6 |
#define RAIL_H |
634961366cdc
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
7 |
|
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
8 |
#include "rail_type.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
9 |
#include "track_type.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
10 |
#include "vehicle_type.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
11 |
#include "gfx_type.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
12 |
#include "core/bitmath_func.hpp" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
13 |
#include "economy_func.h" |
10513
33cb70ff2f5d
(svn r13056) [NoAI] -Sync: with trunk r12996:13055.
rubidium
parents:
10455
diff
changeset
|
14 |
#include "slope_type.h" |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
15 |
|
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
16 |
enum RailTypeFlag { |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
17 |
RTF_CATENARY = 0, ///< Set if the rail type should have catenary drawn |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
18 |
}; |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
19 |
|
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
20 |
enum RailTypeFlags { |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
21 |
RTFB_NONE = 0, |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
22 |
RTFB_CATENARY = 1 << RTF_CATENARY, |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
23 |
}; |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
24 |
DECLARE_ENUM_AS_BIT_SET(RailTypeFlags); |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
25 |
|
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
26 |
/** This struct contains all the info that is needed to draw and construct tracks. |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
27 |
*/ |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6488
diff
changeset
|
28 |
struct RailtypeInfo { |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
29 |
/** Struct containing the main sprites. @note not all sprites are listed, but only |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
30 |
* the ones used directly in the code */ |
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
31 |
struct { |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
32 |
SpriteID track_y; ///< single piece of rail in Y direction, with ground |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
33 |
SpriteID track_ns; ///< two pieces of rail in North and South corner (East-West direction) |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
34 |
SpriteID ground; ///< ground sprite for a 3-way switch |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
35 |
SpriteID single_y; ///< single piece of rail in Y direction, without ground |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
36 |
SpriteID single_x; ///< single piece of rail in X direction |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
37 |
SpriteID single_n; ///< single piece of rail in the northern corner |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
38 |
SpriteID single_s; ///< single piece of rail in the southern corner |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
39 |
SpriteID single_e; ///< single piece of rail in the eastern corner |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
40 |
SpriteID single_w; ///< single piece of rail in the western corner |
10920 | 41 |
SpriteID single_sloped;///< single piecs of rail for slopes |
2511
0a81d9ca79bc
(svn r3037) Don't deduce the sprites for tunnels and level crossings from magic numbers, but fetch them from the central rail info array. This is a preparation step for electrified rails
tron
parents:
2472
diff
changeset
|
42 |
SpriteID crossing; ///< level crossing, rail in X direction |
0a81d9ca79bc
(svn r3037) Don't deduce the sprites for tunnels and level crossings from magic numbers, but fetch them from the central rail info array. This is a preparation step for electrified rails
tron
parents:
2472
diff
changeset
|
43 |
SpriteID tunnel; ///< tunnel sprites base |
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
44 |
} base_sprites; |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
45 |
|
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
46 |
/** struct containing the sprites for the rail GUI. @note only sprites referred to |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
47 |
* directly in the code are listed */ |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
48 |
struct { |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
49 |
SpriteID build_ns_rail; ///< button for building single rail in N-S direction |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
50 |
SpriteID build_x_rail; ///< button for building single rail in X direction |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
51 |
SpriteID build_ew_rail; ///< button for building single rail in E-W direction |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
52 |
SpriteID build_y_rail; ///< button for building single rail in Y direction |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
53 |
SpriteID auto_rail; ///< button for the autorail construction |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
54 |
SpriteID build_depot; ///< button for building depots |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
55 |
SpriteID build_tunnel; ///< button for building a tunnel |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
56 |
SpriteID convert_rail; ///< button for converting rail |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
57 |
} gui_sprites; |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
58 |
|
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
59 |
struct { |
9694
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
60 |
CursorID rail_ns; ///< Cursor for building rail in N-S direction |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
61 |
CursorID rail_swne; ///< Cursor for building rail in X direction |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
62 |
CursorID rail_ew; ///< Cursor for building rail in E-W direction |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
63 |
CursorID rail_nwse; ///< Cursor for building rail in Y direction |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
64 |
CursorID autorail; ///< Cursor for autorail tool |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
65 |
CursorID depot; ///< Cursor for building a depot |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
66 |
CursorID tunnel; ///< Cursor for building a tunnel |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
67 |
CursorID convert; ///< Cursor for converting track |
2514
8887b1f005c7
(svn r3040) Don't deduce the cursor sprites when building rails from magic numbers, but fetch them from the central rail info array.
tron
parents:
2511
diff
changeset
|
68 |
} cursor; |
8887b1f005c7
(svn r3040) Don't deduce the cursor sprites when building rails from magic numbers, but fetch them from the central rail info array.
tron
parents:
2511
diff
changeset
|
69 |
|
8887b1f005c7
(svn r3040) Don't deduce the cursor sprites when building rails from magic numbers, but fetch them from the central rail info array.
tron
parents:
2511
diff
changeset
|
70 |
struct { |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
71 |
StringID toolbar_caption; |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
72 |
} strings; |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
73 |
|
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
74 |
/** sprite number difference between a piece of track on a snowy ground and the corresponding one on normal ground */ |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
75 |
SpriteID snow_offset; |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
76 |
|
3355
a653b8e47f27
(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:
3267
diff
changeset
|
77 |
/** bitmask to the OTHER railtypes on which an engine of THIS railtype generates power */ |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
78 |
RailTypes powered_railtypes; |
3355
a653b8e47f27
(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:
3267
diff
changeset
|
79 |
|
a653b8e47f27
(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:
3267
diff
changeset
|
80 |
/** bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel */ |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
81 |
RailTypes compatible_railtypes; |
2254
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
82 |
|
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
83 |
/** |
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
84 |
* Offset between the current railtype and normal rail. This means that:<p> |
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
85 |
* 1) All the sprites in a railset MUST be in the same order. This order |
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
86 |
* is determined by normal rail. Check sprites 1005 and following for this order<p> |
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
87 |
* 2) The position where the railtype is loaded must always be the same, otherwise |
9574 | 88 |
* the offset will fail. |
2254
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
89 |
* @note: Something more flexible might be desirable in the future. |
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
90 |
*/ |
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
91 |
SpriteID total_offset; |
2536
8c4e298f4886
(svn r3065) -Codechange/Add: Modified the bridge drawing code so that the basic offset is read from the RailTypeInfo struct. This is (hopefully) the last DrawTile change on the way to electrified railways. While being at it, de-mystified the function a bit and added some asserts.
celestar
parents:
2520
diff
changeset
|
92 |
|
8c4e298f4886
(svn r3065) -Codechange/Add: Modified the bridge drawing code so that the basic offset is read from the RailTypeInfo struct. This is (hopefully) the last DrawTile change on the way to electrified railways. While being at it, de-mystified the function a bit and added some asserts.
celestar
parents:
2520
diff
changeset
|
93 |
/** |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4041
diff
changeset
|
94 |
* Bridge offset |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4041
diff
changeset
|
95 |
*/ |
2536
8c4e298f4886
(svn r3065) -Codechange/Add: Modified the bridge drawing code so that the basic offset is read from the RailTypeInfo struct. This is (hopefully) the last DrawTile change on the way to electrified railways. While being at it, de-mystified the function a bit and added some asserts.
celestar
parents:
2520
diff
changeset
|
96 |
SpriteID bridge_offset; |
3503
425903b204fa
(svn r4354) [Elrail][NewGRF] Codechange: Drawing of custom waypoints with custom ground sprites used the index of the rail type as an offset. With the introduction of elrails this offset is incorrect, so instead there is now a lookup table within the RailTypeInfo struct to explicitly list the offset.
peter1138
parents:
3500
diff
changeset
|
97 |
|
425903b204fa
(svn r4354) [Elrail][NewGRF] Codechange: Drawing of custom waypoints with custom ground sprites used the index of the rail type as an offset. With the introduction of elrails this offset is incorrect, so instead there is now a lookup table within the RailTypeInfo struct to explicitly list the offset.
peter1138
parents:
3500
diff
changeset
|
98 |
/** |
425903b204fa
(svn r4354) [Elrail][NewGRF] Codechange: Drawing of custom waypoints with custom ground sprites used the index of the rail type as an offset. With the introduction of elrails this offset is incorrect, so instead there is now a lookup table within the RailTypeInfo struct to explicitly list the offset.
peter1138
parents:
3500
diff
changeset
|
99 |
* Offset to add to ground sprite when drawing custom waypoints / stations |
425903b204fa
(svn r4354) [Elrail][NewGRF] Codechange: Drawing of custom waypoints with custom ground sprites used the index of the rail type as an offset. With the introduction of elrails this offset is incorrect, so instead there is now a lookup table within the RailTypeInfo struct to explicitly list the offset.
peter1138
parents:
3500
diff
changeset
|
100 |
*/ |
425903b204fa
(svn r4354) [Elrail][NewGRF] Codechange: Drawing of custom waypoints with custom ground sprites used the index of the rail type as an offset. With the introduction of elrails this offset is incorrect, so instead there is now a lookup table within the RailTypeInfo struct to explicitly list the offset.
peter1138
parents:
3500
diff
changeset
|
101 |
byte custom_ground_offset; |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
102 |
|
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
103 |
/** |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
104 |
* Multiplier for curve maximum speed advantage |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
105 |
*/ |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
106 |
byte curve_speed; |
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
107 |
|
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
108 |
/** |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
109 |
* Bit mask of rail type flags |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
110 |
*/ |
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9826
diff
changeset
|
111 |
RailTypeFlags flags; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6488
diff
changeset
|
112 |
}; |
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
113 |
|
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
114 |
|
1967
c57192f4c121
(svn r2473) - Add: VehicleMayEnterTile(), which checks if the tile owner of a tile is correct for a vehicle to enter it. Based upon glx's code.
matthijs
parents:
1950
diff
changeset
|
115 |
/** |
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
116 |
* Returns a pointer to the Railtype information for a given railtype |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
117 |
* @param railtype the rail type which the information is requested for |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
118 |
* @return The pointer to the RailtypeInfo |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
119 |
*/ |
2236 | 120 |
static inline const RailtypeInfo *GetRailTypeInfo(RailType railtype) |
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
121 |
{ |
6488
07bbbafd4f70
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6482
diff
changeset
|
122 |
extern RailtypeInfo _railtypes[RAILTYPE_END]; |
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
123 |
assert(railtype < RAILTYPE_END); |
2236 | 124 |
return &_railtypes[railtype]; |
2233
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
125 |
} |
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
126 |
|
146e2e405ec1
(svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes.
celestar
parents:
2232
diff
changeset
|
127 |
/** |
2006
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
128 |
* Checks if an engine of the given RailType can drive on a tile with a given |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
129 |
* RailType. This would normally just be an equality check, but for electric |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
130 |
* rails (which also support non-electric engines). |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
131 |
* @return Whether the engine can drive on this tile. |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
132 |
* @param enginetype The RailType of the engine we are considering. |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
133 |
* @param tiletype The RailType of the tile we are considering. |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
134 |
*/ |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
135 |
static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype) |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
136 |
{ |
9722
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9718
diff
changeset
|
137 |
return HasBit(GetRailTypeInfo(enginetype)->compatible_railtypes, tiletype); |
2006
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
138 |
} |
324916f22a8a
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
2001
diff
changeset
|
139 |
|
9694
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
140 |
/** |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
141 |
* Checks if an engine of the given RailType got power on a tile with a given |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
142 |
* RailType. This would normally just be an equality check, but for electric |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
143 |
* rails (which also support non-electric engines). |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
144 |
* @return Whether the engine got power on this tile. |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
145 |
* @param enginetype The RailType of the engine we are considering. |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
146 |
* @param tiletype The RailType of the tile we are considering. |
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
147 |
*/ |
3355
a653b8e47f27
(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:
3267
diff
changeset
|
148 |
static inline bool HasPowerOnRail(RailType enginetype, RailType tiletype) |
a653b8e47f27
(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:
3267
diff
changeset
|
149 |
{ |
9722
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9718
diff
changeset
|
150 |
return HasBit(GetRailTypeInfo(enginetype)->powered_railtypes, tiletype); |
3355
a653b8e47f27
(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:
3267
diff
changeset
|
151 |
} |
a653b8e47f27
(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:
3267
diff
changeset
|
152 |
|
9718
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
153 |
|
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
154 |
extern int _railtype_cost_multiplier[RAILTYPE_END]; |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
155 |
extern const int _default_railtype_cost_multiplier[RAILTYPE_END]; |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
156 |
|
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
157 |
/** |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
158 |
* Returns the cost of building the specified railtype. |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
159 |
* @param railtype The railtype being built. |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
160 |
* @return The cost multiplier. |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
161 |
*/ |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
162 |
static inline Money RailBuildCost(RailType railtype) |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
163 |
{ |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
164 |
assert(railtype < RAILTYPE_END); |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
165 |
return (_price.build_rail * _railtype_cost_multiplier[railtype]) >> 3; |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
166 |
} |
f82a4facea8b
(svn r11309) [NoAI] -Sync: with trunk r11145:11308.
truelight
parents:
9703
diff
changeset
|
167 |
|
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
168 |
/** |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
169 |
* Calculates the cost of rail conversion |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
170 |
* @param from The railtype we are converting from |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
171 |
* @param to The railtype we are converting to |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
172 |
* @return Cost per TrackBit |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
173 |
*/ |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
174 |
static inline Money RailConvertCost(RailType from, RailType to) |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
175 |
{ |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
176 |
/* rail -> el. rail |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
177 |
* calculate the price as 5 / 4 of (cost build el. rail) - (cost build rail) |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
178 |
* (the price of workers to get to place is that 1/4) |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
179 |
*/ |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
180 |
if (HasPowerOnRail(from, to)) { |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
181 |
return ((RailBuildCost(to) - RailBuildCost(from)) * 5) >> 2; |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
182 |
} |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
183 |
|
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
184 |
/* el. rail -> rail |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
185 |
* calculate the price as 1 / 4 of (cost build el. rail) - (cost build rail) |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
186 |
* (the price of workers is 1 / 4 + price of copper sold to a recycle center) |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
187 |
*/ |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
188 |
if (HasPowerOnRail(to, from)) { |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
189 |
return (RailBuildCost(from) - RailBuildCost(to)) >> 2; |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
190 |
} |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
191 |
|
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
192 |
/* make the price the same as remove + build new type */ |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
193 |
return RailBuildCost(to) + _price.remove_rail; |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
194 |
} |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
195 |
|
9703
d2a6acdbd665
(svn r11146) [NoAI] -Sync: with trunk r11035:11045.
rubidium
parents:
9694
diff
changeset
|
196 |
void *UpdateTrainPowerProc(Vehicle *v, void *data); |
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
197 |
void DrawTrainDepotSprite(int x, int y, int image, RailType railtype); |
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
198 |
void DrawDefaultWaypointSprite(int x, int y, RailType railtype); |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
199 |
void *EnsureNoTrainOnTrackProc(Vehicle *v, void *data); |
9826
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9724
diff
changeset
|
200 |
int TicksToLeaveDepot(const Vehicle *v); |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9724
diff
changeset
|
201 |
|
9694
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9631
diff
changeset
|
202 |
Foundation GetRailFoundation(Slope tileh, TrackBits bits); |
5116
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
4549
diff
changeset
|
203 |
|
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
4549
diff
changeset
|
204 |
|
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
205 |
/** |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
206 |
* Finds out if a Player has a certain railtype available |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
207 |
* @param p Player in question |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
208 |
* @param railtype requested RailType |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
209 |
* @return true if player has requested RailType available |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
210 |
*/ |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
211 |
bool HasRailtypeAvail(const PlayerID p, const RailType railtype); |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
212 |
|
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
213 |
/** |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
214 |
* Validate functions for rail building. |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
215 |
* @param rail the railtype to check. |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
216 |
* @return true if the current player may build the rail. |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
217 |
*/ |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
218 |
bool ValParamRailtype(const RailType rail); |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
219 |
|
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
220 |
/** |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
221 |
* Returns the "best" railtype a player can build. |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
222 |
* As the AI doesn't know what the BEST one is, we have our own priority list |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
223 |
* here. When adding new railtypes, modify this function |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
224 |
* @param p the player "in action" |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
225 |
* @return The "best" railtype a player has available |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
226 |
*/ |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
227 |
RailType GetBestRailtype(const PlayerID p); |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
228 |
|
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
229 |
/** |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
230 |
* Get the rail types the given player can build. |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
231 |
* @param p the player to get the rail types for. |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
232 |
* @return the rail types. |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
233 |
*/ |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
234 |
RailTypes GetPlayerRailtypes(const PlayerID p); |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
235 |
|
2536
8c4e298f4886
(svn r3065) -Codechange/Add: Modified the bridge drawing code so that the basic offset is read from the RailTypeInfo struct. This is (hopefully) the last DrawTile change on the way to electrified railways. While being at it, de-mystified the function a bit and added some asserts.
celestar
parents:
2520
diff
changeset
|
236 |
#endif /* RAIL_H */ |