From 06abeb45709b8bdb2cfe9b3dd17af7b047231df7 Mon Sep 17 00:00:00 2001 From: keldorkatarn Date: Tue, 12 Sep 2017 06:03:17 +0200 Subject: [PATCH] Move dock creation code in afterload further up so it runs before the catchment area is created, since that code checks for the presence of the new docks. (cherry picked from commit 80cf10dc0788644ed844b313e5c73dc634f7b43a) # Conflicts: # src/saveload/afterload.cpp --- src/saveload/afterload.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 7ae2d417d2..b8fa99763a 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -1016,6 +1016,22 @@ bool AfterLoadGame() } } + if (IsPatchPackSavegameVersionBefore(SL_PATCH_PACK_1_18)) { + /* Dock type has changed. */ + Station *st; + FOR_ALL_STATIONS(st) { + if (st->dock_station.tile == INVALID_TILE) continue; + assert(Dock::CanAllocateItem()); + if (IsOilRig(st->dock_station.tile)) { + /* Set dock station tile to dest tile instead of station. */ + st->docks = new Dock(st->dock_station.tile, st->dock_station.tile + ToTileIndexDiff({ 1, 0 })); + } + else { /* A normal two-tiles dock. */ + st->docks = new Dock(st->dock_station.tile, TileAddByDiagDir(st->dock_station.tile, GetDockDirection(st->dock_station.tile))); + } + } + } + for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_STATION: { @@ -3344,21 +3360,6 @@ bool AfterLoadGame() FOR_ALL_STATIONS(st) UpdateStationAcceptance(st, false); } - if (IsPatchPackSavegameVersionBefore(SL_PATCH_PACK_1_18)) { - /* Dock type has changed. */ - Station *st; - FOR_ALL_STATIONS(st) { - if (st->dock_station.tile == INVALID_TILE) continue; - assert(Dock::CanAllocateItem()); - if (IsOilRig(st->dock_station.tile)) { - /* Set dock station tile to dest tile instead of station. */ - st->docks = new Dock(st->dock_station.tile, st->dock_station.tile + ToTileIndexDiff({1, 0})); - } else { /* A normal two-tiles dock. */ - st->docks = new Dock(st->dock_station.tile, TileAddByDiagDir(st->dock_station.tile, GetDockDirection(st->dock_station.tile))); - } - } - } - // setting moved from game settings to company settings if (SlXvIsFeaturePresent(XSLFI_ORDER_OCCUPANCY, 1, 1)) { Company *c;