src/rail_cmd.cpp
changeset 9791 7bcdf05e5e5b
parent 9790 5d5c70e0334e
child 9793 359d2460833b
equal deleted inserted replaced
9790:5d5c70e0334e 9791:7bcdf05e5e5b
  2179 			byte a = GetPresentSignals(tile);
  2179 			byte a = GetPresentSignals(tile);
  2180 			uint b = GetSignalStates(tile);
  2180 			uint b = GetSignalStates(tile);
  2181 
  2181 
  2182 			b &= a;
  2182 			b &= a;
  2183 
  2183 
  2184 			/* When signals are not present (in neither
  2184 			/* When signals are not present (in neither direction),
  2185 			 * direction), we pretend them to be green. (So if
  2185 			 * we pretend them to be green. Otherwise, it depends on
  2186 			 * signals are only one way, the other way will
  2186 			 * the signal type. For signals that are only active from
  2187 			 * implicitely become `red' */
  2187 			 * one side, we set the missing signals explicitely to
  2188 			if ((a & 0xC) == 0) b |= 0xC;
  2188 			 * `green'. Otherwise, they implicitely become `red'. */
  2189 			if ((a & 0x3) == 0) b |= 0x3;
  2189 			if (!IsOnewaySignal(tile, TRACK_UPPER) || (a & SignalOnTrack(TRACK_UPPER)) == 0) b |= ~a & SignalOnTrack(TRACK_UPPER);
       
  2190 			if (!IsOnewaySignal(tile, TRACK_LOWER) || (a & SignalOnTrack(TRACK_LOWER)) == 0) b |= ~a & SignalOnTrack(TRACK_LOWER);
  2190 
  2191 
  2191 			if ((b & 0x8) == 0) red_signals |= (TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_UPPER_E);
  2192 			if ((b & 0x8) == 0) red_signals |= (TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_UPPER_E);
  2192 			if ((b & 0x4) == 0) red_signals |= (TRACKDIR_BIT_LEFT_S | TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_UPPER_W);
  2193 			if ((b & 0x4) == 0) red_signals |= (TRACKDIR_BIT_LEFT_S | TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_UPPER_W);
  2193 			if ((b & 0x2) == 0) red_signals |= (TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_LOWER_E);
  2194 			if ((b & 0x2) == 0) red_signals |= (TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_LOWER_E);
  2194 			if ((b & 0x1) == 0) red_signals |= (TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LOWER_W);
  2195 			if ((b & 0x1) == 0) red_signals |= (TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LOWER_W);