| 163 | } |
| 164 | |
| 165 | static Result QueryInternal(const GameAction* action, GameState_t& gameState, bool topLevel) |
| 166 | { |
| 167 | Guard::ArgumentNotNull(action); |
| 168 | |
| 169 | uint16_t actionFlags = action->GetActionFlags(); |
| 170 | if (topLevel && !CheckActionInPausedMode(gameState, actionFlags)) |
| 171 | { |
| 172 | Result result = Result(); |
| 173 | |
| 174 | result.error = Status::gamePaused; |
| 175 | result.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; |
| 176 | result.errorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; |
| 177 | |
| 178 | return result; |
| 179 | } |
| 180 | |
| 181 | // TODO: pass different park based on player |
| 182 | auto& park = gameState.park; |
| 183 | |
| 184 | auto result = action->Query(gameState, park); |
| 185 | if (result.error == Status::ok) |
| 186 | { |
| 187 | if (!FinanceCheckAffordability(result.cost, action->GetFlags())) |
| 188 | { |
| 189 | result.error = Status::insufficientFunds; |
| 190 | result.errorTitle = STR_CANT_DO_THIS; |
| 191 | result.errorMessage = STR_NOT_ENOUGH_CASH_REQUIRES; |
| 192 | Formatter(result.errorMessageArgs.data()).Add<uint32_t>(result.cost); |
| 193 | } |
| 194 | } |
| 195 | return result; |
| 196 | } |
| 197 | |
| 198 | Result Query(const GameAction* action, GameState_t& gameState) |
| 199 | { |
no test coverage detected