forked from mirror/OpenTTD
Add: [Script] Optional filter parameter to ScriptVehicleList constructor (#11663)
This commit is contained in:
@@ -1814,10 +1814,17 @@ function Regression::Vehicle()
|
||||
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
|
||||
|
||||
local list = AIVehicleList();
|
||||
local in_depot = AIVehicleList(AIVehicle.IsInDepot);
|
||||
local IsType = function(vehicle_id, type) {
|
||||
return AIVehicle.GetVehicleType(vehicle_id) == type;
|
||||
}
|
||||
local rv_list = AIVehicleList(IsType, AIVehicle.VT_ROAD);
|
||||
|
||||
print("");
|
||||
print("--VehicleList--");
|
||||
print(" Count(): " + list.Count());
|
||||
print(" InDepot Count(): " + in_depot.Count());
|
||||
print(" RoadVehicle Count(): " + rv_list.Count());
|
||||
list.Valuate(AIVehicle.GetLocation);
|
||||
print(" Location ListDump:");
|
||||
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||
|
@@ -9391,6 +9391,8 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
|
||||
--VehicleList--
|
||||
Count(): 5
|
||||
InDepot Count(): 4
|
||||
RoadVehicle Count(): 2
|
||||
Location ListDump:
|
||||
13 => 33417
|
||||
12 => 33417
|
||||
|
Reference in New Issue
Block a user