Adjust signal on bridge/tunnel map bits, rename accessors, add docs.

Use same bit to store red/green state for entrances and exits.
No longer re-use exit bit to store red/green state of entrance.
Avoid modifying the M2 of tunnel entrances/exits.
Rename and rationalise map accessor functions.
Document bits used in landscape HTML docs.
This commit is contained in:
Jonathan G Rennison
2016-09-18 14:23:02 +01:00
parent 161f70eb4a
commit 0d2e9f91bf
13 changed files with 175 additions and 131 deletions

View File

@@ -2972,13 +2972,28 @@ bool AfterLoadGame()
/* set the semaphore bit to match what it would have been in v1 */
/* clear the PBS bit, update the end signal state */
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL && HasWormholeSignals(t)) {
if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL && IsTunnelBridgeWithSignalSimulation(t)) {
SetTunnelBridgeSemaphore(t, _cur_year < _settings_client.gui.semaphore_build_before);
SetTunnelBridgePBS(t, false);
UpdateSignalsOnSegment(t, INVALID_DIAGDIR, GetTileOwner(t));
}
}
}
if (SlXvIsFeaturePresent(XSLFI_SIG_TUNNEL_BRIDGE, 1, 2)) {
/* red/green signal state bit for tunnel entrances moved
* to no longer re-use signalled tunnel exit bit
*/
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL && IsTunnelBridgeWithSignalSimulation(t)) {
if (HasBit(_m[t].m5, 5)) {
/* signalled tunnel entrance */
SignalState state = HasBit(_m[t].m5, 6) ? SIGNAL_STATE_RED : SIGNAL_STATE_GREEN;
ClrBit(_m[t].m5, 6);
SetTunnelBridgeSignalState(t, state);
}
}
}
}
/* Station acceptance is some kind of cache */
if (IsSavegameVersionBefore(127)) {