annotate src/station_map.h @ 16547:a11cd939c335 draft

(svn r21273) -Codechange: Return values should start at the same line.
author alberth <alberth@openttd.org>
date Sat, 20 Nov 2010 15:44:24 +0000
parents 6b3718ff071d
children 41ea7460de25
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
12778
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12504
diff changeset
3 /*
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12504
diff changeset
4 * This file is part of OpenTTD.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12504
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: 12504
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: 12504
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: 12504
diff changeset
8 */
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12504
diff changeset
9
9111
d48433370037 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents: 8955
diff changeset
10 /** @file station_map.h Maps accessors for stations. */
6420
080aae477331 (svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas <belugas@openttd.org>
parents: 6248
diff changeset
11
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
12 #ifndef STATION_MAP_H
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
13 #define STATION_MAP_H
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
14
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
15 #include "rail_map.h"
6661
5850ac8865e8 (svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium <rubidium@openttd.org>
parents: 6420
diff changeset
16 #include "road_map.h"
8471
1e4ea519bfaf (svn r12042) -Fix [FS#1676]: Reimplement how rivers and canals are stored in the map, allowing the sea/river/canal status to also be
peter1138 <peter1138@openttd.org>
parents: 8422
diff changeset
17 #include "water_map.h"
8785
2a8950a812dc (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents: 8471
diff changeset
18 #include "station_func.h"
8138
60ea0f95de91 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium <rubidium@openttd.org>
parents: 7928
diff changeset
19 #include "rail.h"
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
20
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
21 typedef byte StationGfx; ///< Index of station graphics. @see _station_display_datas
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
22
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
23 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
24 * Get StationID from a tile
10260
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
25 * @param t Tile to query station ID from
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
26 * @pre IsTileType(t, MP_STATION)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
27 * @return Station ID of the station at \a t
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
28 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
29 static inline StationID GetStationIndex(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
30 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
31 assert(IsTileType(t, MP_STATION));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
32 return (StationID)_m[t].m2;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
34
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
35
15183
43a5d37b45c4 (svn r19812) -Codechange: give some unnamed enums a name or, in case they consisted of unrelated values use static const (u)int
rubidium <rubidium@openttd.org>
parents: 14618
diff changeset
36 static const int GFX_DOCK_BASE_WATER_PART = 4;
43a5d37b45c4 (svn r19812) -Codechange: give some unnamed enums a name or, in case they consisted of unrelated values use static const (u)int
rubidium <rubidium@openttd.org>
parents: 14618
diff changeset
37 static const int GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET = 4;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
38
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
39 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
40 * Get the station type of this tile
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
41 * @param t the tile to query
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
42 * @pre IsTileType(t, MP_STATION)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
43 * @return the station type
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
44 */
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
45 static inline StationType GetStationType(TileIndex t)
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
46 {
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
47 assert(IsTileType(t, MP_STATION));
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
48 return (StationType)GB(_m[t].m6, 3, 3);
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
49 }
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
50
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
51 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
52 * Get the road stop type of this tile
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
53 * @param t the tile to query
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
54 * @pre GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
55 * @return the road stop type
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
56 */
8785
2a8950a812dc (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents: 8471
diff changeset
57 static inline RoadStopType GetRoadStopType(TileIndex t)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
58 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
59 assert(GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS);
8785
2a8950a812dc (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents: 8471
diff changeset
60 return GetStationType(t) == STATION_TRUCK ? ROADSTOP_TRUCK : ROADSTOP_BUS;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
61 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
62
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
63 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
64 * Get the station graphics of this tile
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
65 * @param t the tile to query
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
66 * @pre IsTileType(t, MP_STATION)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
67 * @return the station graphics
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
68 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
69 static inline StationGfx GetStationGfx(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
70 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
71 assert(IsTileType(t, MP_STATION));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
72 return _m[t].m5;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
73 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
74
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
75 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
76 * Set the station graphics of this tile
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
77 * @param t the tile to update
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
78 * @param gfx the new graphics
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
79 * @pre IsTileType(t, MP_STATION)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
80 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
81 static inline void SetStationGfx(TileIndex t, StationGfx gfx)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
82 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
83 assert(IsTileType(t, MP_STATION));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
84 _m[t].m5 = gfx;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
85 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
86
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
87 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
88 * Is this station tile a rail station?
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
89 * @param t the tile to get the information from
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
90 * @pre IsTileType(t, MP_STATION)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
91 * @return true if and only if the tile is a rail station
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
92 */
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
93 static inline bool IsRailStation(TileIndex t)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
94 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
95 return GetStationType(t) == STATION_RAIL;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
96 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
97
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
98 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
99 * Is this tile a station tile and a rail station?
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
100 * @param t the tile to get the information from
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
101 * @return true if and only if the tile is a rail station
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
102 */
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
103 static inline bool IsRailStationTile(TileIndex t)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
104 {
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
105 return IsTileType(t, MP_STATION) && IsRailStation(t);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
106 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
107
12472
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
108 /**
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
109 * Is this station tile a rail waypoint?
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
110 * @param t the tile to get the information from
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
111 * @pre IsTileType(t, MP_STATION)
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
112 * @return true if and only if the tile is a rail waypoint
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
113 */
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
114 static inline bool IsRailWaypoint(TileIndex t)
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
115 {
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
116 return GetStationType(t) == STATION_WAYPOINT;
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
117 }
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
118
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
119 /**
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
120 * Is this tile a station tile and a rail waypoint?
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
121 * @param t the tile to get the information from
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
122 * @return true if and only if the tile is a rail waypoint
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
123 */
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
124 static inline bool IsRailWaypointTile(TileIndex t)
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
125 {
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
126 return IsTileType(t, MP_STATION) && IsRailWaypoint(t);
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
127 }
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
128
12501
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
129 /**
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
130 * Has this station tile a rail? In other words, is this station
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
131 * tile a rail station or rail waypoint?
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
132 * @param t the tile to check
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
133 * @pre IsTileType(t, MP_STATION)
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
134 * @return true if and only if the tile has rail
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
135 */
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
136 static inline bool HasStationRail(TileIndex t)
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
137 {
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
138 return IsRailStation(t) || IsRailWaypoint(t);
12501
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
139 }
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
140
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
141 /**
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
142 * Has this station tile a rail? In other words, is this station
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
143 * tile a rail station or rail waypoint?
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
144 * @param t the tile to check
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
145 * @return true if and only if the tile is a station tile and has rail
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
146 */
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
147 static inline bool HasStationTileRail(TileIndex t)
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
148 {
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
149 return IsTileType(t, MP_STATION) && HasStationRail(t);
44606771f552 (svn r16938) -Codechange: introduce helper function to tell whether a tile is either a rail station or rail waypoint tile
rubidium <rubidium@openttd.org>
parents: 12472
diff changeset
150 }
12472
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
151
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
152 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
153 * Is this station tile an airport?
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
154 * @param t the tile to get the information from
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
155 * @pre IsTileType(t, MP_STATION)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
156 * @return true if and only if the tile is an airport
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
157 */
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
158 static inline bool IsAirport(TileIndex t)
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
159 {
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
160 return GetStationType(t) == STATION_AIRPORT;
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
161 }
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
162
14305
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
163 /**
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
164 * Is this tile a station tile and an airport tile?
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
165 * @param t the tile to get the information from
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
166 * @return true if and only if the tile is an airport
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
167 */
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
168 static inline bool IsAirportTile(TileIndex t)
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
169 {
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
170 return IsTileType(t, MP_STATION) && IsAirport(t);
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
171 }
d6d98b4d1605 (svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
yexo <yexo@openttd.org>
parents: 14293
diff changeset
172
7320
e69c6734f97c (svn r10681) -Codechange: do not determine whether a tile is a hangar based on the graphics index to be drawn on the given tile, but do it based on the specification of the location of hangars of the airport.
rubidium <rubidium@openttd.org>
parents: 7318
diff changeset
173 bool IsHangar(TileIndex t);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
174
10260
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
175 /**
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
176 * Is the station at \a t a truck stop?
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
177 * @param t Tile to check
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
178 * @pre IsTileType(t, MP_STATION)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
179 * @return \c true if station is a truck stop, \c false otherwise
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
180 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
181 static inline bool IsTruckStop(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
182 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
183 return GetStationType(t) == STATION_TRUCK;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
184 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
185
10260
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
186 /**
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
187 * Is the station at \a t a bus stop?
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
188 * @param t Tile to check
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
189 * @pre IsTileType(t, MP_STATION)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
190 * @return \c true if station is a bus stop, \c false otherwise
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
191 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
192 static inline bool IsBusStop(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
193 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
194 return GetStationType(t) == STATION_BUS;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
195 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
196
10260
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
197 /**
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
198 * Is the station at \a t a road station?
d23fed9a51e2 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium <rubidium@openttd.org>
parents: 10228
diff changeset
199 * @param t Tile to check
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
200 * @pre IsTileType(t, MP_STATION)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
201 * @return \c true if station at the tile is a bus top or a truck stop, \c false otherwise
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
202 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
203 static inline bool IsRoadStop(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
204 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
205 assert(IsTileType(t, MP_STATION));
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
206 return IsTruckStop(t) || IsBusStop(t);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
207 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
208
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
209 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
210 * Is tile \a t a road stop station?
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
211 * @param t Tile to check
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
212 * @return \c true if the tile is a station tile and a road stop
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
213 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
214 static inline bool IsRoadStopTile(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
215 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
216 return IsTileType(t, MP_STATION) && IsRoadStop(t);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
217 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
218
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
219 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
220 * Is tile \a t a standard (non-drive through) road stop station?
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
221 * @param t Tile to check
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
222 * @return \c true if the tile is a station tile and a standard road stop
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
223 */
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
224 static inline bool IsStandardRoadStopTile(TileIndex t)
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
225 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
226 return IsRoadStopTile(t) && GetStationGfx(t) < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
227 }
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
228
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
229 /**
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
230 * Is tile \a t a drive through road stop station?
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
231 * @param t Tile to check
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
232 * @return \c true if the tile is a station tile and a drive through road stop
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
233 */
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
234 static inline bool IsDriveThroughStopTile(TileIndex t)
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
235 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
236 return IsRoadStopTile(t) && GetStationGfx(t) >= GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
237 }
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
238
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
239 /**
14618
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
240 * Get the station graphics of this airport tile
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
241 * @param t the tile to query
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
242 * @pre IsAirport(t)
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
243 * @return the station graphics
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
244 */
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
245 static inline StationGfx GetAirportGfx(TileIndex t)
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
246 {
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
247 assert(IsAirport(t));
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
248 extern StationGfx GetTranslatedAirportTileID(StationGfx gfx);
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
249 return GetTranslatedAirportTileID(GetStationGfx(t));
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
250 }
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
251
9f0fd278ae11 (svn r19195) -Codechange: actually draw newgrf airport tiles
yexo <yexo@openttd.org>
parents: 14365
diff changeset
252 /**
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
253 * Gets the direction the road stop entrance points towards.
12504
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
254 * @param t the tile of the road stop
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
255 * @pre IsRoadStopTile(t)
623b9f1ffe57 (svn r16941) -Document: some map accessors
rubidium <rubidium@openttd.org>
parents: 12502
diff changeset
256 * @return the direction of the entrance
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
257 */
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
258 static inline DiagDirection GetRoadStopDir(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
259 {
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
260 StationGfx gfx = GetStationGfx(t);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
261 assert(IsRoadStopTile(t));
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
262 if (gfx < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET) {
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
263 return (DiagDirection)(gfx);
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
264 } else {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
265 return (DiagDirection)(gfx - GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET);
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5953
diff changeset
266 }
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
267 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
268
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
269 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
270 * Is tile \a t part of an oilrig?
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
271 * @param t Tile to check
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
272 * @pre IsTileType(t, MP_STATION)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
273 * @return \c true if the tile is an oilrig tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
274 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
275 static inline bool IsOilRig(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
276 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
277 return GetStationType(t) == STATION_OILRIG;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
278 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
279
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
280 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
281 * Is tile \a t a dock tile?
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
282 * @param t Tile to check
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
283 * @pre IsTileType(t, MP_STATION)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
284 * @return \c true if the tile is a dock
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
285 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
286 static inline bool IsDock(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
287 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
288 return GetStationType(t) == STATION_DOCK;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
289 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
290
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
291 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
292 * Is tile \a t a dock tile?
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
293 * @param t Tile to check
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
294 * @return \c true if the tile is a dock
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
295 */
10228
b4807e185750 (svn r14456) -Fix: Obiwan in catchment-area and station-spread of docks.
frosch <frosch@openttd.org>
parents: 9784
diff changeset
296 static inline bool IsDockTile(TileIndex t)
b4807e185750 (svn r14456) -Fix: Obiwan in catchment-area and station-spread of docks.
frosch <frosch@openttd.org>
parents: 9784
diff changeset
297 {
b4807e185750 (svn r14456) -Fix: Obiwan in catchment-area and station-spread of docks.
frosch <frosch@openttd.org>
parents: 9784
diff changeset
298 return IsTileType(t, MP_STATION) && GetStationType(t) == STATION_DOCK;
b4807e185750 (svn r14456) -Fix: Obiwan in catchment-area and station-spread of docks.
frosch <frosch@openttd.org>
parents: 9784
diff changeset
299 }
b4807e185750 (svn r14456) -Fix: Obiwan in catchment-area and station-spread of docks.
frosch <frosch@openttd.org>
parents: 9784
diff changeset
300
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
301 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
302 * Is tile \a t a buoy tile?
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
303 * @param t Tile to check
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
304 * @pre IsTileType(t, MP_STATION)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
305 * @return \c true if the tile is a buoy
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
306 */
5905
8deb9c547842 (svn r8528) -Codechange: Rename IsBuoy_() to IsBuoy() now that the naming conflict no longer exists.
celestar <celestar@openttd.org>
parents: 5836
diff changeset
307 static inline bool IsBuoy(TileIndex t)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
308 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
309 return GetStationType(t) == STATION_BUOY;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
310 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
311
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
312 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
313 * Is tile \a t a buoy tile?
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
314 * @param t Tile to check
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
315 * @return \c true if the tile is a buoy
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
316 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
317 static inline bool IsBuoyTile(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
318 {
5905
8deb9c547842 (svn r8528) -Codechange: Rename IsBuoy_() to IsBuoy() now that the naming conflict no longer exists.
celestar <celestar@openttd.org>
parents: 5836
diff changeset
319 return IsTileType(t, MP_STATION) && IsBuoy(t);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
320 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
321
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
322 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
323 * Is tile \a t an hangar tile?
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
324 * @param t Tile to check
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
325 * @return \c true if the tile is an hangar
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
326 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
327 static inline bool IsHangarTile(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
328 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
329 return IsTileType(t, MP_STATION) && IsHangar(t);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
330 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
331
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
332 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
333 * Get the rail direction of a rail station.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
334 * @param t Tile to query
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
335 * @pre HasStationRail(t)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
336 * @return The direction of the rails on tile \a t.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
337 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
338 static inline Axis GetRailStationAxis(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
339 {
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
340 assert(HasStationRail(t));
7928
4e8dfd103163 (svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13 <skidd13@openttd.org>
parents: 7739
diff changeset
341 return HasBit(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
342 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
343
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
344 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
345 * Get the rail track of a rail station tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
346 * @param t Tile to query
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
347 * @pre HasStationRail(t)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
348 * @return The rail track of the rails on tile \a t.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
349 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
350 static inline Track GetRailStationTrack(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
351 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
352 return AxisToTrack(GetRailStationAxis(t));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
353 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
354
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
355 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
356 * Get the trackbits of a rail station tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
357 * @param t Tile to query
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
358 * @pre HasStationRail(t)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
359 * @return The trackbits of the rails on tile \a t.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
360 */
12033
3a06a1a551f5 (svn r16440) -Fix [NoAI]: AIRail::GetRailStationDirection returned incorrect information
yexo <yexo@openttd.org>
parents: 11922
diff changeset
361 static inline TrackBits GetRailStationTrackBits(TileIndex t)
3a06a1a551f5 (svn r16440) -Fix [NoAI]: AIRail::GetRailStationDirection returned incorrect information
yexo <yexo@openttd.org>
parents: 11922
diff changeset
362 {
3a06a1a551f5 (svn r16440) -Fix [NoAI]: AIRail::GetRailStationDirection returned incorrect information
yexo <yexo@openttd.org>
parents: 11922
diff changeset
363 return AxisToTrackBits(GetRailStationAxis(t));
3a06a1a551f5 (svn r16440) -Fix [NoAI]: AIRail::GetRailStationDirection returned incorrect information
yexo <yexo@openttd.org>
parents: 11922
diff changeset
364 }
3a06a1a551f5 (svn r16440) -Fix [NoAI]: AIRail::GetRailStationDirection returned incorrect information
yexo <yexo@openttd.org>
parents: 11922
diff changeset
365
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
366 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
367 * Check if tile is compatible with a railstation tile. The two tiles
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
368 * are compatible if all of the following are true:
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
369 * \li both tiles are rail station tiles
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
370 * \li the railtype of \a t1 is compatible with the railtype of \a t2
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
371 * \li the tracks on \a t1 and \a t2 are in the same direction
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
372 * \li both tiles belong to the same station
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
373 * \li \a t1 is not blocked (@see IsStationTileBlocked)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
374 * @param t1 First tile to compare
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
375 * @param t2 Second tile to compare
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
376 * @pre IsRailStationTile(t2)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
377 * @return true if the two tiles are compatible
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
378 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
379 static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
380 {
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
381 assert(IsRailStationTile(t2));
16547
a11cd939c335 (svn r21273) -Codechange: Return values should start at the same line.
alberth <alberth@openttd.org>
parents: 16024
diff changeset
382 return IsRailStationTile(t1) && IsCompatibleRail(GetRailType(t1), GetRailType(t2)) &&
a11cd939c335 (svn r21273) -Codechange: Return values should start at the same line.
alberth <alberth@openttd.org>
parents: 16024
diff changeset
383 GetRailStationAxis(t1) == GetRailStationAxis(t2) &&
a11cd939c335 (svn r21273) -Codechange: Return values should start at the same line.
alberth <alberth@openttd.org>
parents: 16024
diff changeset
384 GetStationIndex(t1) == GetStationIndex(t2) &&
a11cd939c335 (svn r21273) -Codechange: Return values should start at the same line.
alberth <alberth@openttd.org>
parents: 16024
diff changeset
385 !IsStationTileBlocked(t1);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
386 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
387
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
388 /**
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
389 * Get the reservation state of the rail station
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
390 * @pre HasStationRail(t)
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
391 * @param t the station tile
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
392 * @return reservation state
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
393 */
12470
299da608443d (svn r16907) -Codechange: make a more clear distinction between reservation functions that return a bool and that return TrackBits; GetRailStationReservation vs GetRailwayStationReservation, which one returns the bool and which one the TrackBits?
rubidium <rubidium@openttd.org>
parents: 12228
diff changeset
394 static inline bool HasStationReservation(TileIndex t)
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
395 {
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
396 assert(HasStationRail(t));
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
397 return HasBit(_m[t].m6, 2);
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
398 }
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
399
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
400 /**
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
401 * Set the reservation state of the rail station
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
402 * @pre HasStationRail(t)
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
403 * @param t the station tile
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
404 * @param b the reservation state
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
405 */
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
406 static inline void SetRailStationReservation(TileIndex t, bool b)
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
407 {
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
408 assert(HasStationRail(t));
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
409 SB(_m[t].m6, 2, 1, b ? 1 : 0);
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
410 }
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
411
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
412 /**
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
413 * Get the reserved track bits for a waypoint
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
414 * @pre HasStationRail(t)
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
415 * @param t the tile
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
416 * @return reserved track bits
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
417 */
12470
299da608443d (svn r16907) -Codechange: make a more clear distinction between reservation functions that return a bool and that return TrackBits; GetRailStationReservation vs GetRailwayStationReservation, which one returns the bool and which one the TrackBits?
rubidium <rubidium@openttd.org>
parents: 12228
diff changeset
418 static inline TrackBits GetStationReservationTrackBits(TileIndex t)
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
419 {
12470
299da608443d (svn r16907) -Codechange: make a more clear distinction between reservation functions that return a bool and that return TrackBits; GetRailStationReservation vs GetRailwayStationReservation, which one returns the bool and which one the TrackBits?
rubidium <rubidium@openttd.org>
parents: 12228
diff changeset
420 return HasStationReservation(t) ? GetRailStationTrackBits(t) : TRACK_BIT_NONE;
9784
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
421 }
a2ae4bee49e1 (svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium <rubidium@openttd.org>
parents: 9718
diff changeset
422
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
423 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
424 * Get the direction of a dock.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
425 * @param t Tile to query
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
426 * @pre IsDock(t)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
427 * @pre \a t is the land part of the dock
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
428 * @return The direction of the dock on tile \a t.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
429 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
430 static inline DiagDirection GetDockDirection(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
431 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
432 StationGfx gfx = GetStationGfx(t);
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
433 assert(IsDock(t) && gfx < GFX_DOCK_BASE_WATER_PART);
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
434 return (DiagDirection)(gfx);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
435 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
436
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
437 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
438 * Get the tileoffset from this tile a ship should target to get to this dock.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
439 * @param t Tile to query
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
440 * @pre IsTileType(t, MP_STATION)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
441 * @pre IsBuoy(t) || IsOilRig(t) || IsDock(t)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
442 * @return The offset from this tile that should be used as destination for ships.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
443 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
444 static inline TileIndexDiffC GetDockOffset(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
445 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
446 static const TileIndexDiffC buoy_offset = {0, 0};
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
447 static const TileIndexDiffC oilrig_offset = {2, 0};
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
448 static const TileIndexDiffC dock_offset[DIAGDIR_END] = {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
449 {-2, 0},
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
450 { 0, 2},
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
451 { 2, 0},
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
452 { 0, -2},
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
453 };
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
454 assert(IsTileType(t, MP_STATION));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
455
5905
8deb9c547842 (svn r8528) -Codechange: Rename IsBuoy_() to IsBuoy() now that the naming conflict no longer exists.
celestar <celestar@openttd.org>
parents: 5836
diff changeset
456 if (IsBuoy(t)) return buoy_offset;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
457 if (IsOilRig(t)) return oilrig_offset;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
458
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
459 assert(IsDock(t));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
460
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
461 return dock_offset[GetDockDirection(t)];
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
462 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
463
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
464 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
465 * Is there a custom rail station spec on this tile?
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
466 * @param t Tile to query
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
467 * @pre HasStationTileRail(t)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
468 * @return True if this station is part of a newgrf station.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
469 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
470 static inline bool IsCustomStationSpecIndex(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
471 {
14323
36c4f2858590 (svn r18876) -Codechange: make sure m4 is always 0 for non-railroad station tiles
yexo <yexo@openttd.org>
parents: 14305
diff changeset
472 assert(HasStationTileRail(t));
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
473 return _m[t].m4 != 0;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
474 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
475
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
476 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
477 * Set the custom station spec for this tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
478 * @param t Tile to set the stationspec of.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
479 * @pre HasStationTileRail(t)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
480 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
481 static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
482 {
14364
78ca677b7820 (svn r18921) -Codechange: make the preconditions for Get/Set CustomStationSpecIndex a bit more strict
yexo <yexo@openttd.org>
parents: 14323
diff changeset
483 assert(HasStationTileRail(t));
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
484 _m[t].m4 = specindex;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
485 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
486
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
487 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
488 * Get the custom station spec for this tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
489 * @param t Tile to query
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
490 * @pre HasStationTileRail(t)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
491 * @return The custom station spec of this tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
492 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
493 static inline uint GetCustomStationSpecIndex(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
494 {
14364
78ca677b7820 (svn r18921) -Codechange: make the preconditions for Get/Set CustomStationSpecIndex a bit more strict
yexo <yexo@openttd.org>
parents: 14323
diff changeset
495 assert(HasStationTileRail(t));
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
496 return _m[t].m4;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
497 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
498
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
499 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
500 * Set the random bits for a station tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
501 * @param t Tile to set random bits for
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
502 * @pre IsTileType(t, MP_STATION)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
503 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
504 static inline void SetStationTileRandomBits(TileIndex t, byte random_bits)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
505 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
506 assert(IsTileType(t, MP_STATION));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
507 SB(_m[t].m3, 4, 4, random_bits);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
508 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
509
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
510 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
511 * Get the random bits of a station tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
512 * @param t Tile to query
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
513 * @pre IsTileType(t, MP_STATION)
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
514 * @return The random bits for this station tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
515 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
516 static inline byte GetStationTileRandomBits(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
517 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
518 assert(IsTileType(t, MP_STATION));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
519 return GB(_m[t].m3, 4, 4);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
520 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
521
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
522 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
523 * Make the given tile a station tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
524 * @param t the tile to make a station tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
525 * @param o the owner of the station
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
526 * @param sid the station to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
527 * @param st the type this station tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
528 * @param section the StationGfx to be used for this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
529 */
15772
1a21d8e5c3fa (svn r20446) -Codechange: unify the location of the water class
rubidium <rubidium@openttd.org>
parents: 15709
diff changeset
530 static inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType st, byte section, WaterClass wc = WATER_CLASS_INVALID)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
531 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
532 SetTileType(t, MP_STATION);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
533 SetTileOwner(t, o);
16024
6b3718ff071d (svn r20717) -Fix [FS#4103]: water class was not set for stations
yexo <yexo@openttd.org>
parents: 15934
diff changeset
534 SetWaterClass(t, wc);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
535 _m[t].m2 = sid;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
536 _m[t].m3 = 0;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
537 _m[t].m4 = 0;
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
538 _m[t].m5 = section;
11294
63f980601558 (svn r15643) -Fix [FS#2711]: be more strict with zeroing unused map array bits
smatz <smatz@openttd.org>
parents: 11252
diff changeset
539 SB(_m[t].m6, 2, 1, 0);
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
540 SB(_m[t].m6, 3, 3, st);
11294
63f980601558 (svn r15643) -Fix [FS#2711]: be more strict with zeroing unused map array bits
smatz <smatz@openttd.org>
parents: 11252
diff changeset
541 _me[t].m7 = 0;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
542 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
543
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
544 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
545 * Make the given tile a rail station tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
546 * @param t the tile to make a rail station tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
547 * @param o the owner of the station
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
548 * @param sid the station to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
549 * @param a the axis of this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
550 * @param section the StationGfx to be used for this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
551 * @param rt the railtype of this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
552 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
553 static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
554 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
555 MakeStation(t, o, sid, STATION_RAIL, section + a);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
556 SetRailType(t, rt);
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
557 SetRailStationReservation(t, false);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
558 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
559
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
560 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
561 * Make the given tile a rail waypoint tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
562 * @param t the tile to make a rail waypoint
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
563 * @param o the owner of the waypoint
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
564 * @param sid the waypoint to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
565 * @param a the axis of this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
566 * @param section the StationGfx to be used for this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
567 * @param rt the railtype of this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
568 */
12472
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
569 static inline void MakeRailWaypoint(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
570 {
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
571 MakeStation(t, o, sid, STATION_WAYPOINT, section + a);
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
572 SetRailType(t, rt);
12502
9472b49c61a1 (svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
rubidium <rubidium@openttd.org>
parents: 12501
diff changeset
573 SetRailStationReservation(t, false);
12472
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
574 }
604a2cfc77ab (svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents: 12470
diff changeset
575
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
576 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
577 * Make the given tile a roadstop tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
578 * @param t the tile to make a roadstop
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
579 * @param o the owner of the roadstop
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
580 * @param sid the station to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
581 * @param rst the type of roadstop to make this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
582 * @param rt the roadtypes on this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
583 * @param d the direction of the roadstop
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
584 */
8785
2a8950a812dc (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents: 8471
diff changeset
585 static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, DiagDirection d)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
586 {
8785
2a8950a812dc (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents: 8471
diff changeset
587 MakeStation(t, o, sid, (rst == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), d);
6661
5850ac8865e8 (svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium <rubidium@openttd.org>
parents: 6420
diff changeset
588 SetRoadTypes(t, rt);
11252
f7b6f8f03e5e (svn r15601) -Fix [FS#2615]: bridges/tunnels don't store tram owner making it possible to remove someone's tram tracks.
rubidium <rubidium@openttd.org>
parents: 10260
diff changeset
589 SetRoadOwner(t, ROADTYPE_ROAD, o);
f7b6f8f03e5e (svn r15601) -Fix [FS#2615]: bridges/tunnels don't store tram owner making it possible to remove someone's tram tracks.
rubidium <rubidium@openttd.org>
parents: 10260
diff changeset
590 SetRoadOwner(t, ROADTYPE_TRAM, o);
6098
bad21330ae92 (svn r8833) -Fix
tron <tron@openttd.org>
parents: 6012
diff changeset
591 }
bad21330ae92 (svn r8833) -Fix
tron <tron@openttd.org>
parents: 6012
diff changeset
592
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
593 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
594 * Make the given tile a drivethrough roadstop tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
595 * @param t the tile to make a roadstop
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
596 * @param station the owner of the roadstop
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
597 * @param road the owner of the road
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
598 * @param tram the owner of the tram
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
599 * @param sid the station to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
600 * @param rst the type of roadstop to make this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
601 * @param rt the roadtypes on this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
602 * @param d the direction of the roadstop
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
603 */
11252
f7b6f8f03e5e (svn r15601) -Fix [FS#2615]: bridges/tunnels don't store tram owner making it possible to remove someone's tram tracks.
rubidium <rubidium@openttd.org>
parents: 10260
diff changeset
604 static inline void MakeDriveThroughRoadStop(TileIndex t, Owner station, Owner road, Owner tram, StationID sid, RoadStopType rst, RoadTypes rt, Axis a)
6098
bad21330ae92 (svn r8833) -Fix
tron <tron@openttd.org>
parents: 6012
diff changeset
605 {
11252
f7b6f8f03e5e (svn r15601) -Fix [FS#2615]: bridges/tunnels don't store tram owner making it possible to remove someone's tram tracks.
rubidium <rubidium@openttd.org>
parents: 10260
diff changeset
606 MakeStation(t, station, sid, (rst == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET + a);
6661
5850ac8865e8 (svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium <rubidium@openttd.org>
parents: 6420
diff changeset
607 SetRoadTypes(t, rt);
11252
f7b6f8f03e5e (svn r15601) -Fix [FS#2615]: bridges/tunnels don't store tram owner making it possible to remove someone's tram tracks.
rubidium <rubidium@openttd.org>
parents: 10260
diff changeset
608 SetRoadOwner(t, ROADTYPE_ROAD, road);
f7b6f8f03e5e (svn r15601) -Fix [FS#2615]: bridges/tunnels don't store tram owner making it possible to remove someone's tram tracks.
rubidium <rubidium@openttd.org>
parents: 10260
diff changeset
609 SetRoadOwner(t, ROADTYPE_TRAM, tram);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
610 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
611
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
612 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
613 * Make the given tile an airport tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
614 * @param t the tile to make a airport
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
615 * @param o the owner of the airport
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
616 * @param sid the station to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
617 * @param section the StationGfx to be used for this tile
15709
db841e8e324a (svn r20375) -Codechange: make sure the watertype for existing airport tiles is set to invalid
yexo <yexo@openttd.org>
parents: 15183
diff changeset
618 * @param wc the type of water on this tile
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
619 */
15709
db841e8e324a (svn r20375) -Codechange: make sure the watertype for existing airport tiles is set to invalid
yexo <yexo@openttd.org>
parents: 15183
diff changeset
620 static inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section, WaterClass wc)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
621 {
15772
1a21d8e5c3fa (svn r20446) -Codechange: unify the location of the water class
rubidium <rubidium@openttd.org>
parents: 15709
diff changeset
622 MakeStation(t, o, sid, STATION_AIRPORT, section, wc);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
623 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
624
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
625 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
626 * Make the given tile a buoy tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
627 * @param t the tile to make a buoy
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
628 * @param sid the station to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
629 * @param wc the type of water on this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
630 */
8471
1e4ea519bfaf (svn r12042) -Fix [FS#1676]: Reimplement how rivers and canals are stored in the map, allowing the sea/river/canal status to also be
peter1138 <peter1138@openttd.org>
parents: 8422
diff changeset
631 static inline void MakeBuoy(TileIndex t, StationID sid, WaterClass wc)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
632 {
5953
81aac4ab6860 (svn r8619) -Fix: store the ownership of a water tile in the buoy tile and set the ownership of the water tile when the buoy is removed. This solves the issue of removing ownership from canal tiles thus making is possible for other players to remove the canal tile.
rubidium <rubidium@openttd.org>
parents: 5905
diff changeset
633 /* Make the owner of the buoy tile the same as the current owner of the
81aac4ab6860 (svn r8619) -Fix: store the ownership of a water tile in the buoy tile and set the ownership of the water tile when the buoy is removed. This solves the issue of removing ownership from canal tiles thus making is possible for other players to remove the canal tile.
rubidium <rubidium@openttd.org>
parents: 5905
diff changeset
634 * water tile. In this way, we can reset the owner of the water to its
81aac4ab6860 (svn r8619) -Fix: store the ownership of a water tile in the buoy tile and set the ownership of the water tile when the buoy is removed. This solves the issue of removing ownership from canal tiles thus making is possible for other players to remove the canal tile.
rubidium <rubidium@openttd.org>
parents: 5905
diff changeset
635 * original state when the buoy gets removed. */
15772
1a21d8e5c3fa (svn r20446) -Codechange: unify the location of the water class
rubidium <rubidium@openttd.org>
parents: 15709
diff changeset
636 MakeStation(t, GetTileOwner(t), sid, STATION_BUOY, 0, wc);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
637 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
638
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
639 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
640 * Make the given tile a dock tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
641 * @param t the tile to make a dock
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
642 * @param o the owner of the dock
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
643 * @param sid the station to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
644 * @param d the direction of the dock
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
645 * @param wc the type of water on this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
646 */
8471
1e4ea519bfaf (svn r12042) -Fix [FS#1676]: Reimplement how rivers and canals are stored in the map, allowing the sea/river/canal status to also be
peter1138 <peter1138@openttd.org>
parents: 8422
diff changeset
647 static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
648 {
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
649 MakeStation(t, o, sid, STATION_DOCK, d);
15772
1a21d8e5c3fa (svn r20446) -Codechange: unify the location of the water class
rubidium <rubidium@openttd.org>
parents: 15709
diff changeset
650 MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
651 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
652
14365
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
653 /**
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
654 * Make the given tile an oilrig tile.
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
655 * @param t the tile to make an oilrig
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
656 * @param sid the station to which this tile belongs
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
657 * @param wc the type of water on this tile
476512b9eefc (svn r18922) -Doc: add doxygen documentation to all functions in station_map.h
yexo <yexo@openttd.org>
parents: 14364
diff changeset
658 */
9718
3c66bb36c785 (svn r13838) -Codechange: Make industry tiles aware of WaterClasses.
frosch <frosch@openttd.org>
parents: 9342
diff changeset
659 static inline void MakeOilrig(TileIndex t, StationID sid, WaterClass wc)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
660 {
15772
1a21d8e5c3fa (svn r20446) -Codechange: unify the location of the water class
rubidium <rubidium@openttd.org>
parents: 15709
diff changeset
661 MakeStation(t, OWNER_NONE, sid, STATION_OILRIG, 0, wc);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
662 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
663
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
664 #endif /* STATION_MAP_H */