Feature: Multi-tile docks and docking points.
This commit is contained in:

committed by
Niels Martin Hansen

parent
f1c3915341
commit
f538179878
@@ -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();
|
||||
|
||||
|
@@ -725,7 +725,7 @@ static const OldChunks station_chunk[] = {
|
||||
OCL_NULL( 4 ), ///< bus/lorry tile
|
||||
OCL_SVAR( OC_TILE, Station, train_station.tile ),
|
||||
OCL_SVAR( OC_TILE, Station, airport.tile ),
|
||||
OCL_SVAR( OC_TILE, Station, dock_tile ),
|
||||
OCL_NULL( 4 ), ///< dock tile
|
||||
OCL_SVAR( OC_FILE_U8 | OC_VAR_U16, Station, train_station.w ),
|
||||
|
||||
OCL_NULL( 1 ), ///< sort-index, no longer in use
|
||||
|
@@ -301,6 +301,7 @@ enum SaveLoadVersion : uint16 {
|
||||
SLV_ROAD_TYPES, ///< 214 PR#6811 NewGRF road types.
|
||||
|
||||
SLV_SCRIPT_MEMLIMIT, ///< 215 PR#7516 Limit on AI/GS memory consumption.
|
||||
SLV_MULTITILE_DOCKS, ///< 216 PR#7380 Multiple docks per station.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
@@ -174,8 +174,8 @@ static const SaveLoad _old_station_desc[] = {
|
||||
SLE_CONDVAR(Station, train_station.tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Station, airport.tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, dock_tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Station, dock_tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDNULL(4, SLV_6, SLV_MULTITILE_DOCKS),
|
||||
SLE_REF(Station, town, REF_TOWN),
|
||||
SLE_VAR(Station, train_station.w, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_CONDVAR(Station, train_station.h, SLE_FILE_U8 | SLE_VAR_U16, SLV_2, SL_MAX_VERSION),
|
||||
@@ -423,7 +423,13 @@ static const SaveLoad _station_desc[] = {
|
||||
|
||||
SLE_REF(Station, bus_stops, REF_ROADSTOPS),
|
||||
SLE_REF(Station, truck_stops, REF_ROADSTOPS),
|
||||
SLE_VAR(Station, dock_tile, SLE_UINT32),
|
||||
SLE_CONDNULL(4, SL_MIN_VERSION, SLV_MULTITILE_DOCKS),
|
||||
SLE_CONDVAR(Station, ship_station.tile, SLE_UINT32, SLV_MULTITILE_DOCKS, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, ship_station.w, SLE_FILE_U8 | SLE_VAR_U16, SLV_MULTITILE_DOCKS, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, ship_station.h, SLE_FILE_U8 | SLE_VAR_U16, SLV_MULTITILE_DOCKS, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, docking_station.tile, SLE_UINT32, SLV_MULTITILE_DOCKS, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, docking_station.w, SLE_FILE_U8 | SLE_VAR_U16, SLV_MULTITILE_DOCKS, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, docking_station.h, SLE_FILE_U8 | SLE_VAR_U16, SLV_MULTITILE_DOCKS, SL_MAX_VERSION),
|
||||
SLE_VAR(Station, airport.tile, SLE_UINT32),
|
||||
SLE_CONDVAR(Station, airport.w, SLE_FILE_U8 | SLE_VAR_U16, SLV_140, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.h, SLE_FILE_U8 | SLE_VAR_U16, SLV_140, SL_MAX_VERSION),
|
||||
|
Reference in New Issue
Block a user