Fix DeleteVisibleTrain being called on virtual trains

Add assertion to check for this case
This commit is contained in:
Jonathan G Rennison
2017-12-31 14:29:15 +00:00
parent 1c04653518
commit 4b392b66db
3 changed files with 4 additions and 2 deletions

View File

@@ -175,7 +175,7 @@ static void RemoveAndSellVehicle(Vehicle *v, bool give_money)
}
/* take special measures for trains, but not when sharing is disabled or when the train is a free wagon chain */
if (_settings_game.economy.infrastructure_sharing[VEH_TRAIN] && v->type == VEH_TRAIN && Train::From(v)->IsFrontEngine()) {
if (_settings_game.economy.infrastructure_sharing[VEH_TRAIN] && v->type == VEH_TRAIN && Train::From(v)->IsFrontEngine() && !Train::From(v)->IsVirtual()) {
DeleteVisibleTrain(Train::From(v));
} else {
delete v;