Merge branch 'signal_tunnels_bridges' into jgrpp

# Conflicts:
#	src/saveload/afterload.cpp
#	src/saveload/extended_ver_sl.cpp
This commit is contained in:
Jonathan G Rennison
2018-07-05 01:13:52 +01:00
6 changed files with 70 additions and 18 deletions

View File

@@ -60,6 +60,7 @@
#include "../disaster_vehicle.h"
#include "../tracerestrict.h"
#include "../tunnel_map.h"
#include "../bridge_signal_map.h"
#include "saveload_internal.h"
@@ -3375,6 +3376,17 @@ bool AfterLoadGame()
}
}
}
if (SlXvIsFeaturePresent(XSLFI_SIG_TUNNEL_BRIDGE, 1, 6)) {
/* m2 signal state bit allocation has shrunk */
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL && IsBridge(t) && IsTunnelBridgeSignalSimulationEntrance(t)) {
extern void ShiftBridgeEntranceSimulatedSignalsExtended(TileIndex t, int shift, uint64 in);
const uint shift = 15 - BRIDGE_M2_SIGNAL_STATE_COUNT;
ShiftBridgeEntranceSimulatedSignalsExtended(t, shift, GB(_m[t].m2, BRIDGE_M2_SIGNAL_STATE_COUNT, shift));
SB(_m[t].m2, 0, 15, GB(_m[t].m2, 0, 15) << shift);
}
}
}
if (SlXvIsFeatureMissing(XSLFI_CUSTOM_BRIDGE_HEADS)) {
/* ensure that previously unused custom bridge-head bits are cleared */