Feature: Multi-tile docks and docking points.

This commit is contained in:
peter1138
2019-03-11 10:37:47 +00:00
committed by Niels Martin Hansen
parent f1c3915341
commit f538179878
27 changed files with 471 additions and 80 deletions

View File

@@ -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();