Changeset - r28462:3086932ccd8c
[Not reviewed]
master
0 7 0
Tyler Trahan - 11 months ago 2024-01-15 20:27:48
tyler@tylertrahan.com
Codechange: Rename SIGTYPE_NORMAL to SIGTYPE_BLOCK (#11788)
7 files changed with 15 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/pathfinder/yapf/yapf_costrail.hpp
Show inline comments
 
@@ -217,7 +217,7 @@ public:
 
							switch (sig_type) {
 
								case SIGTYPE_COMBO:
 
								case SIGTYPE_EXIT:   cost += Yapf().PfGetSettings().rail_firstred_exit_penalty; break; // first signal is red pre-signal-exit
 
								case SIGTYPE_NORMAL:
 
								case SIGTYPE_BLOCK:
 
								case SIGTYPE_ENTRY:  cost += Yapf().PfGetSettings().rail_firstred_penalty; break;
 
								default: break;
 
							}
src/pathfinder/yapf/yapf_node_rail.hpp
Show inline comments
 
@@ -142,7 +142,7 @@ struct CYapfRailNodeT
 
		if (parent == nullptr) {
 
			m_num_signals_passed      = 0;
 
			flags_u.m_inherited_flags = 0;
 
			m_last_red_signal_type    = SIGTYPE_NORMAL;
 
			m_last_red_signal_type    = SIGTYPE_BLOCK;
 
			/* We use PBS as initial signal type because if we are in
 
			 * a PBS section and need to route, i.e. we're at a safe
 
			 * waiting point of a station, we need to account for the
src/rail_cmd.cpp
Show inline comments
 
@@ -103,7 +103,7 @@ void ResolveRailTypeGUISprites(RailTypeI
 
		 SPR_IMG_SIGNAL_SEMAPHORE_COMBO, SPR_IMG_SIGNAL_SEMAPHORE_PBS,   SPR_IMG_SIGNAL_SEMAPHORE_PBS_OWAY},
 
	};
 

	
 
	for (SignalType type = SIGTYPE_NORMAL; type < SIGTYPE_END; type = (SignalType)(type + 1)) {
 
	for (SignalType type = SIGTYPE_BLOCK; type < SIGTYPE_END; type = (SignalType)(type + 1)) {
 
		for (SignalVariant var = SIG_ELECTRIC; var <= SIG_SEMAPHORE; var = (SignalVariant)(var + 1)) {
 
			SpriteID red   = GetCustomSignalSprite(rti, INVALID_TILE, type, var, SIGNAL_STATE_RED, true);
 
			SpriteID green = GetCustomSignalSprite(rti, INVALID_TILE, type, var, SIGNAL_STATE_GREEN, true);
 
@@ -1088,15 +1088,15 @@ CommandCost CmdBuildSingleSignal(DoComma
 
		} else if (convert_signal) {
 
			/* convert button pressed */
 
			if (ctrl_pressed || GetSignalVariant(tile, track) != sigvar) {
 
				/* convert electric <-> semaphore */
 
				/* it costs money to change signal variant (light or semaphore) */
 
				cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS] + _price[PR_CLEAR_SIGNALS]);
 
			} else {
 
				/* it is free to change signal type: normal-pre-exit-combo */
 
				/* it is free to change signal type (block, exit, entry, combo, path, etc) */
 
				cost = CommandCost();
 
			}
 

	
 
		} else {
 
			/* it is free to change orientation/pre-exit-combo signals */
 
			/* it is free to change orientation or number of signals on the tile (for block/presignals which allow signals in both directions) */
 
			cost = CommandCost();
 
		}
 
	}
 
@@ -1290,7 +1290,7 @@ static CommandCost CmdSignalTrackHelper(
 

	
 
		sigtype = GetSignalType(tile, track);
 
		/* Don't but copy entry or exit-signal type */
 
		if (sigtype == SIGTYPE_ENTRY || sigtype == SIGTYPE_EXIT) sigtype = SIGTYPE_NORMAL;
 
		if (sigtype == SIGTYPE_ENTRY || sigtype == SIGTYPE_EXIT) sigtype = SIGTYPE_BLOCK;
 
	} else { // no signals exist, drag a two-way signal stretch
 
		signals = IsPbsSignal(sigtype) ? SignalAlongTrackdir(trackdir) : SignalOnTrack(track);
 
	}
 
