|
OpenTTD Source
13.2.1
|
#include "stdafx.h"#include "landscape.h"#include "error.h"#include "gui.h"#include "command_func.h"#include "network/network_type.h"#include "network/network.h"#include "genworld.h"#include "strings_func.h"#include "texteff.hpp"#include "town.h"#include "date_func.h"#include "company_func.h"#include "company_base.h"#include "signal_func.h"#include "core/backup_type.hpp"#include "object_base.h"#include "autoreplace_cmd.h"#include "company_cmd.h"#include "depot_cmd.h"#include "economy_cmd.h"#include "engine_cmd.h"#include "goal_cmd.h"#include "group_cmd.h"#include "industry_cmd.h"#include "league_cmd.h"#include "landscape_cmd.h"#include "misc_cmd.h"#include "news_cmd.h"#include "object_cmd.h"#include "order_cmd.h"#include "rail_cmd.h"#include "road_cmd.h"#include "roadveh_cmd.h"#include "settings_cmd.h"#include "signs_cmd.h"#include "station_cmd.h"#include "story_cmd.h"#include "subsidy_cmd.h"#include "terraform_cmd.h"#include "timetable_cmd.h"#include "town_cmd.h"#include "train_cmd.h"#include "tree_cmd.h"#include "tunnelbridge_cmd.h"#include "vehicle_cmd.h"#include "viewport_cmd.h"#include "water_cmd.h"#include "waypoint_cmd.h"#include "misc/endian_buffer.hpp"#include "string_func.h"#include <array>#include "table/strings.h"#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | CommandInfo |
| Define a command with the flags which belongs to it. More... | |
Functions | |
| template<typename T > | |
| constexpr CommandInfo | CommandFromTrait () noexcept |
| template<typename T , T... i> | |
| constexpr auto | MakeCommandsFromTraits (std::integer_sequence< T, i... >) noexcept |
| bool | IsValidCommand (Commands cmd) |
| CommandFlags | GetCommandFlags (Commands cmd) |
| const char * | GetCommandName (Commands cmd) |
| bool | IsCommandAllowedWhilePaused (Commands cmd) |
| Returns whether the command is allowed while the game is paused. More... | |
| Money | GetAvailableMoneyForCommand () |
Variables | |
| static constexpr auto | _command_proc_table = MakeCommandsFromTraits(std::make_integer_sequence<std::underlying_type_t<Commands>, CMD_END>{}) |
| The master command table. More... | |
Handling of commands.
Definition in file command.cpp.
| Money GetAvailableMoneyForCommand | ( | ) |
This functions returns the money which can be used to execute a command. This is either the money of the current company or INT64_MAX if there is no such a company "at the moment" like the server itself.
Definition at line 173 of file command.cpp.
References _current_company, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID().
Referenced by CmdBuildObjectArea(), CmdClearArea(), CmdLevelLand(), and CmdRemoveLongRoad().
| CommandFlags GetCommandFlags | ( | Commands | cmd | ) |
This function mask the parameter with CMD_ID_MASK and returns the flags which belongs to the given command.
| cmd | The integer value of the command |
Definition at line 120 of file command.cpp.
References _command_proc_table, and IsValidCommand().
| const char* GetCommandName | ( | Commands | cmd | ) |
This function mask the parameter with CMD_ID_MASK and returns the name which belongs to the given command.
| cmd | The integer value of the command |
Definition at line 134 of file command.cpp.
References _command_proc_table, and IsValidCommand().
Referenced by CommandHelperBase::LogCommandExecution(), and ServerNetworkAdminSocketHandler::SendCmdNames().
| bool IsCommandAllowedWhilePaused | ( | Commands | cmd | ) |
Returns whether the command is allowed while the game is paused.
| cmd | The command to check. |
< CMDT_LANDSCAPE_CONSTRUCTION
< CMDT_VEHICLE_CONSTRUCTION
< CMDT_MONEY_MANAGEMENT
< CMDT_VEHICLE_MANAGEMENT
< CMDT_ROUTE_MANAGEMENT
< CMDT_OTHER_MANAGEMENT
< CMDT_COMPANY_SETTING
< CMDT_SERVER_SETTING
< CMDT_CHEAT
Definition at line 146 of file command.cpp.
References CMDPL_ALL_ACTIONS, CMDPL_NO_ACTIONS, CMDPL_NO_CONSTRUCTION, CMDPL_NO_LANDSCAPING, CMDT_END, IsValidCommand(), and lengthof.
Referenced by CommandHelperBase::InternalPostBefore(), CommandQueue::Peek(), and CommandQueue::Pop().
| bool IsValidCommand | ( | Commands | cmd | ) |
This function range-checks a cmd.
| cmd | The integer value of a command |
Definition at line 108 of file command.cpp.
References _command_proc_table.
Referenced by GetCommandFlags(), GetCommandName(), and IsCommandAllowedWhilePaused().
|
staticconstexpr |
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.
Definition at line 99 of file command.cpp.
Referenced by GetCommandFlags(), GetCommandName(), and IsValidCommand().