1
0
Fork 0

Codechange: Iterate group vehicle lists for UpdateCompanyRatingAndValue

pull/10548/head
SamuXarick 2023-12-28 20:07:05 +00:00
parent fc7fd4655c
commit 71e96fd8a6
1 changed files with 3 additions and 3 deletions

View File

@ -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 */