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

Function stopAllCompanyVehicles

src/OpenLoco/src/World/Company.cpp:612–636  ·  view source on GitHub ↗

0x004389CC

Source from the content-addressed store, hash-verified

610
611 // 0x004389CC
612 static void stopAllCompanyVehicles(const CompanyId companyId)
613 {
614 const auto prevUpdateCompany = GameCommands::getUpdatingCompanyId();
615 GameCommands::setUpdatingCompanyId(companyId);
616
617 for (auto head : VehicleManager::VehicleList())
618 {
619 if (head->owner != companyId)
620 {
621 continue;
622 }
623
624 if (head->has38Flags(Vehicles::Flags38::isGhost))
625 {
626 continue;
627 }
628 GameCommands::VehicleChangeRunningModeArgs args{};
629 args.head = head->id;
630 args.mode = GameCommands::VehicleChangeRunningModeArgs::Mode::stopVehicle;
631 // This used to call the command directly
632 GameCommands::doCommand(args, GameCommands::Flags::apply);
633 }
634
635 GameCommands::setUpdatingCompanyId(prevUpdateCompany);
636 }
637
638 void Company::updateMonthly1()
639 {

Callers 1

updateMonthly1Method · 0.85

Calls 4

getUpdatingCompanyIdFunction · 0.85
setUpdatingCompanyIdFunction · 0.85
has38FlagsMethod · 0.80
doCommandFunction · 0.50

Tested by

no test coverage detected