Changeset - r11214:df820ada71fc
[Not reviewed]
master
0 1 0
yexo - 16 years ago 2009-02-24 19:15:23
yexo@openttd.org
(svn r15567) -Fix [FS#2674]: When building signals by dragging from a pre/entry/combo block signal, the signal you started at became a normal block signal.
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -804,12 +804,13 @@ CommandCost CmdBuildTrainDepot(TileIndex
 
 * - p1 = (bit 4)   - 0 = signals, 1 = semaphores
 
 * - p1 = (bit 5-7) - type of the signal, for valid values see enum SignalType in rail_map.h
 
 * - p1 = (bit 8)   - convert the present signal type and variant
 
 * - p1 = (bit 9-11)- start cycle from this signal type
 
 * - p1 = (bit 12-14)-wrap around after this signal type
 
 * - p1 = (bit 15-16)-cycle the signal direction this many times
 
 * - p1 = (bit 17)  - 1 = don't modify an existing signal but don't fail either, 0 = always set new signal type
 
 * @param p2 used for CmdBuildManySignals() to copy direction of first signal
 
 * TODO: p2 should be replaced by two bits for "along" and "against" the track.
 
 */
 
CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	Track track = (Track)GB(p1, 0, 3);
 
@@ -842,12 +843,15 @@ CommandCost CmdBuildSingleSignal(TileInd
 
				trackbits != TRACK_BIT_HORZ &&
 
				trackbits != TRACK_BIT_VERT) {
 
			return_cmd_error(STR_1005_NO_SUITABLE_RAILROAD_TRACK);
 
		}
 
	}
 

	
 
	/* In case we don't want to change an existing signal, return without error. */
 
	if (HasBit(p1, 17) && HasSignalOnTrack(tile, track)) return CommandCost();
 

	
 
	/* you can not convert a signal if no signal is on track */
 
	if (convert_signal && !HasSignalOnTrack(tile, track)) return CMD_ERROR;
 

	
 
	if (!HasSignalOnTrack(tile, track)) {
 
		/* build new signals */
 
		cost = CommandCost(EXPENSES_CONSTRUCTION, _price.build_signals);
 
@@ -1092,12 +1096,13 @@ static CommandCost CmdSignalTrackHelper(
 
		/* only build/remove signals with the specified density */
 
		if ((remove && autofill) || signal_ctr % signal_density == 0) {
 
			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);
 

	
0 comments (0 inline, 0 general)