Changeset - r28605:5efda914b6f9
[Not reviewed]
master
0 5 0
dP - 10 months ago 2024-01-29 12:41:36
dp@dpointer.org
Codechange: Make command constant names consistent with command proc (#11920)
5 files changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/command_type.h
Show inline comments
 
@@ -193,8 +193,8 @@ enum Commands : uint16_t {
 
	CMD_BUILD_BRIDGE,                 ///< build a bridge
 
	CMD_BUILD_RAIL_STATION,           ///< build a rail station
 
	CMD_BUILD_TRAIN_DEPOT,            ///< build a train depot
 
	CMD_BUILD_SIGNALS,                ///< build a signal
 
	CMD_REMOVE_SIGNALS,               ///< remove a signal
 
	CMD_BUILD_SINGLE_SIGNAL,          ///< build a signal
 
	CMD_REMOVE_SINGLE_SIGNAL,         ///< remove a signal
 
	CMD_TERRAFORM_LAND,               ///< terraform a tile
 
	CMD_BUILD_OBJECT,                 ///< build an object
 
	CMD_BUILD_OBJECT_AREA,            ///< build an area of objects
src/rail_cmd.cpp
Show inline comments
 
@@ -455,7 +455,7 @@ CommandCost CmdBuildSingleRail(DoCommand
 

	
 
				for (Track track_it = TRACK_BEGIN; track_it < TRACK_END; track_it++) {
 
					if (HasTrack(tile, track_it) && HasSignalOnTrack(tile, track_it)) {
 
						CommandCost ret_remove_signals = Command<CMD_REMOVE_SIGNALS>::Do(flags, tile, track_it);
 
						CommandCost ret_remove_signals = Command<CMD_REMOVE_SINGLE_SIGNAL>::Do(flags, tile, track_it);
 
						if (ret_remove_signals.Failed()) return ret_remove_signals;
 
						cost.AddCost(ret_remove_signals);
 
					}
 
@@ -682,7 +682,7 @@ CommandCost CmdRemoveSingleRail(DoComman
 

	
 
			/* Charge extra to remove signals on the track, if they are there */
 
			if (HasSignalOnTrack(tile, track)) {
 
				cost.AddCost(Command<CMD_REMOVE_SIGNALS>::Do(flags, tile, track));
 
				cost.AddCost(Command<CMD_REMOVE_SINGLE_SIGNAL>::Do(flags, tile, track));
 
			}
 

	
 
			if (flags & DC_EXEC) {
 
@@ -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_BLOCK, SIGTYPE_BLOCK, 0, signals);
 
		CommandCost ret = remove ? Command<CMD_REMOVE_SINGLE_SIGNAL>::Do(do_flags, tile, TrackdirToTrack(trackdir)) : Command<CMD_BUILD_SINGLE_SIGNAL>::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();
 

	
src/rail_cmd.h
Show inline comments
 
@@ -31,8 +31,8 @@ DEF_CMD_TRAIT(CMD_REMOVE_RAILROAD_TRACK,
 
DEF_CMD_TRAIT(CMD_BUILD_SINGLE_RAIL,     CmdBuildSingleRail,     CMD_AUTO | CMD_NO_WATER, CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_REMOVE_SINGLE_RAIL,    CmdRemoveSingleRail,    CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_BUILD_TRAIN_DEPOT,     CmdBuildTrainDepot,     CMD_AUTO | CMD_NO_WATER, CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_BUILD_SIGNALS,         CmdBuildSingleSignal,   CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_REMOVE_SIGNALS,        CmdRemoveSingleSignal,  CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_BUILD_SINGLE_SIGNAL,   CmdBuildSingleSignal,   CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_REMOVE_SINGLE_SIGNAL,  CmdRemoveSingleSignal,  CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_CONVERT_RAIL,          CmdConvertRail,                0,                CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_BUILD_SIGNAL_TRACK,    CmdBuildSignalTrack,    CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_REMOVE_SIGNAL_TRACK,   CmdRemoveSignalTrack,   CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
src/rail_gui.cpp
Show inline comments
 
@@ -238,18 +238,18 @@ static void GenericPlaceSignals(TileInde
 
	Track track = FindFirstTrack(trackbits);
 

	
 
	if (_remove_button_clicked) {
 
		Command<CMD_REMOVE_SIGNALS>::Post(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM, CcPlaySound_CONSTRUCTION_RAIL, tile, track);
 
		Command<CMD_REMOVE_SINGLE_SIGNAL>::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_BLOCK : SIGTYPE_PBS;
 

	
 
		if (FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr) {
 
			/* signal GUI is used */
 
			Command<CMD_BUILD_SIGNALS>::Post(_convert_signal_button ? STR_ERROR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
 
			Command<CMD_BUILD_SINGLE_SIGNAL>::Post(_convert_signal_button ? STR_ERROR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
 
				tile, track, _cur_signal_type, _cur_signal_variant, _convert_signal_button, false, _ctrl_pressed, cycle_start, SIGTYPE_LAST, 0, 0);
 
		} else {
 
			SignalVariant sigvar = TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC;
 
			Command<CMD_BUILD_SIGNALS>::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
 
			Command<CMD_BUILD_SINGLE_SIGNAL>::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
 
				tile, track, _settings_client.gui.default_signal_type, sigvar, false, false, _ctrl_pressed, cycle_start, SIGTYPE_LAST, 0, 0);
 

	
 
		}
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_BLOCK, ::SIGTYPE_BLOCK, signal_cycles, 0);
 
	return ScriptObject::Command<CMD_BUILD_SINGLE_SIGNAL>::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)
 
@@ -488,7 +488,7 @@ static bool IsValidSignalType(int signal
 
	}
 
	EnforcePrecondition(false, track != INVALID_TRACK);
 

	
 
	return ScriptObject::Command<CMD_REMOVE_SIGNALS>::Do(tile, track);
 
	return ScriptObject::Command<CMD_REMOVE_SINGLE_SIGNAL>::Do(tile, track);
 
}
 

	
 
/* static */ Money ScriptRail::GetBuildCost(RailType railtype, BuildType build_type)
0 comments (0 inline, 0 general)