summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorunknown <kruijsse@usc.edu>2019-06-05 07:32:32 -0700
committerCharles Pigott <charlespigott@googlemail.com>2019-07-07 16:02:11 +0100
commit6f28a0c0510246e384b557afee98bf868bed9373 (patch)
tree78348315b00d52b6a03464096dfe501c09919ef9 /src/script
parent81614f2378ec959312a71d49da1747c595b739c3 (diff)
downloadopenttd-6f28a0c0510246e384b557afee98bf868bed9373.tar.xz
Fix #5685: Check for free wagons in ScriptVehicleList
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/script_vehiclelist.cpp3
1 files changed, 2 insertions, 1 deletions
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);
}
}