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

@@ -194,7 +194,7 @@ static void FixAllReservations()
assert(!_settings_game.economy.infrastructure_sharing[VEH_TRAIN]);
Train *v;
FOR_ALL_TRAINS(v) {
if (!v->IsPrimaryVehicle() || (v->vehstatus & VS_CRASHED) != 0) continue;
if (!v->IsPrimaryVehicle() || (v->vehstatus & VS_CRASHED) != 0 || HasBit(v->subtype, GVSF_VIRTUAL)) continue;
/* It might happen that the train reserved additional tracks,
* but FollowTrainReservation can't detect those because they are no longer reachable.
* detect this by first finding the end of the reservation,
@@ -237,7 +237,7 @@ bool CheckSharingChangePossible(VehicleType type)
StringID error_message = STR_NULL;
Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (type != v->type) continue;
if (type != v->type || HasBit(v->subtype, GVSF_VIRTUAL)) continue;
if (v->Previous() != nullptr) continue;
/* Check vehicle positiion */