(svn r14365) -Backport (r14364 from NoAI): add the ability do CmdBuildSingleSignal to directly place the correct signal, instead requiring multiple inputs before doing so
authorglx
Sat, 20 Sep 2008 17:43:06 +0000
changeset 10172 dba313cad70f
parent 10171 0ca7a9147b95
child 10173 a5b026c5f1af
(svn r14365) -Backport (r14364 from NoAI): add the ability do CmdBuildSingleSignal to directly place the correct signal, instead requiring multiple inputs before doing so
src/rail_cmd.cpp
--- a/src/rail_cmd.cpp	Sat Sep 20 16:07:56 2008 +0000
+++ b/src/rail_cmd.cpp	Sat Sep 20 17:43:06 2008 +0000
@@ -831,6 +831,7 @@
  * - 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
  * @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.
  */
@@ -844,6 +845,7 @@
 	SignalType cycle_start = (SignalType)GB(p1, 9, 3);
 	SignalType cycle_stop = (SignalType)GB(p1, 12, 3);
 	CommandCost cost;
+	uint num_dir_cycle = GB(p1, 15, 2);
 
 	if (sigtype > SIGTYPE_LAST) return CMD_ERROR;
 
@@ -920,6 +922,7 @@
 				SetPresentSignals(tile, GetPresentSignals(tile) | (IsPbsSignal(sigtype) ? KillFirstBit(SignalOnTrack(track)) : SignalOnTrack(track)));
 				SetSignalType(tile, track, sigtype);
 				SetSignalVariant(tile, track, sigvar);
+				while (num_dir_cycle-- > 0) CycleSignalSide(tile, track);
 			} else {
 				if (convert_signal) {
 					/* convert signal button pressed */