From 34d7f12a70791018e9563af16ef31edbc3029f0f Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 16 May 2019 20:04:48 +0100 Subject: [PATCH] TBTR: Skip virtual vehicles in company rating/value and group stats --- src/economy.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index cbb881a960..046c5f3b4a 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -130,6 +130,7 @@ Money CalculateCompanyValue(const Company *c, bool including_loan) Vehicle *v; FOR_ALL_VEHICLES(v) { if (v->owner != owner) continue; + if (HasBit(v->subtype, GVSF_VIRTUAL)) continue; if (v->type == VEH_TRAIN || v->type == VEH_ROAD || @@ -170,7 +171,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) FOR_ALL_VEHICLES(v) { if (v->owner != owner) continue; - if (IsCompanyBuildableVehicleType(v->type) && v->IsPrimaryVehicle()) { + if (IsCompanyBuildableVehicleType(v->type) && v->IsPrimaryVehicle() && !HasBit(v->subtype, GVSF_VIRTUAL)) { 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 */ @@ -483,7 +484,7 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner) if (v->IsEngineCountable()) { GroupStatistics::CountEngine(v, 1); } - if (v->IsPrimaryVehicle()) { + if (v->IsPrimaryVehicle() && !HasBit(v->subtype, GVSF_VIRTUAL)) { GroupStatistics::CountVehicle(v, 1); v->unitnumber = unitidgen[v->type].NextID(); }