1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-31 16:14:29 +01:00

Codefix: CommandProc does not exist, so remove any references

This commit is contained in:
Rubidium
2026-01-29 22:23:07 +01:00
committed by rubidium42
parent 7d70d70e0e
commit 79588cbfe3
3 changed files with 18 additions and 32 deletions

View File

@@ -88,52 +88,45 @@ inline constexpr auto MakeCommandsFromTraits(std::integer_sequence<T, i...>) noe
}
/**
* The master command table
* The master command table.
*
* This table contains all possible CommandProc functions with
* the flags which belongs to it. The indices are the same
* as the value from the CMD_* enums.
* This contains the #CommandInfo for all possible #Commands functions.
*/
static constexpr auto _command_proc_table = MakeCommandsFromTraits(std::make_integer_sequence<std::underlying_type_t<Commands>, to_underlying(Commands::End)>{});
static constexpr auto _command_table = MakeCommandsFromTraits(std::make_integer_sequence<std::underlying_type_t<Commands>, to_underlying(Commands::End)>{});
/**
* This function range-checks a cmd.
*
* @param cmd The integer value of a command
* @return true if the command is valid (and got a CommandProc function)
* This function range-checks a Commands. This is primarily for Commands coming from the network.
* @param cmd The command.
* @return True if the command is valid.
*/
bool IsValidCommand(Commands cmd)
{
return to_underlying(cmd) < _command_proc_table.size();
return to_underlying(cmd) < _command_table.size();
}
/**
* This function mask the parameter with CMD_ID_MASK and returns
* the flags which belongs to the given command.
*
* @param cmd The integer value of the command
* Get the command flags associated with the given command.
* @param cmd The command.
* @return The flags for this command
*/
CommandFlags GetCommandFlags(Commands cmd)
{
assert(IsValidCommand(cmd));
return _command_proc_table[cmd].flags;
return _command_table[cmd].flags;
}
/**
* This function mask the parameter with CMD_ID_MASK and returns
* the name which belongs to the given command.
*
* @param cmd The integer value of the command
* Get the name of the given command.
* @param cmd The command.
* @return The name for this command
*/
std::string_view GetCommandName(Commands cmd)
{
assert(IsValidCommand(cmd));
return _command_proc_table[cmd].name;
return _command_table[cmd].name;
}
/**
@@ -158,7 +151,7 @@ bool IsCommandAllowedWhilePaused(Commands cmd)
static_assert(std::size(command_type_lookup) == to_underlying(CommandType::End));
assert(IsValidCommand(cmd));
return _game_mode == GM_EDITOR || command_type_lookup[to_underlying(_command_proc_table[cmd].type)] <= _settings_game.construction.command_pause_level;
return _game_mode == GM_EDITOR || command_type_lookup[to_underlying(_command_table[cmd].type)] <= _settings_game.construction.command_pause_level;
}
/**
@@ -384,7 +377,7 @@ CommandCost CommandHelperBase::InternalExecuteProcessResult(Commands cmd, Comman
SubtractMoneyFromCompany(_current_company, res_exec);
/* Record if there was a command issues during pause; ignore pause/other setting related changes. */
if (_pause_mode.Any() && _command_proc_table[cmd].type != CommandType::ServerSetting) _pause_mode.Set(PauseMode::CommandDuringPause);
if (_pause_mode.Any() && _command_table[cmd].type != CommandType::ServerSetting) _pause_mode.Set(PauseMode::CommandDuringPause);
/* update signals if needed */
UpdateSignalsInBuffer();

View File

@@ -125,7 +125,7 @@ private:
public:
/**
* This function executes a given command with the parameters from the #CommandProc parameter list.
* This function executes a given command.
* Depending on the flags parameter it executes or tests a command.
*
* @note This function is to be called from the StateGameLoop or from within the execution of a Command.
@@ -134,7 +134,6 @@ public:
*
* @param flags Flags for the command and how to execute the command
* @param args Parameters for the command
* @see CommandProc
* @return the cost
*/
static Tret Do(DoCommandFlags flags, Targs... args)

View File

@@ -484,30 +484,24 @@ typedef std::vector<uint8_t> CommandDataBuffer;
/**
* Define a callback function for the client, after the command is finished.
*
* Functions of this type are called after the command is finished. The parameters
* are from the #CommandProc callback type. The boolean parameter indicates if the
* command succeeded or failed.
* Functions of this type are called after the command is finished.
*
* @param cmd The command that was executed
* @param result The result of the executed command
* @param tile The tile of the command action
* @see CommandProc
*/
typedef void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile);
/**
* Define a callback function for the client, after the command is finished.
*
* Functions of this type are called after the command is finished. The parameters
* are from the #CommandProc callback type. The boolean parameter indicates if the
* command succeeded or failed.
* Functions of this type are called after the command is finished.
*
* @param cmd The command that was executed
* @param result The result of the executed command
* @param tile The tile of the command action
* @param data Additional data of the command
* @param result_data Additional returned data from the command
* @see CommandProc
*/
typedef void CommandCallbackData(Commands cmd, const CommandCost &result, const CommandDataBuffer &data, CommandDataBuffer result_data);