From 57553cd8098ac003b3d5df6b9778214e6933c5d7 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Mon, 24 Feb 2020 22:49:11 +0000 Subject: Fix #8020: Add missing docking tiles around industry neutral stations --- src/saveload/afterload.cpp | 8 +++----- src/saveload/saveload_internal.h | 1 + src/saveload/station_sl.cpp | 11 +++++++++++ src/ship_cmd.cpp | 1 + src/water_cmd.cpp | 4 ++++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 022fd28e9..63e4b37e6 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -3116,13 +3116,11 @@ bool AfterLoadGame() if (IsDock(t) || IsOilRig(t)) Station::GetByTile(t)->ship_station.Add(t); } } - - /* Scan for docking tiles */ - for (Station *st : Station::Iterate()) { - if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st); - } } + /* Update station docking tiles. */ + AfterLoadScanDockingTiles(); + /* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */ Station::RecomputeCatchmentForAll(); diff --git a/src/saveload/saveload_internal.h b/src/saveload/saveload_internal.h index 8a3f433c2..69dfb5dbf 100644 --- a/src/saveload/saveload_internal.h +++ b/src/saveload/saveload_internal.h @@ -29,6 +29,7 @@ void AfterLoadVehicles(bool part_of_load); void FixupTrainLengths(); void AfterLoadStations(); void AfterLoadRoadStops(); +void AfterLoadScanDockingTiles(); void ResetLabelMaps(); void AfterLoadLabelMaps(); void AfterLoadStoryBook(); diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index 1d3612ae3..b0e91b4e7 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -141,6 +141,17 @@ void AfterLoadRoadStops() } } +/** + * (Re)scan for station docking tiles after loading a savegame. + */ +void AfterLoadScanDockingTiles() +{ + /* Scan for docking tiles */ + for (Station *st : Station::Iterate()) { + if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st); + } +} + static const SaveLoad _roadstop_desc[] = { SLE_VAR(RoadStop, xy, SLE_UINT32), SLE_CONDNULL(1, SL_MIN_VERSION, SLV_45), diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 1758454ad..28e6be4f3 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -613,6 +613,7 @@ bool IsShipDestinationTile(TileIndex tile, StationID station) const Industry *i = Industry::GetByTile(t); if (i->neutral_station != nullptr && i->neutral_station->index == station) return true; } + if (IsTileType(t, MP_STATION) && IsOilRig(t) && GetStationIndex(t) == station) return true; } return false; } diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 12195d8dc..5e37c16dd 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -196,6 +196,10 @@ void CheckForDockingTile(TileIndex t) SetDockingTile(t, true); } } + if (IsTileType(tile, MP_STATION) && IsOilRig(tile)) { + Station::GetByTile(tile)->docking_station.Add(t); + SetDockingTile(t, true); + } } } -- cgit v1.2.3-70-g09d2