Signals on bridges: Shrink M2 simulated signal states field

This commit is contained in:
Jonathan G Rennison
2018-07-02 18:29:10 +01:00
parent 814f9f7e0f
commit 5770f1407a
6 changed files with 70 additions and 18 deletions

View File

@@ -55,6 +55,7 @@
#include "../order_backup.h"
#include "../error.h"
#include "../disaster_vehicle.h"
#include "../bridge_signal_map.h"
#include "saveload_internal.h"
@@ -3013,6 +3014,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);
}
}
}
/* Station acceptance is some kind of cache */
if (IsSavegameVersionBefore(127)) {

View File

@@ -45,7 +45,7 @@ std::vector<uint32> _sl_xv_discardable_chunk_ids; ///< list of chunks
static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_SIG_TUNNEL_BRIDGE, XSCF_NULL, 6, 6, "signal_tunnel_bridge", NULL, NULL, "XBSS" },
{ XSLFI_SIG_TUNNEL_BRIDGE, XSCF_NULL, 7, 7, "signal_tunnel_bridge", NULL, NULL, "XBSS" },
};
/**