Mercurial > hg > openttd
annotate src/base_station_base.h @ 13419:ddfb6a69b9c3 draft
(svn r17928) -Codechange: ShowErrorMessage() now takes the summary string before the details string.
Gentlemen, swap your string parameters.
author | alberth <alberth@openttd.org> |
---|---|
date | Sat, 31 Oct 2009 19:46:51 +0000 |
parents | ecdff570eab8 |
children | f6271037a1a0 |
rev | line source |
---|---|
12477
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12528
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12528
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12528
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:
12528
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:
12528
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:
12528
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12528
diff
changeset
|
9 |
12477
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 /** @file base_station_base.h Base classes/functions for base stations. */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 #ifndef BASE_STATION_BASE_H |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 #define BASE_STATION_BASE_H |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
15 #include "station_type.h" |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
16 #include "core/pool_type.hpp" |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
17 #include "town_type.h" |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
18 #include "strings_type.h" |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
19 #include "date_type.h" |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
20 #include "company_type.h" |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
21 #include "viewport_type.h" |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
22 #include "station_map.h" |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 typedef Pool<BaseStation, StationID, 32, 64000> StationPool; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
25 extern StationPool _station_pool; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
26 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
27 struct StationSpecList { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
28 const StationSpec *spec; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
29 uint32 grfid; ///< GRF ID of this custom station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
30 uint8 localidx; ///< Station ID within GRF of station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
31 }; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
32 |
12525
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
33 |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
34 /** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */ |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
35 struct StationRect : public Rect { |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
36 enum StationRectMode |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
37 { |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
38 ADD_TEST = 0, |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
39 ADD_TRY, |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
40 ADD_FORCE |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
41 }; |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
42 |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
43 StationRect(); |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
44 void MakeEmpty(); |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
45 bool PtInExtendedRect(int x, int y, int distance = 0) const; |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
46 bool IsEmpty() const; |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
47 bool BeforeAddTile(TileIndex tile, StationRectMode mode); |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
48 bool BeforeAddRect(TileIndex tile, int w, int h, StationRectMode mode); |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
49 bool AfterRemoveTile(BaseStation *st, TileIndex tile); |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
50 bool AfterRemoveRect(BaseStation *st, TileIndex tile, int w, int h); |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
51 |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
52 static bool ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a); |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
53 |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
54 StationRect& operator = (Rect src); |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
55 }; |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
56 |
12477
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
57 /** Base class for all station-ish types */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
58 struct BaseStation : StationPool::PoolItem<&_station_pool> { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
59 TileIndex xy; ///< Base tile of the station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
60 ViewportSign sign; ///< NOSAVE: Dimensions of sign |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
61 byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
62 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
63 char *name; ///< Custom name |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
64 StringID string_id; ///< Default name (town area) of station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
65 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
66 Town *town; ///< The town this station is associated with |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
67 OwnerByte owner; ///< The owner of this station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
68 StationFacilityByte facilities; ///< The facilities that this station has |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
69 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
70 uint8 num_specs; ///< Number of specs in the speclist |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
71 StationSpecList *speclist; ///< List of station specs of this station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
72 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
73 Date build_date; ///< Date of construction |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
74 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
75 uint16 random_bits; ///< Random bits assigned to this station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
76 byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
77 uint8 cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
78 |
12525
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
79 TileArea train_station; ///< Tile area the train 'station' part covers |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
80 StationRect rect; ///< NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
81 |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
82 /** |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
83 * Initialize the base station. |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
84 * @param tile The location of the station sign |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
85 */ |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
86 BaseStation(TileIndex tile) : |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
87 xy(tile), |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
88 train_station(INVALID_TILE, 0, 0) |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
89 { |
6ff0b71dee93
(svn r16962) -Codechange: more work towards multi tile waypoints
rubidium <rubidium@openttd.org>
parents:
12510
diff
changeset
|
90 } |
12477
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
91 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
92 virtual ~BaseStation(); |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
93 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
94 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
95 * Check whether a specific tile belongs to this station. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
96 * @param tile the tile to check |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
97 * @return true if the tile belongs to this station |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
98 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
99 virtual bool TileBelongsToRailStation(TileIndex tile) const = 0; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
100 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
101 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
102 * Helper function to get a NewGRF variable that isn't implemented by the base class. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
103 * @param object the resolver object related to this query |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
104 * @param variable that is queried |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
105 * @param parameter parameter for that variable |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
106 * @param available will return false if ever the variable asked for does not exist |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
107 * @return the value stored in the corresponding variable |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
108 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
109 virtual uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const = 0; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
110 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
111 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
112 * Update the coordinated of the sign (as shown in the viewport). |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
113 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
114 virtual void UpdateVirtCoord() = 0; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
115 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
116 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
117 * Get the tile area for a given station type. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
118 * @param ta tile area to fill. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
119 * @param type the type of the area |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
120 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
121 virtual void GetTileArea(TileArea *ta, StationType type) const = 0; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
122 |
12503
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
123 |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
124 /** |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
125 * Obtain the length of a platform |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
126 * @pre tile must be a rail station tile |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
127 * @param tile A tile that contains the platform in question |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
128 * @return The length of the platform |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
129 */ |
12508
eba7dabded87
(svn r16945) -Fix (r16940): comments got swapped
rubidium <rubidium@openttd.org>
parents:
12503
diff
changeset
|
130 virtual uint GetPlatformLength(TileIndex tile) const = 0; |
12503
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
131 |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
132 /** |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
133 * Determines the REMAINING length of a platform, starting at (and including) |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
134 * the given tile. |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
135 * @param tile the tile from which to start searching. Must be a rail station tile |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
136 * @param dir The direction in which to search. |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
137 * @return The platform length |
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
138 */ |
12508
eba7dabded87
(svn r16945) -Fix (r16940): comments got swapped
rubidium <rubidium@openttd.org>
parents:
12503
diff
changeset
|
139 virtual uint GetPlatformLength(TileIndex tile, DiagDirection dir) const = 0; |
12503
9da198c570da
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
rubidium <rubidium@openttd.org>
parents:
12497
diff
changeset
|
140 |
12477
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
141 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
142 * Get the base station belonging to a specific tile. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
143 * @param tile The tile to get the base station from. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
144 * @return the station associated with that tile. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
145 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
146 static FORCEINLINE BaseStation *GetByTile(TileIndex tile) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
147 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
148 return BaseStation::Get(GetStationIndex(tile)); |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
149 } |
12497
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
150 |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
151 /** |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
152 * Check whether the base station currently is in use; in use means |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
153 * that it is not scheduled for deletion and that it still has some |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
154 * facilities left. |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
155 * @return true if still in use |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
156 */ |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
157 FORCEINLINE bool IsInUse() const |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
158 { |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
159 return (this->facilities & ~FACIL_WAYPOINT) != 0; |
73d75faa3cb0
(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not
rubidium <rubidium@openttd.org>
parents:
12477
diff
changeset
|
160 } |
13014
ecdff570eab8
(svn r17508) -Fix [FS#3195] (r16859): join station window didn't get updated when stations were removed from the pool
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
161 |
ecdff570eab8
(svn r17508) -Fix [FS#3195] (r16859): join station window didn't get updated when stations were removed from the pool
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
162 static void PostDestructor(size_t index); |
12477
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
163 }; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
164 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
165 #define FOR_ALL_BASE_STATIONS(var) FOR_ALL_ITEMS_FROM(BaseStation, station_index, var, 0) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
166 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
167 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
168 * Class defining several overloaded accessors so we don't |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
169 * have to cast base stations that often |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
170 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
171 template <class T, bool Tis_waypoint> |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
172 struct SpecializedStation : public BaseStation { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
173 static const StationFacility EXPECTED_FACIL = Tis_waypoint ? FACIL_WAYPOINT : FACIL_NONE; ///< Specialized type |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
174 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
175 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
176 * Set station type correctly |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
177 * @param tile The base tile of the station. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
178 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
179 FORCEINLINE SpecializedStation<T, Tis_waypoint>(TileIndex tile) : |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
180 BaseStation(tile) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
181 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
182 this->facilities = EXPECTED_FACIL; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
183 } |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
184 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
185 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
186 * Helper for checking whether the given station is of this type. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
187 * @param st the station to check. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
188 * @return true if the station is the type we expect it to be. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
189 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
190 static FORCEINLINE bool IsExpected(const BaseStation *st) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
191 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
192 return (st->facilities & FACIL_WAYPOINT) == EXPECTED_FACIL; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
193 } |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
194 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
195 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
196 * Tests whether given index is a valid index for station of this type |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
197 * @param index tested index |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
198 * @return is this index valid index of T? |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
199 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
200 static FORCEINLINE bool IsValidID(size_t index) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
201 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
202 return BaseStation::IsValidID(index) && IsExpected(BaseStation::Get(index)); |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
203 } |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
204 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
205 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
206 * Gets station with given index |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
207 * @return pointer to station with given index casted to T * |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
208 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
209 static FORCEINLINE T *Get(size_t index) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
210 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
211 return (T *)BaseStation::Get(index); |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
212 } |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
213 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
214 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
215 * Returns station if the index is a valid index for this station type |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
216 * @return pointer to station with given index if it's a station of this type |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
217 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
218 static FORCEINLINE T *GetIfValid(size_t index) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
219 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
220 return IsValidID(index) ? Get(index) : NULL ; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
221 } |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
222 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
223 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
224 * Get the station belonging to a specific tile. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
225 * @param tile The tile to get the station from. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
226 * @return the station associated with that tile. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
227 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
228 static FORCEINLINE T *GetByTile(TileIndex tile) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
229 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
230 return GetIfValid(GetStationIndex(tile)); |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
231 } |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
232 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
233 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
234 * Converts a BaseStation to SpecializedStation with type checking. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
235 * @param st BaseStation pointer |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
236 * @return pointer to SpecializedStation |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
237 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
238 static FORCEINLINE T *From(BaseStation *st) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
239 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
240 assert(IsExpected(st)); |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
241 return (T *)st; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
242 } |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
243 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
244 /** |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
245 * Converts a const BaseStation to const SpecializedStation with type checking. |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
246 * @param st BaseStation pointer |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
247 * @return pointer to SpecializedStation |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
248 */ |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
249 static FORCEINLINE const T *From(const BaseStation *st) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
250 { |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
251 assert(IsExpected(st)); |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
252 return (const T *)st; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
253 } |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
254 }; |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
255 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
256 #define FOR_ALL_BASE_STATIONS_OF_TYPE(name, var) FOR_ALL_ITEMS_FROM(name, station_index, var, 0) if (name::IsExpected(var)) |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
257 |
843a8d074a90
(svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
258 #endif /* STATION_BASE_H */ |