0x004383ED
| 994 | |
| 995 | // 0x004383ED |
| 996 | void updateOwnerStatus() |
| 997 | { |
| 998 | if (SceneManager::isTitleMode() || SceneManager::isEditorMode()) |
| 999 | { |
| 1000 | return; |
| 1001 | } |
| 1002 | |
| 1003 | auto companyId = GameCommands::getUpdatingCompanyId(); |
| 1004 | auto company = CompanyManager::get(companyId); |
| 1005 | if (company == nullptr) |
| 1006 | { |
| 1007 | return; |
| 1008 | } |
| 1009 | |
| 1010 | company->updateCounter += 1; |
| 1011 | if ((company->updateCounter % 128) != 0) |
| 1012 | { |
| 1013 | return; |
| 1014 | } |
| 1015 | |
| 1016 | for (size_t i = 0; i < WindowManager::count(); i++) |
| 1017 | { |
| 1018 | auto w = WindowManager::get(i); |
| 1019 | |
| 1020 | if (w->type != WindowType::vehicle) |
| 1021 | { |
| 1022 | continue; |
| 1023 | } |
| 1024 | |
| 1025 | auto* vehicle = EntityManager::get<Vehicles::VehicleBase>(EntityId(w->number)); |
| 1026 | if (vehicle == nullptr) |
| 1027 | { |
| 1028 | continue; |
| 1029 | } |
| 1030 | |
| 1031 | if (vehicle->position.x == Location::null) |
| 1032 | { |
| 1033 | continue; |
| 1034 | } |
| 1035 | |
| 1036 | if (vehicle->owner != companyId) |
| 1037 | { |
| 1038 | continue; |
| 1039 | } |
| 1040 | |
| 1041 | GameCommands::UpdateOwnerStatusArgs args{}; |
| 1042 | args.ownerStatus = OwnerStatus(vehicle->id); |
| 1043 | |
| 1044 | GameCommands::doCommand(args, GameCommands::Flags::apply); |
| 1045 | return; |
| 1046 | } |
| 1047 | |
| 1048 | auto main = WindowManager::getMainWindow(); |
| 1049 | if (main == nullptr) |
| 1050 | { |
| 1051 | return; |
| 1052 | } |
| 1053 |
no test coverage detected