From 71e96fd8a61641287c2ca0a1234b7fbfb2dd6561 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Thu, 28 Dec 2023 20:07:05 +0000 Subject: [PATCH] Codechange: Iterate group vehicle lists for UpdateCompanyRatingAndValue --- src/economy.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index ddd2cf9e4c..d2d2737585 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -210,9 +210,9 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) bool min_profit_first = true; uint num = 0; - for (const Vehicle *v : Vehicle::Iterate()) { - if (v->owner != owner) continue; - if (IsCompanyBuildableVehicleType(v->type) && v->IsPrimaryVehicle()) { + for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) { + const VehicleList &vehicle_list = c->group_all[type].vehicle_list; + for (const Vehicle *v : vehicle_list) { if (v->profit_last_year > 0) num++; // For the vehicle score only count profitable vehicles if (v->age > 730) { /* Find the vehicle with the lowest amount of profit */