Merge branch 'master' into jgrpp-nrt
Merge trunk multiple docks implementation # Conflicts: # docs/landscape_grid.html # src/order_cmd.cpp # src/pathfinder/npf/npf.cpp # src/pathfinder/yapf/yapf_ship.cpp # src/rail_cmd.cpp # src/saveload/afterload.cpp # src/saveload/oldloader_sl.cpp # src/saveload/station_sl.cpp # src/script/api/script_order.cpp # src/ship_cmd.cpp # src/station.cpp # src/station_base.h # src/station_cmd.cpp # src/tunnelbridge_cmd.cpp
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
#include "../station_base.h"
|
||||
#include "../waypoint_base.h"
|
||||
#include "../roadstop_base.h"
|
||||
#include "../dock_base.h"
|
||||
#include "../tunnelbridge_map.h"
|
||||
#include "../pathfinder/yapf/yapf_cache.h"
|
||||
#include "../elrail_func.h"
|
||||
@@ -63,6 +62,7 @@
|
||||
#include "../tracerestrict.h"
|
||||
#include "../tunnel_map.h"
|
||||
#include "../bridge_signal_map.h"
|
||||
#include "../water.h"
|
||||
|
||||
|
||||
#include "saveload_internal.h"
|
||||
@@ -761,7 +761,6 @@ bool AfterLoadGame()
|
||||
Station *st;
|
||||
FOR_ALL_STATIONS(st) {
|
||||
if (st->airport.tile == 0) st->airport.tile = INVALID_TILE;
|
||||
if (st->dock_station.tile == 0) st->dock_station.tile = INVALID_TILE;
|
||||
if (st->train_station.tile == 0) st->train_station.tile = INVALID_TILE;
|
||||
}
|
||||
|
||||
@@ -890,7 +889,6 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (SlXvIsFeaturePresent(XSLFI_SPRINGPP)) {
|
||||
/*
|
||||
* Reject huge airports
|
||||
@@ -902,7 +900,7 @@ bool AfterLoadGame()
|
||||
if (st->airport.tile == INVALID_TILE) continue;
|
||||
StringID err = INVALID_STRING_ID;
|
||||
if (st->airport.type == 9) {
|
||||
if (st->dock_station.tile != INVALID_TILE && IsOilRig(st->dock_station.tile)) {
|
||||
if (st->ship_station.tile != INVALID_TILE && IsOilRig(st->ship_station.tile)) {
|
||||
/* this airport is probably an oil rig, not a huge airport */
|
||||
} else {
|
||||
err = STR_GAME_SAVELOAD_ERROR_HUGE_AIRPORTS_PRESENT;
|
||||
@@ -929,7 +927,7 @@ bool AfterLoadGame()
|
||||
Aircraft *v;
|
||||
FOR_ALL_AIRCRAFT(v) {
|
||||
Station *st = GetTargetAirportIfValid(v);
|
||||
if (st != nullptr && ((st->dock_station.tile != INVALID_TILE && IsOilRig(st->dock_station.tile)) || st->airport.type == AT_OILRIG)) {
|
||||
if (st != nullptr && ((st->ship_station.tile != INVALID_TILE && IsOilRig(st->ship_station.tile)) || st->airport.type == AT_OILRIG)) {
|
||||
/* aircraft is on approach to an oil rig, bail out now */
|
||||
SetSaveLoadError(STR_GAME_SAVELOAD_ERROR_HELI_OILRIG_BUG);
|
||||
/* Restore the signals */
|
||||
@@ -939,6 +937,13 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_MULTITILE_DOCKS)) {
|
||||
Station *st;
|
||||
FOR_ALL_STATIONS(st) {
|
||||
st->ship_station.tile = INVALID_TILE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update all vehicles */
|
||||
AfterLoadVehicles(true);
|
||||
|
||||
@@ -1040,26 +1045,6 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
if (SlXvIsFeatureMissing(XSLFI_MULTIPLE_DOCKS)) {
|
||||
/* 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 if (IsDock(st->dock_station.tile)) {
|
||||
/* A normal two-tiles dock. */
|
||||
st->docks = new Dock(st->dock_station.tile, TileAddByDiagDir(st->dock_station.tile, GetDockDirection(st->dock_station.tile)));
|
||||
} else if (IsBuoy(st->dock_station.tile)) {
|
||||
/* A buoy. */
|
||||
} else {
|
||||
NOT_REACHED();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (TileIndex t = 0; t < map_size; t++) {
|
||||
switch (GetTileType(t)) {
|
||||
case MP_STATION: {
|
||||
@@ -3637,6 +3622,29 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_MULTITILE_DOCKS) || !SlXvIsFeaturePresent(XSLFI_MULTIPLE_DOCKS, 2)) {
|
||||
/* 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();
|
||||
|
||||
|
Reference in New Issue
Block a user