From 6f28a0c0510246e384b557afee98bf868bed9373 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Jun 2019 07:32:32 -0700 Subject: Fix #5685: Check for free wagons in ScriptVehicleList --- src/script/api/script_vehiclelist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/script') diff --git a/src/script/api/script_vehiclelist.cpp b/src/script/api/script_vehiclelist.cpp index 48b290cae..5534f6f8a 100644 --- a/src/script/api/script_vehiclelist.cpp +++ b/src/script/api/script_vehiclelist.cpp @@ -16,6 +16,7 @@ #include "script_station.hpp" #include "../../depot_map.h" #include "../../vehicle_base.h" +#include "../../train.h" #include "../../safeguards.h" @@ -23,7 +24,7 @@ ScriptVehicleList::ScriptVehicleList() { const Vehicle *v; FOR_ALL_VEHICLES(v) { - if ((v->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY) && v->IsPrimaryVehicle()) this->AddItem(v->index); + if ((v->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY) && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::Train::From(v)->IsFreeWagon()))) this->AddItem(v->index); } } -- cgit v1.2.3-70-g09d2