Changeset - r20075:2bda14adc373
[Not reviewed]
master
0 1 0
rubidium - 12 years ago 2013-02-23 18:29:55
rubidium@openttd.org
(svn r25038) -Fix [FS#5479]: minimise gaps feature caused removal to only happen at the signal build interval instead of the implicit interval of 1
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -1311,25 +1311,25 @@ static CommandCost CmdSignalTrackHelper(
 
			uint32 p1 = GB(TrackdirToTrack(trackdir), 0, 3);
 
			SB(p1, 3, 1, mode);
 
			SB(p1, 4, 1, semaphores);
 
			SB(p1, 5, 3, sigtype);
 
			if (!remove && signal_ctr == 0) SetBit(p1, 17);
 

	
 
			/* Pick the correct orientation for the track direction */
 
			signals = 0;
 
			if (HasBit(signal_dir, 0)) signals |= SignalAlongTrackdir(trackdir);
 
			if (HasBit(signal_dir, 1)) signals |= SignalAgainstTrackdir(trackdir);
 

	
 
			/* Test tiles in between for suitability as well if minimising gaps. */
 
			bool test_only = minimise_gaps && signal_ctr < (last_used_ctr + signal_density);
 
			bool test_only = !remove && minimise_gaps && signal_ctr < (last_used_ctr + signal_density);
 
			CommandCost ret = DoCommand(tile, p1, signals, test_only ? flags & ~DC_EXEC : flags, remove ? CMD_REMOVE_SIGNALS : CMD_BUILD_SIGNALS);
 

	
 
			if (ret.Succeeded()) {
 
				/* Remember last track piece where we can place a signal. */
 
				last_suitable_ctr = signal_ctr;
 
				last_suitable_tile = tile;
 
				last_suitable_trackdir = trackdir;
 
			} else if (!test_only && last_suitable_tile != INVALID_TILE) {
 
				/* If a signal can't be placed, place it at the last possible position. */
 
				SB(p1, 0, 3, TrackdirToTrack(last_suitable_trackdir));
 
				ClrBit(p1, 17);
 

	
0 comments (0 inline, 0 general)