OpenTTD Source 20241224-master-gf74b0cf984
|
Static Protected Member Functions | |
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. | |
Definition at line 85 of file command_func.h.
|
staticprotected |
Process result after calling a command proc.
[in,out] | res | Command result, may be modified. |
flags | Command flags. | |
top_level | Top level of command execution, i.e. command from a command. | |
test | Test run of command? |
Definition at line 182 of file command.cpp.
References CheckCompanyHasMoney(), DC_BANKRUPT, DC_QUERY_COST, SetTownRatingTestMode(), SubtractMoneyFromCompany(), and CommandCost::Succeeded().
|
staticprotected |
Prepare for calling a command proc.
top_level | Top level of command execution, i.e. command from a command. |
test | Test run of command? |
Definition at line 169 of file command.cpp.
References SetTownRatingTestMode().
|
staticprotected |
Prepare for the test run of a command proc call.
cmd_flags | Command flags. | |
[in,out] | cur_company | Backup of current company at start of command execution. |
Definition at line 271 of file command.cpp.
References _current_company, Backup< T >::Change(), CMD_DEITY, CMD_SERVER, CMD_SPECTATOR, COMPANY_SPECTATOR, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), OWNER_DEITY, PSM_ENTER_TESTMODE, SetTownRatingTestMode(), and BasePersistentStorageArray::SwitchMode().
|
staticprotected |
Process the result of a command test run and execution run.
cmd | Command that was executed. | |
cmd_flags | Command flags. | |
res_test | Command result of test run. | |
tes_exec | Command result of real run. | |
extra_cash | Additional cash required for successful command execution. | |
tile | Tile of command execution. | |
[in,out] | cur_company | Backup of current company at start of command execution. |
Definition at line 341 of file command.cpp.
References _command_proc_table, _current_company, _local_company, _pause_mode, CMD_COMPANY_CTRL, CMD_NO_TEST, CMD_SERVER, CMD_SPECTATOR, CMDT_SERVER_SETTING, COMPANY_SPECTATOR, CommandCost::Failed(), CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), CompanyProperties::last_build_coordinate, PM_COMMAND_DURING_PAUSE, PM_UNPAUSED, PSM_LEAVE_COMMAND, Backup< T >::Restore(), SetDParam(), SubtractMoneyFromCompany(), BasePersistentStorageArray::SwitchMode(), Backup< T >::Trash(), UpdateSignalsInBuffer(), and Backup< T >::Verify().
|
staticprotected |
Validate result of test run and prepare for real execution.
cmd_flags | Command flags. | |
[in,out] | res | Command result of test run, may be modified. |
estimate_only | Is this just cost estimation? | |
network_command | Does this command come from the network? | |
[in,out] | cur_company | Backup of current company at start of command execution. |
Definition at line 301 of file command.cpp.
References _current_company, _generating_world, _networking, CheckCompanyHasMoney(), CMD_NO_TEST, CMD_SERVER, CMD_SPECTATOR, COMPANY_SPECTATOR, CommandCost::Failed(), PSM_ENTER_COMMAND, PSM_LEAVE_TESTMODE, SetTownRatingTestMode(), and BasePersistentStorageArray::SwitchMode().
|
staticprotected |
Decide what to do with the command depending on current game state.
cmd | Command to execute. |
flags | Command flags. |
tile | Tile of command execution. |
err_message | Message prefix to show on error. |
network_command | Does this command come from the network? |
Definition at line 207 of file command.cpp.
References _generating_world, _networking, _pause_mode, _shift_pressed, CMD_NO_EST, IsCommandAllowedWhilePaused(), IsLocalCompany(), PM_UNPAUSED, ShowErrorMessage(), TILE_SIZE, TileX(), TileY(), and WL_INFO.
|
staticprotected |
Process result of executing a command, possibly displaying any error to the player.
res | Command result. |
tile | Tile of command execution. |
estimate_only | Is this just cost estimation? |
only_sending | Was the command only sent to network? |
err_message | Message prefix to show on error. |
my_cmd | Is the command from this client? |
Definition at line 237 of file command.cpp.
References CommandCost::Failed(), CommandCost::GetCost(), GetSlopePixelZ(), IsLocalCompany(), ShowCostOrIncomeAnimation(), ShowErrorMessage(), ShowEstimatedCostOrIncome(), TILE_SIZE, TileX(), and TileY().
|
staticprotected |
Helper to make a desync log for a command.
Definition at line 260 of file command.cpp.
References _current_company, TimerGameEconomy::date, TimerGameEconomy::date_fract, Debug, FormatArrayAsHex(), and GetCommandName().