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

Function doCommand

src/OpenLoco/src/GameCommands/GameCommands.cpp:239–269  ·  view source on GitHub ↗

0x00431315

Source from the content-addressed store, hash-verified

237
238 // 0x00431315
239 uint32_t doCommand(GameCommand command, const registers& regs)
240 {
241 uint16_t flags = regs.bx;
242 uint32_t esi = static_cast<uint32_t>(command);
243
244 _gameCommandFlags = regs.bx;
245 if (_gameCommandNestLevel != 0)
246 {
247 return loc_4313C6(esi, regs);
248 }
249
250 if ((flags & Flags::apply) == 0)
251 {
252 return loc_4313C6(esi, regs);
253 }
254
255 auto isGhost = (flags & Flags::ghost) != 0;
256 if (!isGhost && Network::isConnected())
257 {
258 // For network games, we need to delay the command apply processing
259 // Just return the result without applying for now
260 registers copyRegs = regs;
261 copyRegs.esi = static_cast<int32_t>(command);
262 Network::queueGameCommand(_updatingCompanyId, copyRegs);
263
264 copyRegs.bx &= ~Flags::apply;
265 return loc_4313C6(esi, copyRegs);
266 }
267
268 return doCommandForReal(command, _updatingCompanyId, regs);
269 }
270
271 uint32_t doCommandForReal(GameCommand command, CompanyId company, const registers& regs)
272 {

Callers 15

loadGameFunction · 0.50
confirmSaveGameFunction · 0.50
handleInputFunction · 0.50
updateMonthlyMethod · 0.50
expandGroundsMethod · 0.50
stopAllCompanyVehiclesFunction · 0.50
updateLoanAutorepayMethod · 0.50
addRoadJunctionFunction · 0.50
placeRoadBridgeFunction · 0.50
appendToRoadEndFunction · 0.50
constructBuildingFunction · 0.50
buildInitialRoadFunction · 0.50

Calls 4

loc_4313C6Function · 0.85
isConnectedFunction · 0.85
queueGameCommandFunction · 0.85
doCommandForRealFunction · 0.85

Tested by

no test coverage detected