* Returns whether the command is allowed while the game is paused. * @param cmd The command to check. * @return True if the command is allowed while paused, false otherwise. */
| 142 | * @return True if the command is allowed while paused, false otherwise. |
| 143 | */ |
| 144 | bool IsCommandAllowedWhilePaused(Commands cmd) |
| 145 | { |
| 146 | /* Lookup table for the command types that are allowed for a given pause level setting. */ |
| 147 | static constexpr CommandPauseLevel command_type_lookup[] = { |
| 148 | CommandPauseLevel::AllActions, // CommandType::LandscapeConstruction |
| 149 | CommandPauseLevel::NoLandscaping, // CommandType::VehicleConstruction |
| 150 | CommandPauseLevel::NoLandscaping, // CommandType::MoneyManagement |
| 151 | CommandPauseLevel::NoConstruction, // CommandType::VehicleManagement |
| 152 | CommandPauseLevel::NoConstruction, // CommandType::RouteManagement |
| 153 | CommandPauseLevel::NoConstruction, // CommandType::OtherManagement |
| 154 | CommandPauseLevel::NoActions, // CommandType::CompanySetting |
| 155 | CommandPauseLevel::NoActions, // CommandType::ServerSetting |
| 156 | CommandPauseLevel::NoActions, // CommandType::Cheat |
| 157 | }; |
| 158 | static_assert(std::size(command_type_lookup) == to_underlying(CommandType::End)); |
| 159 | |
| 160 | assert(IsValidCommand(cmd)); |
| 161 | return _game_mode == GM_EDITOR || command_type_lookup[to_underlying(_command_proc_table[cmd].type)] <= _settings_game.construction.command_pause_level; |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Prepare for calling a command proc. |
no test coverage detected