From 79588cbfe3af4a64f47c6d364e7d966bdfb4a749 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 29 Jan 2026 22:23:07 +0100 Subject: [PATCH] Codefix: CommandProc does not exist, so remove any references --- src/command.cpp | 37 +++++++++++++++---------------------- src/command_func.h | 3 +-- src/command_type.h | 10 ++-------- 3 files changed, 18 insertions(+), 32 deletions(-) diff --git a/src/command.cpp b/src/command.cpp index 6f57c59aa4..b008adf1e6 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -88,52 +88,45 @@ inline constexpr auto MakeCommandsFromTraits(std::integer_sequence) 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, to_underlying(Commands::End)>{}); +static constexpr auto _command_table = MakeCommandsFromTraits(std::make_integer_sequence, 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(); diff --git a/src/command_func.h b/src/command_func.h index fcf11d6d7b..71c321b4aa 100644 --- a/src/command_func.h +++ b/src/command_func.h @@ -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) diff --git a/src/command_type.h b/src/command_type.h index 8a2648cfbc..0fa2a313c3 100644 --- a/src/command_type.h +++ b/src/command_type.h @@ -484,30 +484,24 @@ typedef std::vector 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);