MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / doCommandForReal

Function doCommandForReal

src/OpenLoco/src/GameCommands/GameCommands.cpp:271–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269 }
270
271 uint32_t doCommandForReal(GameCommand command, CompanyId company, const registers& regs)
272 {
273 _updatingCompanyId = company;
274
275 uint16_t flags = regs.bx;
276 uint32_t esi = static_cast<uint32_t>(command);
277
278 if (commandRequiresUnpausingGame(command, flags) && _updatingCompanyId == CompanyManager::getControllingId())
279 {
280 if ((SceneManager::getPauseFlags() & PauseFlags::player) != PauseFlags::none)
281 {
282 SceneManager::unsetPauseFlag(PauseFlags::player);
283 Ui::Windows::PlayerInfoPanel::invalidateFrame();
284 }
285
286 if (SceneManager::getGameSpeed() != GameSpeed::Normal)
287 {
288 // calling the command setGameSpeed will cause infinite recursion here, so just call the real function
289 SceneManager::setGameSpeed(GameSpeed::Normal);
290 }
291
292 if (SceneManager::isPaused())
293 {
294 _gGameCommandErrorText = StringIds::empty;
295 return GameCommands::kFailure;
296 }
297 }
298
299 if (_updatingCompanyId == CompanyManager::getControllingId() && SceneManager::isNetworked())
300 {
301 // assert(false);
302 // registers fnRegs = regs;
303 // call(0x0046E34A, fnRegs); // some network stuff. Untested
304 }
305
306 return loc_4313C6(esi, regs);
307 }
308
309 static void callGameCommandFunction(uint32_t command, registers& regs)
310 {

Callers 3

runGameCommandsMethod · 0.85
doCommandFunction · 0.85

Calls 10

getControllingIdFunction · 0.85
getPauseFlagsFunction · 0.85
unsetPauseFlagFunction · 0.85
getGameSpeedFunction · 0.85
isNetworkedFunction · 0.85
loc_4313C6Function · 0.85
invalidateFrameFunction · 0.50
setGameSpeedFunction · 0.50
isPausedFunction · 0.50

Tested by

no test coverage detected