MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / QueryInternal

Function QueryInternal

src/openrct2/actions/GameActionRunner.cpp:165–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 3

QueryFunction · 0.85
QueryNestedFunction · 0.85
ExecuteInternalFunction · 0.85

Calls 9

ArgumentNotNullFunction · 0.85
CheckActionInPausedModeFunction · 0.85
ResultClass · 0.70
FormatterClass · 0.50
GetActionFlagsMethod · 0.45
QueryMethod · 0.45
GetFlagsMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected