summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuXarick <43006711+SamuXarick@users.noreply.github.com>2020-02-24 22:49:11 +0000
committerNiels Martin Hansen <nielsm@indvikleren.dk>2020-03-30 08:21:40 +0200
commit57553cd8098ac003b3d5df6b9778214e6933c5d7 (patch)
tree93c0fbeadf0c67d2aeea891503b5a7007b50d7ed
parent4d4005d8b7455fba8fe4e59dc99727a4caec6edf (diff)
downloadopenttd-57553cd8098ac003b3d5df6b9778214e6933c5d7.tar.xz
Fix #8020: Add missing docking tiles around industry neutral stations
-rw-r--r--src/saveload/afterload.cpp8
-rw-r--r--src/saveload/saveload_internal.h1
-rw-r--r--src/saveload/station_sl.cpp11
-rw-r--r--src/ship_cmd.cpp1
-rw-r--r--src/water_cmd.cpp4
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);
+ }
}
}