mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Iterate group vehicle lists for UpdateCompanyRatingAndValue
parent
fc7fd4655c
commit
71e96fd8a6
|
@ -210,9 +210,9 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
|
||||||
bool min_profit_first = true;
|
bool min_profit_first = true;
|
||||||
uint num = 0;
|
uint num = 0;
|
||||||
|
|
||||||
for (const Vehicle *v : Vehicle::Iterate()) {
|
for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) {
|
||||||
if (v->owner != owner) continue;
|
const VehicleList &vehicle_list = c->group_all[type].vehicle_list;
|
||||||
if (IsCompanyBuildableVehicleType(v->type) && v->IsPrimaryVehicle()) {
|
for (const Vehicle *v : vehicle_list) {
|
||||||
if (v->profit_last_year > 0) num++; // For the vehicle score only count profitable vehicles
|
if (v->profit_last_year > 0) num++; // For the vehicle score only count profitable vehicles
|
||||||
if (v->age > 730) {
|
if (v->age > 730) {
|
||||||
/* Find the vehicle with the lowest amount of profit */
|
/* Find the vehicle with the lowest amount of profit */
|
||||||
|
|
Loading…
Reference in New Issue