@@ -1325,7 +1325,7 @@ static CommandCost CmdSignalTrackHelper(
 
		if (HasBit(signal_dir, 1)) signals |= SignalAgainstTrackdir(trackdir);
 

	
 
		DoCommandFlag do_flags = test_only ? flags & ~DC_EXEC : flags;
 
		CommandCost ret = remove ? Command<CMD_REMOVE_SIGNALS>::Do(do_flags, tile, TrackdirToTrack(trackdir)) : Command<CMD_BUILD_SIGNALS>::Do(do_flags, tile, TrackdirToTrack(trackdir), sigtype, sigvar, false, signal_ctr == 0, mode, SIGTYPE_NORMAL, SIGTYPE_NORMAL, 0, signals);
 
		CommandCost ret = remove ? Command<CMD_REMOVE_SIGNALS>::Do(do_flags, tile, TrackdirToTrack(trackdir)) : Command<CMD_BUILD_SIGNALS>::Do(do_flags, tile, TrackdirToTrack(trackdir), sigtype, sigvar, false, signal_ctr == 0, mode, SIGTYPE_BLOCK, SIGTYPE_BLOCK, 0, signals);
 

	
 
		if (test_only) return ret.Succeeded();
 

	
 
@@ -1526,7 +1526,7 @@ CommandCost CmdRemoveSingleSignal(DoComm
 
 */
 
CommandCost CmdRemoveSignalTrack(DoCommandFlag flags, TileIndex tile, TileIndex end_tile, Track track, bool autofill)
 
{
 
	return CmdSignalTrackHelper(flags, tile, end_tile, track, SIGTYPE_NORMAL, SIG_ELECTRIC, false, true, autofill, false, 1); // bit 5 is remove bit
 
	return CmdSignalTrackHelper(flags, tile, end_tile, track, SIGTYPE_BLOCK, SIG_ELECTRIC, false, true, autofill, false, 1); // bit 5 is remove bit
 
}
 

	
 
/** Update power of train under which is the railtype being converted */
 
@@ -1901,7 +1901,7 @@ static void DrawSingleSignal(TileIndex t
 
		sprite += image;
 
	} else {
 
		/* Normal electric signals are stored in a different sprite block than all other signals. */
 
		sprite = (type == SIGTYPE_NORMAL && variant == SIG_ELECTRIC) ? SPR_ORIGINAL_SIGNALS_BASE : SPR_SIGNALS_BASE - 16;
 
		sprite = (type == SIGTYPE_BLOCK && variant == SIG_ELECTRIC) ? SPR_ORIGINAL_SIGNALS_BASE : SPR_SIGNALS_BASE - 16;
 
		sprite += type * 16 + variant * 64 + image * 2 + condition + (type > SIGTYPE_LAST_NOPBS ? 64 : 0);
 
	}
 

	
src/rail_gui.cpp
Show inline comments
 
@@ -241,7 +241,7 @@ static void GenericPlaceSignals(TileInde
 
		Command<CMD_REMOVE_SIGNALS>::Post(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM, CcPlaySound_CONSTRUCTION_RAIL, tile, track);
 
	} else {
 
		/* Which signals should we cycle through? */
 
		SignalType cycle_start = _settings_client.gui.cycle_signal_types == SIGNAL_CYCLE_ALL && _settings_client.gui.signal_gui_mode == SIGNAL_GUI_ALL ? SIGTYPE_NORMAL : SIGTYPE_PBS;
 
		SignalType cycle_start = _settings_client.gui.cycle_signal_types == SIGNAL_CYCLE_ALL && _settings_client.gui.signal_gui_mode == SIGNAL_GUI_ALL ? SIGTYPE_BLOCK : SIGTYPE_PBS;
 

	
 
		if (FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr) {
 
			/* signal GUI is used */
 
@@ -1695,7 +1695,7 @@ public:
 
		this->sig_sprite_size.height = 0;
 
		this->sig_sprite_bottom_offset = 0;
 
		const RailTypeInfo *rti = GetRailTypeInfo(_cur_railtype);
 
		for (uint type = SIGTYPE_NORMAL; type < SIGTYPE_END; type++) {
 
		for (uint type = SIGTYPE_BLOCK; type < SIGTYPE_END; type++) {
 
			for (uint variant = SIG_ELECTRIC; variant <= SIG_SEMAPHORE; variant++) {
 
				for (uint lowered = 0; lowered < 2; lowered++) {
 
					Point offset;
src/script/api/script_rail.cpp
Show inline comments
 
@@ -469,7 +469,7 @@ static bool IsValidSignalType(int signal
 
	}
 
	::SignalType sig_type = (::SignalType)(signal >= SIGNALTYPE_TWOWAY ? signal ^ SIGNALTYPE_TWOWAY : signal);
 

	
 
	return ScriptObject::Command<CMD_BUILD_SIGNALS>::Do(tile, track, sig_type, ::SIG_ELECTRIC, false, false, false, ::SIGTYPE_NORMAL, ::SIGTYPE_NORMAL, signal_cycles, 0);
 
	return ScriptObject::Command<CMD_BUILD_SIGNALS>::Do(tile, track, sig_type, ::SIG_ELECTRIC, false, false, false, ::SIGTYPE_BLOCK, ::SIGTYPE_BLOCK, signal_cycles, 0);
 
}
 

	
 
/* static */ bool ScriptRail::RemoveSignal(TileIndex tile, TileIndex front)
src/script/api/script_rail.hpp
Show inline comments
 
@@ -64,7 +64,7 @@ public:
 
	 */
 
	enum SignalType {
 
		/* Note: these values represent part of the in-game SignalType enum */
 
		SIGNALTYPE_NORMAL        = ::SIGTYPE_NORMAL,     ///< Normal signal.
 
		SIGNALTYPE_NORMAL        = ::SIGTYPE_BLOCK,      ///< Block signal.
 
		SIGNALTYPE_ENTRY         = ::SIGTYPE_ENTRY,      ///< Entry presignal.
 
		SIGNALTYPE_EXIT          = ::SIGTYPE_EXIT,       ///< Exit signal.
 
		SIGNALTYPE_COMBO         = ::SIGTYPE_COMBO,      ///< Combo signal.
src/signal_type.h
Show inline comments
 
@@ -21,7 +21,7 @@ enum SignalVariant : byte {
 

	
 
/** Type of signal, i.e. how does the signal behave? */
 
enum SignalType : byte {
 
	SIGTYPE_NORMAL     = 0, ///< normal signal
 
	SIGTYPE_BLOCK      = 0, ///< block signal
 
	SIGTYPE_ENTRY      = 1, ///< presignal block entry
 
	SIGTYPE_EXIT       = 2, ///< presignal block exit
 
	SIGTYPE_COMBO      = 3, ///< presignal inter-block
0 comments (0 inline, 0 general)