Changeset - r2911:1ab4988c87d2
[Not reviewed]
master
0 2 0
Darkvater - 19 years ago 2006-01-29 10:50:27
darkvater@openttd.org
(svn r3466) - Codechange: Some changes to increase readability of signals code.
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rail.h
Show inline comments
 
@@ -39,13 +39,13 @@ typedef enum RailTileSubtypes {
 
	RAIL_SUBTYPE_DEPOT    = 0x00,
 
	RAIL_SUBTYPE_WAYPOINT = 0x04,
 
	RAIL_SUBTYPE_MASK     = 0x3C,
 
} RailTileSubtype;
 

	
 
typedef enum SignalTypes {
 
	/* Stored in m4[0..1] for MP_RAILWAY */
 
	/* Stored in m4[0..2] for MP_RAILWAY */
 
	SIGTYPE_NORMAL  = 0,        // normal signal
 
	SIGTYPE_ENTRY   = 1,        // presignal block entry
 
	SIGTYPE_EXIT    = 2,        // presignal block exit
 
	SIGTYPE_COMBO   = 3,        // presignal inter-block
 
	SIGTYPE_PBS     = 4,        // pbs signal
 
	SIGTYPE_END,
rail_cmd.c
Show inline comments
 
@@ -754,23 +754,23 @@ int32 CmdBuildSingleSignal(int x, int y,
 
	if (flags & DC_EXEC) {
 
		if (GetRailTileType(tile) != RAIL_TYPE_SIGNALS) {
 
			// there are no signals at all on this tile yet
 
			_m[tile].m5 |= RAIL_TYPE_SIGNALS; // change into signals
 
			_m[tile].m2 |= 0xF0;              // all signals are on
 
			_m[tile].m3 &= ~0xF0;          // no signals built by default
 
			_m[tile].m4 = semaphore ? 0x08 : 0;
 
			_m[tile].m4 = semaphore ? SIG_SEMAPHORE_MASK : 0;
 
		}
 

	
 
		if (p2 == 0) {
 
			if (!HasSignalOnTrack(tile, track)) {
 
				// build new signals
 
				_m[tile].m3 |= SignalOnTrack(track);
 
			} else {
 
				if (pre_signal) {
 
					// cycle between normal -> pre -> exit -> combo -> pbs ->...
 
					byte type = ((GetSignalType(tile, track) + 1) % 5);
 
					byte type = (GetSignalType(tile, track) + 1) % SIGTYPE_END;
 
					SB(_m[tile].m4, 0, 3, type);
 
				} else {
 
					// cycle between two-way -> one-way -> one-way -> ...
 
					/* TODO: Rewrite switch into something more general */
 
					switch (track) {
 
						case TRACK_LOWER:
0 comments (0 inline, 0 general)