Skip to content

Commit

Permalink
Fix #8020: Add missing docking tiles around industry neutral stations
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuXarick committed Feb 25, 2020
1 parent d1b7eb2 commit 329c40c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/saveload/afterload.cpp
Expand Up @@ -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();

Expand Down
1 change: 1 addition & 0 deletions src/saveload/saveload_internal.h
Expand Up @@ -29,6 +29,7 @@ void AfterLoadVehicles(bool part_of_load);
void FixupTrainLengths();
void AfterLoadStations();
void AfterLoadRoadStops();
void AfterLoadScanDockingTiles();
void ResetLabelMaps();
void AfterLoadLabelMaps();
void AfterLoadStoryBook();
Expand Down
11 changes: 11 additions & 0 deletions src/saveload/station_sl.cpp
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions src/ship_cmd.cpp
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions src/water_cmd.cpp
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 329c40c

Please sign in to comment.