Fix UpdateAllBlockSignals with signalled tunnel/bridges and no infra sharing
See: #473
This commit is contained in:
@@ -394,18 +394,22 @@ void HandleSharingCompanyDeletion(Owner owner)
|
|||||||
void UpdateAllBlockSignals(Owner owner)
|
void UpdateAllBlockSignals(Owner owner)
|
||||||
{
|
{
|
||||||
Owner last_owner = INVALID_OWNER;
|
Owner last_owner = INVALID_OWNER;
|
||||||
|
auto check_owner = [&](Owner track_owner) -> bool {
|
||||||
|
if (owner != INVALID_OWNER && track_owner != owner) return true;
|
||||||
|
|
||||||
|
if (!IsOneSignalBlock(track_owner, last_owner)) {
|
||||||
|
/* Cannot update signals of two different companies in one run,
|
||||||
|
* if these signal blocks are not joined */
|
||||||
|
UpdateSignalsInBuffer();
|
||||||
|
last_owner = track_owner;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
TileIndex tile = 0;
|
TileIndex tile = 0;
|
||||||
do {
|
do {
|
||||||
if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile)) {
|
if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile)) {
|
||||||
Owner track_owner = GetTileOwner(tile);
|
Owner track_owner = GetTileOwner(tile);
|
||||||
if (owner != INVALID_OWNER && track_owner != owner) continue;
|
if (check_owner(track_owner)) continue;
|
||||||
|
|
||||||
if (!IsOneSignalBlock(track_owner, last_owner)) {
|
|
||||||
/* Cannot update signals of two different companies in one run,
|
|
||||||
* if these signal blocks are not joined */
|
|
||||||
UpdateSignalsInBuffer();
|
|
||||||
last_owner = track_owner;
|
|
||||||
}
|
|
||||||
TrackBits bits = GetTrackBits(tile);
|
TrackBits bits = GetTrackBits(tile);
|
||||||
do {
|
do {
|
||||||
Track track = RemoveFirstTrack(&bits);
|
Track track = RemoveFirstTrack(&bits);
|
||||||
@@ -416,8 +420,10 @@ void UpdateAllBlockSignals(Owner owner)
|
|||||||
} else if (IsLevelCrossingTile(tile) && (owner == INVALID_OWNER || GetTileOwner(tile) == owner)) {
|
} else if (IsLevelCrossingTile(tile) && (owner == INVALID_OWNER || GetTileOwner(tile) == owner)) {
|
||||||
UpdateLevelCrossing(tile);
|
UpdateLevelCrossing(tile);
|
||||||
} else if (IsTunnelBridgeWithSignalSimulation(tile)) {
|
} else if (IsTunnelBridgeWithSignalSimulation(tile)) {
|
||||||
|
Owner track_owner = GetTileOwner(tile);
|
||||||
|
if (check_owner(track_owner)) continue;
|
||||||
if (IsTunnelBridgeSignalSimulationExit(tile)) {
|
if (IsTunnelBridgeSignalSimulationExit(tile)) {
|
||||||
AddSideToSignalBuffer(tile, INVALID_DIAGDIR, GetTileOwner(tile));
|
AddSideToSignalBuffer(tile, INVALID_DIAGDIR, track_owner);
|
||||||
}
|
}
|
||||||
if (_extra_aspects > 0 && IsTunnelBridgeSignalSimulationEntrance(tile) && GetTunnelBridgeEntranceSignalState(tile) == SIGNAL_STATE_GREEN) {
|
if (_extra_aspects > 0 && IsTunnelBridgeSignalSimulationEntrance(tile) && GetTunnelBridgeEntranceSignalState(tile) == SIGNAL_STATE_GREEN) {
|
||||||
SetTunnelBridgeEntranceSignalAspect(tile, 0);
|
SetTunnelBridgeEntranceSignalAspect(tile, 0);
|
||||||
|
Reference in New Issue
Block a user