mirror of https://github.com/OpenTTD/OpenTTD.git
Fix #5685: Check for free wagons in ScriptVehicleList
This commit is contained in:
parent
81614f2378
commit
6f28a0c051
|
@ -16,6 +16,7 @@
|
||||||
#include "script_station.hpp"
|
#include "script_station.hpp"
|
||||||
#include "../../depot_map.h"
|
#include "../../depot_map.h"
|
||||||
#include "../../vehicle_base.h"
|
#include "../../vehicle_base.h"
|
||||||
|
#include "../../train.h"
|
||||||
|
|
||||||
#include "../../safeguards.h"
|
#include "../../safeguards.h"
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ ScriptVehicleList::ScriptVehicleList()
|
||||||
{
|
{
|
||||||
const Vehicle *v;
|
const Vehicle *v;
|
||||||
FOR_ALL_VEHICLES(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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue