diff options
author | peter1138 <peter1138@openttd.org> | 2019-03-11 10:37:47 +0000 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-06-30 16:46:32 +0200 |
commit | f538179878370b3bec8bf1575dc30c1377461ebc (patch) | |
tree | 890738c37245a49eb2a8ad52f4afb805baaa9d42 /src/saveload/afterload.cpp | |
parent | f1c39153413b07a964dfde8fd9d6310f0da4987b (diff) | |
download | openttd-f538179878370b3bec8bf1575dc30c1377461ebc.tar.xz |
Feature: Multi-tile docks and docking points.
Diffstat (limited to 'src/saveload/afterload.cpp')
-rw-r--r-- | src/saveload/afterload.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 662f5a77b..770237d53 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -57,6 +57,7 @@ #include "../error.h" #include "../disaster_vehicle.h" #include "../ship.h" +#include "../water.h" #include "saveload_internal.h" @@ -675,7 +676,6 @@ bool AfterLoadGame() Station *st; FOR_ALL_STATIONS(st) { if (st->airport.tile == 0) st->airport.tile = INVALID_TILE; - if (st->dock_tile == 0) st->dock_tile = INVALID_TILE; if (st->train_station.tile == 0) st->train_station.tile = INVALID_TILE; } @@ -3177,6 +3177,27 @@ bool AfterLoadGame() } } + /* Update structures for multitile docks */ + if (IsSavegameVersionBefore(SLV_MULTITILE_DOCKS)) { + for (TileIndex t = 0; t < map_size; t++) { + /* Clear docking tile flag from relevant tiles as it + * was not previously cleared. */ + if (IsTileType(t, MP_WATER) || IsTileType(t, MP_RAILWAY) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE)) { + SetDockingTile(t, false); + } + /* Add docks and oilrigs to Station::ship_station. */ + if (IsTileType(t, MP_STATION)) { + if (IsDock(t) || IsOilRig(t)) Station::GetByTile(t)->ship_station.Add(t); + } + } + + /* Scan for docking tiles */ + Station *st; + FOR_ALL_STATIONS(st) { + if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st); + } + } + /* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */ Station::RecomputeCatchmentForAll(); |