Exclude virtual trains from various vehicle list iterations

This commit is contained in:
Jonathan G Rennison
2019-05-27 17:56:41 +01:00
parent 3c2ebc4588
commit 96f000226e
9 changed files with 17 additions and 14 deletions

View File

@@ -1581,7 +1581,7 @@ void NetworkPopulateCompanyStats(NetworkCompanyStats *stats)
/* Go through all vehicles and count the type of vehicles */
FOR_ALL_VEHICLES(v) {
if (!Company::IsValidID(v->owner) || !v->IsPrimaryVehicle()) continue;
if (!Company::IsValidID(v->owner) || !v->IsPrimaryVehicle() || HasBit(v->subtype, GVSF_VIRTUAL)) continue;
byte type = 0;
switch (v->type) {
case VEH_TRAIN: type = NETWORK_VEH_TRAIN; break;
@@ -1669,7 +1669,7 @@ static void NetworkAutoCleanCompanies()
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (!Company::IsValidID(v->owner) || !v->IsPrimaryVehicle()) continue;
if (!Company::IsValidID(v->owner) || !v->IsPrimaryVehicle() || HasBit(v->subtype, GVSF_VIRTUAL)) continue;
vehicles_in_company[v->owner]++;
}
}