Changeset - r20074:6a94fdea7f7d
[Not reviewed]
master
0 1 0
rubidium - 12 years ago 2013-02-23 18:15:54
rubidium@openttd.org
(svn r25037) -Fix [FS#5480]: green path signals would be shown when building them 'under' a train, and they would keep showing green until they were passed again
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -1130,27 +1130,27 @@ CommandCost CmdBuildSingleSignal(TileInd
 
			/* If CmdBuildManySignals is called with copying signals, just copy the
 
			 * direction of the first signal given as parameter by CmdBuildManySignals */
 
			SetPresentSignals(tile, (GetPresentSignals(tile) & ~SignalOnTrack(track)) | (p2 & SignalOnTrack(track)));
 
			SetSignalVariant(tile, track, sigvar);
 
			SetSignalType(tile, track, sigtype);
 
		}
 

	
 
		/* Add new signal infrastructure count. */
 
		Company::Get(GetTileOwner(tile))->infrastructure.signal += CountBits(GetPresentSignals(tile));
 
		DirtyCompanyInfrastructureWindows(GetTileOwner(tile));
 

	
 
		if (IsPbsSignal(sigtype)) {
 
			/* PBS signals should show red unless they are on a reservation. */
 
			/* PBS signals should show red unless they are on reserved tiles without a train. */
 
			uint mask = GetPresentSignals(tile) & SignalOnTrack(track);
 
			SetSignalStates(tile, (GetSignalStates(tile) & ~mask) | ((HasBit(GetRailReservationTrackBits(tile), track) ? UINT_MAX : 0) & mask));
 
			SetSignalStates(tile, (GetSignalStates(tile) & ~mask) | ((HasBit(GetRailReservationTrackBits(tile), track) && EnsureNoVehicleOnGround(tile).Succeeded() ? UINT_MAX : 0) & mask));
 
		}
 
		MarkTileDirtyByTile(tile);
 
		AddTrackToSignalBuffer(tile, track, _current_company);
 
		YapfNotifyTrackLayoutChange(tile, track);
 
		if (v != NULL) {
 
			/* Extend the train's path if it's not stopped or loading, or not at a safe position. */
 
			if (!(((v->vehstatus & VS_STOPPED) && v->cur_speed == 0) || v->current_order.IsType(OT_LOADING)) ||
 
					!IsSafeWaitingPosition(v, v->tile, v->GetVehicleTrackdir(), true, _settings_game.pf.forbid_90_deg)) {
 
				TryPathReserve(v, true);
 
			}
 
		}
 
	}
0 comments (0 inline, 0 general)