OpenTTD Source: CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), false > Struct Template Reference

OpenTTD Source 15.0-beta1

Static Public Member Functions
CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), false > Struct Template Reference

Overload for CommandHelper that exposes additional `Post` variants for commands that don't take a TileIndex themselves. More...

`#include <command_func.h>`

Inheritance diagram for CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), false >:

## Static Public Member Functions
static bool | Post (StringID err_message, Targs... args)=delete
template<typename Tcallback >
static bool | Post (Tcallback *callback, Targs... args)=delete
static bool | Post (Targs... args)=delete
template<typename Tcallback >
static bool | Post (StringID err_message, Tcallback *callback, Targs... args)=delete
static bool | Post (StringID err_message, TileIndex location, Targs... args)
| Shortcut for Post when not using a callback.
template<typename Tcallback >
static bool | Post (Tcallback *callback, TileIndex location, Targs... args)
| Shortcut for Post when not using an error message.
static bool | Post (TileIndex location, Targs... args)
| Shortcut for Post when not using a callback or an error message.
template<typename Tcallback >
static bool | Post (StringID err_message, Tcallback *callback, TileIndex location, Targs... args)
| Post variant that takes a TileIndex (for error window location and text effects) for commands that don't take a TileIndex by themselves.
Static Public Member Functions inherited from CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), true >
static Tret | Do (DoCommandFlag flags, Targs... args)
| This function executes a given command with the parameters from the #CommandProc parameter list.
static bool | Post (StringID err_message, Targs... args)
| Shortcut for the long Post when not using a callback.
template<typename Tcallback >
static bool | Post (Tcallback *callback, Targs... args)
| Shortcut for the long Post when not using an error message.
static bool | Post (Targs... args)
| Shortcut for the long Post when not using a callback or an error message.
template<typename Tcallback >
static bool | Post (StringID err_message, Tcallback *callback, Targs... args)
| Top-level network safe command execution for the current company.
template<typename Tcallback >
static bool | PostFromNet (StringID err_message, Tcallback *callback, bool my_cmd, std::tuple< Targs... > args)
| Execute a command coming from the network.
static void | SendNet (StringID err_message, CompanyID company, Targs... args)
| Prepare a command to be send over the network.
template<typename Tcallback >
static Tret | Unsafe (StringID err_message, Tcallback *callback, bool my_cmd, bool estimate_only, TileIndex location, std::tuple< Targs... > args)
| Top-level network safe command execution without safety checks.

## Additional Inherited Members
Static Protected Member Functions inherited from CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), true >
template<class T >
static void | SetClientIdHelper (T &data)
| Helper to process a single ClientID argument.
template<class Ttuple , size_t... Tindices>
static void | SetClientIds (Ttuple &values, std::index_sequence< Tindices... >)
| Set all invalid ClientID's to the proper value.
template<template< typename... > typename Tt, typename T1 , typename... Ts>
static Tt< Ts... > | RemoveFirstTupleElement (const Tt< T1, Ts... > &tuple)
| Remove the first element of a tuple.
template<typename Tcallback >
static bool | InternalPost (StringID err_message, Tcallback *callback, bool my_cmd, bool network_command, std::tuple< Targs... > args)
template<typename Tcallback >
static bool | InternalPost (StringID err_message, Tcallback *callback, bool my_cmd, bool network_command, TileIndex tile, std::tuple< Targs... > args)
template<class T >
static bool | ClientIdIsSet (T &data)
| Helper to process a single ClientID argument.
template<class Ttuple , size_t... Tindices>
static bool | AllClientIdsSet (Ttuple &values, std::index_sequence< Tindices... >)
| Check if all ClientID arguments are set to valid values.
template<class Ttuple >
static Money | ExtractAdditionalMoney (Ttuple &values)
static Tret | Execute (StringID err_message, CommandCallback *callback, bool, bool estimate_only, bool network_command, TileIndex tile, std::tuple< Targs... > args)
Static Protected Member Functions inherited from CommandHelperBase
static void | InternalDoBefore (bool top_level, bool test)
| Prepare for calling a command proc.
static void | InternalDoAfter (CommandCost &res, DoCommandFlag flags, bool top_level, bool test)
| Process result after calling a command proc.
static std::tuple< bool, bool, bool > | InternalPostBefore (Commands cmd, CommandFlags flags, TileIndex tile, StringID err_message, bool network_command)
| Decide what to do with the command depending on current game state.
static void | InternalPostResult (const CommandCost &res, TileIndex tile, bool estimate_only, bool only_sending, StringID err_message, bool my_cmd)
| Process result of executing a command, possibly displaying any error to the player.
static bool | InternalExecutePrepTest (CommandFlags cmd_flags, TileIndex tile, Backup< CompanyID > &cur_company)
| Prepare for the test run of a command proc call.
static std::tuple< bool, bool, bool > | InternalExecuteValidateTestAndPrepExec (CommandCost &res, CommandFlags cmd_flags, bool estimate_only, bool network_command, Backup< CompanyID > &cur_company)
| Validate result of test run and prepare for real execution.
static CommandCost | InternalExecuteProcessResult (Commands cmd, CommandFlags cmd_flags, const CommandCost &res_test, const CommandCost &res_exec, Money extra_cash, TileIndex tile, Backup< CompanyID > &cur_company)
| Process the result of a command test run and execution run.
static void | LogCommandExecution (Commands cmd, StringID err_message, const CommandDataBuffer &args, bool failed)
| Helper to make a desync log for a command.

