|
OpenTTD Source 20251116-master-g21329071df
|
Types related to commands. More...
#include "company_type.h"#include "economy_type.h"#include "strings_type.h"#include "tile_type.h"Go to the source code of this file.
Data Structures | |
| class | CommandCost |
| Common return value for all commands. More... | |
| struct | CommandFunctionTraitHelper< CommandCost(*)(DoCommandFlags, Targs...)> |
| struct | CommandFunctionTraitHelper< Tret< CommandCost, Tretargs... >(*)(DoCommandFlags, Targs...)> |
Macros | |
| #define | DEF_CMD_TRAIT(cmd_, proc_, flags_, type_) |
Typedefs | |
| using | DoCommandFlags = EnumBitSet< DoCommandFlag, uint16_t > |
| using | CommandFlags = EnumBitSet< CommandFlag, uint16_t > |
| typedef std::vector< uint8_t > | CommandDataBuffer |
| Storage buffer for serialized command data. | |
| typedef void | CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile) |
| Define a callback function for the client, after the command is finished. | |
| typedef void | CommandCallbackData(Commands cmd, const CommandCost &result, const CommandDataBuffer &data, CommandDataBuffer result_data) |
| Define a callback function for the client, after the command is finished. | |
Functions | |
| CommandCost | CommandCostWithParam (StringID str, uint64_t value) |
| Return an error status, with string and parameter. | |
| CommandCost | CommandCostWithParam (StringID str, ConvertibleThroughBase auto value) |
Types related to commands.
Definition in file command_type.h.
| #define DEF_CMD_TRAIT | ( | cmd_, | |
| proc_, | |||
| flags_, | |||
| type_ | |||
| ) |
Definition at line 463 of file command_type.h.
| 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.
| cmd | The command that was executed |
| result | The result of the executed command |
| tile | The tile of the command action |
Definition at line 492 of file command_type.h.
| typedef void CommandCallbackData(Commands cmd, const CommandCost &result, const CommandDataBuffer &data, CommandDataBuffer result_data) |
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.
| cmd | The command that was executed |
| result | The result of the executed command |
| tile | The tile of the command action |
| data | Additional data of the command |
| result_data | Additional returned data from the command |
Definition at line 508 of file command_type.h.
| typedef std::vector<uint8_t> CommandDataBuffer |
Storage buffer for serialized command data.
Definition at line 478 of file command_type.h.
| using CommandFlags = EnumBitSet<CommandFlag, uint16_t> |
Definition at line 417 of file command_type.h.
| using DoCommandFlags = EnumBitSet<DoCommandFlag, uint16_t> |
Definition at line 396 of file command_type.h.
|
strong |
Command flags for the command table _command_proc_table.
This enumeration defines flags for the _command_proc_table.
| Enumerator | |
|---|---|
| Server | the command can only be initiated by the server |
| Spectator | the command may be initiated by a spectator |
| Offline | the command cannot be executed in a multiplayer game; single-player only |
| Auto | set the DoCommandFlag::Auto flag on this command |
| AllTiles | allow this command also on MP_VOID tiles |
| NoTest | the command's output may differ between test and execute due to town rating changes etc. |
| NoWater | set the DoCommandFlag::NoWater flag on this command |
| ClientID | set p2 with the ClientID of the sending client. |
| Deity | the command may be executed by COMPANY_DEITY |
| StrCtrl | the command's string may contain control strings |
| NoEst | the command is never estimated. |
| Location | the command has implicit location argument. |
Definition at line 403 of file command_type.h.
|
strong |
Different command pause levels.
Definition at line 436 of file command_type.h.
| enum Commands : uint8_t |
List of commands.
This enum defines all possible commands which can be executed to the game engine. Observing the game like the query-tool or checking the profit of a vehicle don't result in a command which should be executed in the engine nor send to the server in a network game.
Definition at line 196 of file command_type.h.
|
strong |
Types of commands we have.
Definition at line 420 of file command_type.h.
|
strong |
List of flags for a command.
This enums defines some flags which can be used for the commands.
Definition at line 383 of file command_type.h.
| CommandCost CommandCostWithParam | ( | StringID | str, |
| ConvertibleThroughBase auto | value | ||
| ) |
Definition at line 184 of file command_type.h.
| CommandCost CommandCostWithParam | ( | StringID | str, |
| uint64_t | value | ||
| ) |
Return an error status, with string and parameter.
| str | StringID of error. |
| value | Single parameter for error. |
Definition at line 417 of file command.cpp.
References GetEncodedString(), IsLocalCompany(), and CommandCost::SetEncodedMessage().
Referenced by CheckAllowRemoveRoad(), CheckforTownRating(), CheckIfAuthorityAllowsNewStation(), ClearTile_Station(), ClearTile_Town(), CmdBuildAirport(), CmdBuildBridge(), CmdDecreaseLoan(), CmdIncreaseLoan(), DoBuildLock(), CommandHelperBase::InternalExecuteProcessResult(), and IsStationBridgeAboveOk().