summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-24 17:39:54 +0000
committersmatz <smatz@openttd.org>2009-06-24 17:39:54 +0000
commit8343340acb5bdb40555e04f40aac567d6e583bb8 (patch)
tree29b17ad863977abd3d3417dd8bbf84e01cfc261d /src
parentb18bf87c9081c3d202897e9c3ed282729db415a4 (diff)
downloadopenttd-8343340acb5bdb40555e04f40aac567d6e583bb8.tar.xz
(svn r16643) -Codechange: replace GetStationByTile() by Station::GetByTile()
Diffstat (limited to 'src')
-rw-r--r--src/ai/api/ai_airport.cpp6
-rw-r--r--src/ai/api/ai_industry.cpp2
-rw-r--r--src/ai/api/ai_marine.cpp2
-rw-r--r--src/ai/api/ai_order.cpp2
-rw-r--r--src/ai/api/ai_rail.cpp2
-rw-r--r--src/ai/api/ai_road.cpp2
-rw-r--r--src/ai/api/ai_station.cpp2
-rw-r--r--src/ai/api/ai_tilelist.cpp2
-rw-r--r--src/aircraft.h1
-rw-r--r--src/aircraft_cmd.cpp5
-rw-r--r--src/build_vehicle_gui.cpp5
-rw-r--r--src/disaster_cmd.cpp6
-rw-r--r--src/economy.cpp1
-rw-r--r--src/industry_cmd.cpp2
-rw-r--r--src/newgrf_engine.cpp1
-rw-r--r--src/newgrf_station.cpp10
-rw-r--r--src/npf.cpp3
-rw-r--r--src/openttd.cpp1
-rw-r--r--src/order_cmd.cpp1
-rw-r--r--src/order_gui.cpp1
-rw-r--r--src/pathfind.cpp2
-rw-r--r--src/rail.h1
-rw-r--r--src/roadveh_cmd.cpp4
-rw-r--r--src/saveload/afterload.cpp6
-rw-r--r--src/saveload/oldloader_sl.cpp1
-rw-r--r--src/saveload/vehicle_sl.cpp1
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/station.cpp1
-rw-r--r--src/station_base.h6
-rw-r--r--src/station_cmd.cpp19
-rw-r--r--src/station_gui.cpp4
-rw-r--r--src/station_map.h6
-rw-r--r--src/vehicle.cpp1
-rw-r--r--src/vehicle_cmd.cpp1
-rw-r--r--src/vehicle_gui.cpp2
-rw-r--r--src/water_cmd.cpp7
-rw-r--r--src/yapf/follow_track.hpp2
-rw-r--r--src/yapf/yapf_costrail.hpp2
38 files changed, 70 insertions, 55 deletions
diff --git a/src/ai/api/ai_airport.cpp b/src/ai/api/ai_airport.cpp
index 137de54c7..fa7c4e18b 100644
--- a/src/ai/api/ai_airport.cpp
+++ b/src/ai/api/ai_airport.cpp
@@ -4,7 +4,7 @@
#include "ai_airport.hpp"
#include "ai_station.hpp"
-#include "../../station_map.h"
+#include "../../station_base.h"
#include "../../company_func.h"
#include "../../command_type.h"
#include "../../town.h"
@@ -82,7 +82,7 @@
if (!::IsValidTile(tile)) return -1;
if (!::IsTileType(tile, MP_STATION)) return -1;
- const Station *st = ::GetStationByTile(tile);
+ const Station *st = ::Station::GetByTile(tile);
if (st->owner != _current_company) return -1;
if ((st->facilities & FACIL_AIRPORT) == 0) return -1;
@@ -95,7 +95,7 @@
if (!::IsTileType(tile, MP_STATION)) return INVALID_TILE;
if (GetNumHangars(tile) < 1) return INVALID_TILE;
- const Station *st = ::GetStationByTile(tile);
+ const Station *st = ::Station::GetByTile(tile);
if (st->owner != _current_company) return INVALID_TILE;
if ((st->facilities & FACIL_AIRPORT) == 0) return INVALID_TILE;
diff --git a/src/ai/api/ai_industry.cpp b/src/ai/api/ai_industry.cpp
index 005311e19..3d7836cc2 100644
--- a/src/ai/api/ai_industry.cpp
+++ b/src/ai/api/ai_industry.cpp
@@ -8,7 +8,7 @@
#include "../../tile_type.h"
#include "../../industry.h"
#include "../../strings_func.h"
-#include "../../station_map.h"
+#include "../../station_base.h"
#include "table/strings.h"
/* static */ int32 AIIndustry::GetIndustryCount()
diff --git a/src/ai/api/ai_marine.cpp b/src/ai/api/ai_marine.cpp
index b59307671..54f4e1cdf 100644
--- a/src/ai/api/ai_marine.cpp
+++ b/src/ai/api/ai_marine.cpp
@@ -4,7 +4,7 @@
#include "ai_marine.hpp"
#include "ai_station.hpp"
-#include "../../station_map.h"
+#include "../../station_base.h"
#include "../../tile_cmd.h"
diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp
index 56c0a78b7..545d336e3 100644
--- a/src/ai/api/ai_order.cpp
+++ b/src/ai/api/ai_order.cpp
@@ -10,7 +10,7 @@
#include "../../vehicle_base.h"
#include "../../roadstop_base.h"
#include "../../depot_base.h"
-#include "../../station_map.h"
+#include "../../station_base.h"
#include "../../waypoint.h"
/**
diff --git a/src/ai/api/ai_rail.cpp b/src/ai/api/ai_rail.cpp
index 72905ff5b..5986ad82b 100644
--- a/src/ai/api/ai_rail.cpp
+++ b/src/ai/api/ai_rail.cpp
@@ -6,7 +6,7 @@
#include "ai_map.hpp"
#include "ai_station.hpp"
#include "../../debug.h"
-#include "../../station_map.h"
+#include "../../station_base.h"
#include "../../company_func.h"
#include "../../waypoint.h"
#include "../../newgrf_generic.h"
diff --git a/src/ai/api/ai_road.cpp b/src/ai/api/ai_road.cpp
index 4cbce4a68..fd3ec11d9 100644
--- a/src/ai/api/ai_road.cpp
+++ b/src/ai/api/ai_road.cpp
@@ -6,7 +6,7 @@
#include "ai_map.hpp"
#include "ai_station.hpp"
#include "ai_cargo.hpp"
-#include "../../station_map.h"
+#include "../../station_base.h"
#include "../../command_type.h"
#include "../../settings_type.h"
#include "../../company_func.h"
diff --git a/src/ai/api/ai_station.cpp b/src/ai/api/ai_station.cpp
index 5628ab547..519c1076f 100644
--- a/src/ai/api/ai_station.cpp
+++ b/src/ai/api/ai_station.cpp
@@ -8,7 +8,7 @@
#include "ai_town.hpp"
#include "../../command_func.h"
#include "../../debug.h"
-#include "../../station_map.h"
+#include "../../station_base.h"
#include "../../roadstop_base.h"
#include "../../string_func.h"
#include "../../strings_func.h"
diff --git a/src/ai/api/ai_tilelist.cpp b/src/ai/api/ai_tilelist.cpp
index 5d3039156..8015b96f8 100644
--- a/src/ai/api/ai_tilelist.cpp
+++ b/src/ai/api/ai_tilelist.cpp
@@ -6,7 +6,7 @@
#include "ai_industry.hpp"
#include "../../tile_map.h"
#include "../../industry_map.h"
-#include "../../station_map.h"
+#include "../../station_base.h"
#include "../../settings_type.h"
void AITileList::FixRectangleSpan(TileIndex &t1, TileIndex &t2)
diff --git a/src/aircraft.h b/src/aircraft.h
index b782aae50..278b42a43 100644
--- a/src/aircraft.h
+++ b/src/aircraft.h
@@ -6,7 +6,6 @@
#define AIRCRAFT_H
#include "station_map.h"
-#include "station_base.h"
#include "vehicle_base.h"
#include "engine_func.h"
#include "engine_base.h"
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index c9264d165..e11bdd753 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -28,6 +28,7 @@
#include "company_func.h"
#include "effectvehicle_func.h"
#include "settings_type.h"
+#include "station_base.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -262,7 +263,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (!IsHangarTile(tile) || !IsTileOwner(tile, _current_company)) return CMD_ERROR;
/* Prevent building aircraft types at places which can't handle them */
- if (!CanVehicleUseStation(p1, GetStationByTile(tile))) return CMD_ERROR;
+ if (!CanVehicleUseStation(p1, Station::GetByTile(tile))) return CMD_ERROR;
/* We will need to allocate 2 or 3 vehicle structs, depending on type */
if (!Vehicle::CanAllocateItem(avi->subtype & AIR_CTOL ? 2 : 3)) {
@@ -343,7 +344,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
* layout for #th position of depot. Since layout must start with a listing
* of all depots, it is simple */
for (uint i = 0;; i++) {
- const Station *st = GetStationByTile(tile);
+ const Station *st = Station::GetByTile(tile);
const AirportFTAClass *apc = st->Airport();
assert(i != apc->nof_depots);
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index eea5d5585..763f2022f 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -6,6 +6,7 @@
#include "roadveh.h"
#include "ship.h"
#include "aircraft.h"
+#include "station_base.h"
#include "articulated_vehicles.h"
#include "textbuf_gui.h"
#include "command_func.h"
@@ -843,7 +844,7 @@ struct BuildVehicleWindow : Window {
break;
case VEH_AIRCRAFT:
this->filter.flags =
- tile == INVALID_TILE ? AirportFTAClass::ALL : GetStationByTile(tile)->Airport()->flags;
+ tile == INVALID_TILE ? AirportFTAClass::ALL : Station::GetByTile(tile)->Airport()->flags;
break;
}
this->SetupWindowStrings(type);
@@ -1023,7 +1024,7 @@ struct BuildVehicleWindow : Window {
this->eng_list.Clear();
- const Station *st = this->listview_mode ? NULL : GetStationByTile(this->window_number);
+ const Station *st = this->listview_mode ? NULL : Station::GetByTile(this->window_number);
/* Make list of all available planes.
* Also check to see if the previously selected plane is still available,
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index f23cfe26f..318b478cb 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -20,7 +20,7 @@
#include "landscape.h"
#include "industry_map.h"
-#include "station_map.h"
+#include "station_base.h"
#include "command_func.h"
#include "news_func.h"
#include "town.h"
@@ -228,7 +228,7 @@ static bool DisasterTick_Zeppeliner(DisasterVehicle *v)
if (IsValidTile(v->tile) &&
IsTileType(v->tile, MP_STATION) &&
IsAirport(v->tile)) {
- Station *st = GetStationByTile(v->tile);
+ Station *st = Station::GetByTile(v->tile);
CLRBITS(st->airport_flags, RUNWAY_IN_block);
AI::NewEvent(GetTileOwner(v->tile), new AIEventDisasterZeppelinerCleared(st->index));
}
@@ -268,7 +268,7 @@ static bool DisasterTick_Zeppeliner(DisasterVehicle *v)
if (IsValidTile(v->tile) &&
IsTileType(v->tile, MP_STATION) &&
IsAirport(v->tile)) {
- SETBITS(GetStationByTile(v->tile)->airport_flags, RUNWAY_IN_block);
+ SETBITS(Station::GetByTile(v->tile)->airport_flags, RUNWAY_IN_block);
}
return true;
diff --git a/src/economy.cpp b/src/economy.cpp
index 194cc97d8..887c6254c 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -34,6 +34,7 @@
#include "company_gui.h"
#include "signs_base.h"
#include "subsidy_func.h"
+#include "station_base.h"
#include "table/strings.h"
#include "table/sprites.h"
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index e65b13635..9f404d984 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -6,7 +6,7 @@
#include "openttd.h"
#include "clear_map.h"
#include "industry_map.h"
-#include "station_map.h"
+#include "station_base.h"
#include "train.h"
#include "landscape.h"
#include "viewport_func.h"
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 7805967ed..e99b04d76 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -15,6 +15,7 @@
#include "aircraft.h"
#include "core/smallmap_type.hpp"
#include "settings_type.h"
+#include "station_base.h"
int _traininfo_vehicle_pitch = 0;
int _traininfo_vehicle_width = 29;
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 38f4c88c0..7bb69341e 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -6,7 +6,7 @@
#include "variables.h"
#include "landscape.h"
#include "debug.h"
-#include "station_map.h"
+#include "station_base.h"
#include "roadstop_base.h"
#include "newgrf_commons.h"
#include "newgrf_station.h"
@@ -469,7 +469,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
uint32 res = GB(GetStationGfx(nearby_tile), 1, 2) << 12 | !!perpendicular << 11 | !!same_station << 10;
if (IsCustomStationSpecIndex(nearby_tile)) {
- const StationSpecList ssl = GetStationByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)];
+ const StationSpecList ssl = Station::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)];
res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ssl.localidx;
}
return res;
@@ -858,7 +858,7 @@ const StationSpec *GetStationSpec(TileIndex t)
if (!IsCustomStationSpecIndex(t)) return NULL;
- st = GetStationByTile(t);
+ st = Station::GetByTile(t);
specindex = GetCustomStationSpecIndex(t);
return specindex < st->num_specs ? st->speclist[specindex].spec : NULL;
}
@@ -890,7 +890,7 @@ void AnimateStationTile(TileIndex tile)
const StationSpec *ss = GetStationSpec(tile);
if (ss == NULL) return;
- const Station *st = GetStationByTile(tile);
+ const Station *st = Station::GetByTile(tile);
uint8 animation_speed = ss->anim_speed;
@@ -1023,7 +1023,7 @@ void StationAnimationTrigger(const Station *st, TileIndex tile, StatAnimTrigger
};
/* Get Station if it wasn't supplied */
- if (st == NULL) st = GetStationByTile(tile);
+ if (st == NULL) st = Station::GetByTile(tile);
/* Check the cached animation trigger bitmask to see if we need
* to bother with any further processing. */
diff --git a/src/npf.cpp b/src/npf.cpp
index e4a9473cf..cc7b4f6a2 100644
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -12,6 +12,7 @@
#include "tunnelbridge_map.h"
#include "functions.h"
#include "vehicle_base.h"
+#include "station_base.h"
#include "tunnelbridge.h"
#include "pbs.h"
#include "settings_type.h"
@@ -514,7 +515,7 @@ static void NPFSaveTargetData(AyStar *as, OpenListNode *current)
/* If the target is a station skip to platform end. */
if (IsRailwayStationTile(target->node.tile)) {
DiagDirection dir = TrackdirToExitdir(target->node.direction);
- uint len = GetStationByTile(target->node.tile)->GetPlatformLength(target->node.tile, dir);
+ uint len = Station::GetByTile(target->node.tile)->GetPlatformLength(target->node.tile, dir);
TileIndex end_tile = TILE_ADD(target->node.tile, (len - 1) * TileOffsByDiagDir(dir));
/* Update only end tile, trackdir of a station stays the same. */
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 667316b28..1dc8eb73c 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -54,6 +54,7 @@
#include "rev.h"
#include "highscore.h"
#include "thread.h"
+#include "station_base.h"
#include "newgrf_commons.h"
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 8c63e19f6..120846922 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -23,6 +23,7 @@
#include "core/pool_func.hpp"
#include "aircraft.h"
#include "roadveh.h"
+#include "station_base.h"
#include "table/strings.h"
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 93693db9d..1cff2d20e 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -24,6 +24,7 @@
#include "tilehighlight_func.h"
#include "network/network.h"
#include "settings_type.h"
+#include "station_base.h"
#include "table/sprites.h"
#include "table/strings.h"
diff --git a/src/pathfind.cpp b/src/pathfind.cpp
index 921c9c684..e68141a0d 100644
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -3,7 +3,7 @@
/** @file pathfind.cpp Implementation of the oldest supported pathfinder. */
#include "stdafx.h"
-#include "station_map.h"
+#include "station_base.h"
#include "settings_type.h"
#include "pathfind.h"
#include "debug.h"
diff --git a/src/rail.h b/src/rail.h
index 3518037bc..02a17a622 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -12,6 +12,7 @@
#include "core/bitmath_func.hpp"
#include "economy_func.h"
#include "slope_type.h"
+#include "strings_type.h"
enum RailTypeFlag {
RTF_CATENARY = 0, ///< Set if the rail type should have catenary drawn
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 7182afcb9..a6bbb0572 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -5,7 +5,7 @@
#include "stdafx.h"
#include "landscape.h"
#include "roadveh.h"
-#include "station_map.h"
+#include "station_base.h"
#include "command_func.h"
#include "news_func.h"
#include "pathfind.h"
@@ -1639,7 +1639,7 @@ again:
v->frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
- Station *st = GetStationByTile(v->tile);
+ Station *st = Station::GetByTile(v->tile);
/* Vehicle is at the stop position (at a bay) in a road stop.
* Note, if vehicle is loading/unloading it has already been handled,
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 6ea186f0c..8ddc8b5ee 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -602,7 +602,7 @@ bool AfterLoadGame()
for (TileIndex t = 0; t < map_size; t++) {
switch (GetTileType(t)) {
case MP_STATION: {
- Station *st = GetStationByTile(t);
+ Station *st = Station::GetByTile(t);
/* Set up station spread; buoys do not have one */
if (!IsBuoy(t)) st->rect.BeforeAddTile(t, StationRect::ADD_FORCE);
@@ -635,7 +635,7 @@ bool AfterLoadGame()
* It was 3 (till 2.2) and later 5 (till 5.1).
* Setting it unconditionally does not hurt.
*/
- GetStationByTile(t)->airport_type = AT_OILRIG;
+ Station::GetByTile(t)->airport_type = AT_OILRIG;
} else {
DeleteOilRig(t);
}
@@ -1575,7 +1575,7 @@ bool AfterLoadGame()
if (IsBuoyTile(t)) {
/* reset buoy owner to OWNER_NONE in the station struct
* (even if it is owned by active company) */
- GetStationByTile(t)->owner = OWNER_NONE;
+ Station::GetByTile(t)->owner = OWNER_NONE;
}
} else if (IsTileType(t, MP_ROAD)) {
/* works for all RoadTileType */
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index c89e9ab5c..6c50eb05f 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -11,6 +11,7 @@
#include "../ship.h"
#include "../train.h"
#include "../signs_base.h"
+#include "../station_base.h"
#include "../subsidy_type.h"
#include "../debug.h"
#include "../depot_base.h"
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 415ba76b9..cc1cb4326 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -8,6 +8,7 @@
#include "../roadveh.h"
#include "../ship.h"
#include "../aircraft.h"
+#include "../station_base.h"
#include "../effectvehicle_base.h"
#include "saveload.h"
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 3c451c701..e99f1c1f9 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -7,7 +7,7 @@
#include "landscape.h"
#include "timetable.h"
#include "command_func.h"
-#include "station_map.h"
+#include "station_base.h"
#include "news_func.h"
#include "company_func.h"
#include "npf.h"
diff --git a/src/station.cpp b/src/station.cpp
index 8ee0c17e4..2503148d7 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -22,6 +22,7 @@
#include "settings_type.h"
#include "subsidy_func.h"
#include "core/pool_func.hpp"
+#include "station_base.h"
#include "roadstop_base.h"
#include "table/strings.h"
diff --git a/src/station_base.h b/src/station_base.h
index 7ab2c9c0b..7f2303b0a 100644
--- a/src/station_base.h
+++ b/src/station_base.h
@@ -18,6 +18,7 @@
#include "industry_type.h"
#include "core/geometry_type.hpp"
#include "viewport_type.h"
+#include "station_map.h"
#include <list>
typedef Pool<Station, StationID, 32, 64000> StationPool;
@@ -161,6 +162,11 @@ public:
bool IsBuoy() const;
uint GetCatchmentRadius() const;
+
+ static FORCEINLINE Station *GetByTile(TileIndex tile)
+ {
+ return Station::Get(GetStationIndex(tile));
+ }
};
#define FOR_ALL_STATIONS_FROM(var, start) FOR_ALL_ITEMS_FROM(Station, station_index, var, start)
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 0b2028da8..fbd513bfd 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -31,6 +31,7 @@
#include "string_func.h"
#include "animated_tile_func.h"
#include "elrail_func.h"
+#include "station_base.h"
#include "roadstop_base.h"
#include "table/strings.h"
@@ -45,7 +46,7 @@ bool IsHangar(TileIndex t)
{
assert(IsTileType(t, MP_STATION));
- const Station *st = GetStationByTile(t);
+ const Station *st = Station::GetByTile(t);
const AirportFTAClass *apc = st->Airport();
for (uint i = 0; i < apc->nof_depots; i++) {
@@ -57,7 +58,7 @@ bool IsHangar(TileIndex t)
RoadStop *GetRoadStopByTile(TileIndex tile, RoadStopType type)
{
- const Station *st = GetStationByTile(tile);
+ const Station *st = Station::GetByTile(tile);
for (RoadStop *rs = st->GetPrimaryRoadStop(type);; rs = rs->next) {
if (rs->xy == tile) return rs;
@@ -1179,7 +1180,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, DoCommandFlag flags, ui
}
/* Check ownership of station */
- Station *st = GetStationByTile(tile2);
+ Station *st = Station::GetByTile(tile2);
if (_current_company != OWNER_WATER && !CheckOwnership(st->owner)) {
continue;
}
@@ -1576,7 +1577,7 @@ CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
{
/* Make sure the specified tile is a road stop of the correct type */
if (!IsTileType(tile, MP_STATION) || !IsRoadStop(tile) || (uint32)GetRoadStopType(tile) != GB(p2, 0, 1)) return CMD_ERROR;
- Station *st = GetStationByTile(tile);
+ Station *st = Station::GetByTile(tile);
/* Save the stop info before it is removed */
bool is_drive_through = IsDriveThroughStopTile(tile);
RoadTypes rts = GetRoadTypes(tile);
@@ -2208,7 +2209,7 @@ static void DrawTile_Station(TileInfo *ti)
if (IsCustomStationSpecIndex(ti->tile)) {
/* look for customization */
- st = GetStationByTile(ti->tile);
+ st = Station::GetByTile(ti->tile);
statspec = st->speclist[GetCustomStationSpecIndex(ti->tile)].spec;
if (statspec != NULL) {
@@ -2365,7 +2366,7 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td)
}
}
}
- td->build_date = GetStationByTile(tile)->build_date;
+ td->build_date = Station::GetByTile(tile)->build_date;
const StationSpec *spec = GetStationSpec(tile);
@@ -2860,7 +2861,7 @@ void FindStationsAroundTiles(TileIndex tile, int w_prod, int h_prod, StationList
TileIndex cur_tile = TileAddWrap(tile, dx, dy);
if (cur_tile == INVALID_TILE || !IsTileType(cur_tile, MP_STATION)) continue;
- Station *st = GetStationByTile(cur_tile);
+ Station *st = Station::GetByTile(cur_tile);
if (st->IsBuoy()) continue; // bouys don't accept cargo
@@ -2999,7 +3000,7 @@ void BuildOilRig(TileIndex tile)
void DeleteOilRig(TileIndex tile)
{
- Station *st = GetStationByTile(tile);
+ Station *st = Station::GetByTile(tile);
MakeWaterKeepingClass(tile, OWNER_NONE);
MarkTileDirtyByTile(tile);
@@ -3087,7 +3088,7 @@ static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
}
}
- Station *st = GetStationByTile(tile);
+ Station *st = Station::GetByTile(tile);
switch (GetStationType(tile)) {
case STATION_RAIL: return RemoveRailroadStation(st, tile, flags);
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 6fe69370f..6b632e0e7 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -19,7 +19,7 @@
#include "gfx_func.h"
#include "widgets/dropdown_func.h"
#include "newgrf_cargo.h"
-#include "station_map.h"
+#include "station_base.h"
#include "tilehighlight_func.h"
#include "core/smallmap_type.hpp"
#include "company_base.h"
@@ -1136,7 +1136,7 @@ static const Station *FindStationsNearby(TileIndex tile, int w, int h, bool dist
/* Check the inside, to return, if we sit on another station */
BEGIN_TILE_LOOP(t, w, h, tile)
- if (t < MapSize() && IsTileType(t, MP_STATION)) return GetStationByTile(t);
+ if (t < MapSize() && IsTileType(t, MP_STATION)) return Station::GetByTile(t);
END_TILE_LOOP(t, w, h, tile)
/* Look for deleted stations */
diff --git a/src/station_map.h b/src/station_map.h
index 04b17c235..6c7d15026 100644
--- a/src/station_map.h
+++ b/src/station_map.h
@@ -9,7 +9,6 @@
#include "road_map.h"
#include "water_map.h"
#include "station_func.h"
-#include "station_base.h"
#include "rail.h"
typedef byte StationGfx;
@@ -24,11 +23,6 @@ static inline StationID GetStationIndex(TileIndex t)
return (StationID)_m[t].m2;
}
-static inline Station *GetStationByTile(TileIndex t)
-{
- return Station::Get(GetStationIndex(t));
-}
-
enum {
GFX_RADAR_LARGE_FIRST = 31,
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index c5c72f151..358853432 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -31,6 +31,7 @@
#include "vehicle_func.h"
#include "autoreplace_func.h"
#include "autoreplace_gui.h"
+#include "station_base.h"
#include "ai/ai.hpp"
#include "core/smallmap_type.hpp"
#include "depot_func.h"
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index a7ff57e53..bd5e92554 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -6,6 +6,7 @@
#include "roadveh.h"
#include "gfx_func.h"
#include "news_func.h"
+#include "airport.h"
#include "command_func.h"
#include "company_func.h"
#include "vehicle_gui.h"
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index b2e5f1cd2..595fa702b 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -16,7 +16,7 @@
#include "gfx_func.h"
#include "newgrf_engine.h"
#include "newgrf_text.h"
-#include "station_map.h"
+#include "station_base.h"
#include "roadveh.h"
#include "train.h"
#include "depot_base.h"
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 17aadffce..44e5b710c 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -32,6 +32,7 @@
#include "newgrf_cargo.h"
#include "effectvehicle_func.h"
#include "tunnelbridge_map.h"
+#include "station_base.h"
#include "ai/ai.hpp"
#include "table/sprites.h"
@@ -740,7 +741,7 @@ static void FloodVehicles(TileIndex tile)
byte z = 0;
if (IsTileType(tile, MP_STATION) && IsAirport(tile)) {
- const Station *st = GetStationByTile(tile);
+ const Station *st = Station::GetByTile(tile);
const AirportFTAClass *airport = st->Airport();
z = 1 + airport->delta_z;
for (uint x = 0; x < airport->size_x; x++) {
@@ -756,7 +757,7 @@ static void FloodVehicles(TileIndex tile)
/* if non-uniform stations are disabled, flood some train in this train station (if there is any) */
if (!_settings_game.station.nonuniform_stations && IsTileType(tile, MP_STATION) && GetStationType(tile) == STATION_RAIL) {
- const Station *st = GetStationByTile(tile);
+ const Station *st = Station::GetByTile(tile);
BEGIN_TILE_LOOP(t, st->trainst_w, st->trainst_h, st->train_tile)
if (st->TileBelongsToRailStation(t)) {
@@ -790,7 +791,7 @@ static void FloodVehicle(Vehicle *v)
* because that's always the shadow. Except for the heliport, because
* that station has a big z_offset for the aircraft. */
if (!IsTileType(v->tile, MP_STATION) || !IsAirport(v->tile) || GetTileMaxZ(v->tile) != 0) return;
- const Station *st = GetStationByTile(v->tile);
+ const Station *st = Station::GetByTile(v->tile);
const AirportFTAClass *airport = st->Airport();
if (v->z_pos != airport->delta_z + 1) return;
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp
index 3a55a3adc..cce1769e5 100644
--- a/src/yapf/follow_track.hpp
+++ b/src/yapf/follow_track.hpp
@@ -346,7 +346,7 @@ protected:
if (IsRailTT() && m_is_station) {
/* entered railway station
* get platform length */
- uint length = GetStationByTile(m_new_tile)->GetPlatformLength(m_new_tile, TrackdirToExitdir(m_old_td));
+ uint length = Station::GetByTile(m_new_tile)->GetPlatformLength(m_new_tile, TrackdirToExitdir(m_old_td));
/* how big step we must do to get to the last platform tile; */
m_tiles_skipped = length - 1;
/* move to the platform end */
diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp
index 00c824b1a..faf439ff2 100644
--- a/src/yapf/yapf_costrail.hpp
+++ b/src/yapf/yapf_costrail.hpp
@@ -543,7 +543,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
/* Station platform-length penalty. */
if ((end_segment_reason & ESRB_STATION) != ESRB_NONE) {
- Station *st = GetStationByTile(n.GetLastTile());
+ Station *st = Station::GetByTile(n.GetLastTile());
assert(st != NULL);
uint platform_length = st->GetPlatformLength(n.GetLastTile(), ReverseDiagDir(TrackdirToExitdir(n.GetLastTrackdir())));
/* Reduce the extra cost caused by passing-station penalty (each station receives it in the segment cost). */