## Detailed Description

template<Commands Tcmd, typename Tret, typename... Targs>
struct CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), false >

Overload for CommandHelper that exposes additional `Post` variants for commands that don't take a TileIndex themselves.

Template Parameters

  Tcmd | The command-id to execute.
  Tret | Return type of the command.
  Targs | The command parameter types.

Definition at line 424 of file command_func.h.

## Member Function Documentation

## ◆ Post() [1/4]

template<Commands Tcmd, typename Tret , typename... Targs>
template<typename Tcallback >

static bool CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), false >::Post | ( | StringID | err_message,
|  | Tcallback * | callback,
|  | TileIndex | location,
|  | Targs... | args
| ) |  |
| inlinestatic

Post variant that takes a TileIndex (for error window location and text effects) for commands that don't take a TileIndex by themselves.

Parameters

  err_message | Message prefix to show on error
  callback | A callback function to call after the command is finished
  args | Parameters for the command

Returns
  `true` if the command succeeded, else `false`.

Definition at line 465 of file command_func.h.

## ◆ Post() [2/4]

template<Commands Tcmd, typename Tret , typename... Targs>

static bool CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), false >::Post | ( | StringID | err_message,
|  | TileIndex | location,
|  | Targs... | args
| ) |  |
| inlinestatic

Shortcut for Post when not using a callback.

Parameters

  err_message | Message prefix to show on error
  location | Tile location for user feedback.
  args | Parameters for the command

Definition at line 440 of file command_func.h.

## ◆ Post() [3/4]

template<Commands Tcmd, typename Tret , typename... Targs>
template<typename Tcallback >

static bool CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), false >::Post | ( | Tcallback * | callback,
|  | TileIndex | location,
|  | Targs... | args
| ) |  |
| inlinestatic

Shortcut for Post when not using an error message.

Parameters

  callback | A callback function to call after the command is finished
  location | Tile location for user feedback.
  args | Parameters for the command

Definition at line 448 of file command_func.h.

References Post().

Referenced by Post().

## ◆ Post() [4/4]

template<Commands Tcmd, typename Tret , typename... Targs>

static bool CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), false >::Post | ( | TileIndex | location,
|  | Targs... | args
| ) |  |
| inlinestatic

Shortcut for Post when not using a callback or an error message.

Parameters

  location | Tile location for user feedback.
  args | Parameters for the command*

Definition at line 454 of file command_func.h.

The documentation for this struct was generated from the following file:

- src/command_func.h