@@ -1349,24 +1349,39 @@ function Regression::Station()
AIStation.GetCargoPlannedFrom(station0, station1, cargo));
print(" GetCargoPlannedVia(" + station0 + ", " + station1 + ", " + cargo + "): " +
for (local station2 = 0; station2 <= 1000; station2 += 1000) {
print(" GetCargoPlannedFromVia(" + station0 + ", " + station1 + ", " + station2 + ", " + cargo + "): " +
AIStation.GetCargoPlannedFromVia(station0, station1, station2, cargo));
}
function Regression::StationList()
{
print("");
print("--StationList--");
local road_stations = AIStationList(AIStation.STATION_TRUCK_STOP);
for (local st = road_stations.Begin(); !road_stations.IsEnd(); st = road_stations.Next()) {
print(" GetName(): " + AIStation.GetName(st));
print(" TileList_StationCoverage:");
local coverage = AITileList_StationCoverage(st);
for (local i = coverage.Begin(); !coverage.IsEnd(); i = coverage.Next()) {
print(" " + i);
function Regression::Tile()
print("--Tile--");
print(" HasTreeOnTile(): " + AITile.HasTreeOnTile(33148));
print(" IsFarmTile(): " + AITile.IsFarmTile(32892));
print(" IsRockTile(): " + AITile.IsRockTile(31606));
print(" IsRoughTile(): " + AITile.IsRoughTile(33674));
print(" HasTreeOnTile(): " + AITile.HasTreeOnTile(33404));
print(" IsFarmTile(): " + AITile.IsFarmTile(33404));
print(" IsRockTile(): " + AITile.IsRockTile(33404));
print(" IsRoughTile(): " + AITile.IsRoughTile(33404));
@@ -1980,24 +1995,25 @@ function Regression::Start()
this.Group();
this.Industry();
this.IndustryList();
this.IndustryTypeList();
this.Map();
this.Marine();
this.Prices();
this.Rail();
this.RailTypeList();
this.Road();
this.Sign();
this.Station();
this.StationList();
this.Tile();
this.TileList();
this.Town();
this.TownList();
this.Tunnel();
this.Vehicle();
/* Order has to be after Vehicle */
this.Order();
print(" First Subsidy Test");
PrintSubsidy(0);
@@ -7752,24 +7752,171 @@ ERROR: IsEnd() is invalid as Begin() is
GetCargoPlannedFromVia(0, 1000, 0, 1000): -1
GetCargoPlannedFromVia(0, 1000, 1000, 1000): -1
GetCargoPlanned(1000, 1000): -1
GetCargoPlannedFrom(1000, 0, 1000): -1
GetCargoPlannedVia(1000, 0, 1000): -1
GetCargoPlannedFromVia(1000, 0, 0, 1000): -1
GetCargoPlannedFromVia(1000, 0, 1000, 1000): -1
GetCargoPlannedFrom(1000, 1000, 1000): -1
GetCargoPlannedVia(1000, 1000, 1000): -1
GetCargoPlannedFromVia(1000, 1000, 0, 1000): -1
GetCargoPlannedFromVia(1000, 1000, 1000, 1000): -1
--StationList--
GetName(): Little Frutford Valley
TileList_StationCoverage:
34192
34191
34190
34189
34188
34187
34186
33936
33935
33934
33933
33932
33931
33930
33680
33679
33678
33677
33676
33675
33674
33424
33423
33422
33421
33420
33419
33418
33168
33167
33166
33165
33164
33163
33162
32912
32911
32910
32909
32908
32907
32906
32656
32655
32654
32653
32652
32651
32650
GetName(): Little Frutford Woods
34439
34438
34437
34436
34435
34434
34433
34432
34185
34184
34183
34182
34181
34180
34179
34178
34177
34176
33929
33928
33927
33926
33925
33924
33923
33922
33921
33920
33673
33672
33671
33670
33669
33668
33667
33666
33665
33664
33417
33416
33415
33414
33413
33412
33411
33410
33409
33408
33161
33160
33159
33158
33157
33156
33155
33154
33153
33152
32905
32904
32903
32902
32901
32900
32899
32898
32897
32896
32649
32648
32647
32646
32645
32644
32643
32642
32641
32640
--Tile--
HasTreeOnTile(): false
IsFarmTile(): true
IsRockTile(): true
IsRoughTile(): true
HasTreeOnTile(): true
IsFarmTile(): false
IsRockTile(): false
IsRoughTile(): false
IsSnowTile(): false
IsDesertTile(): false
PlantTree(): true
@@ -9580,29 +9727,29 @@ ERROR: IsEnd() is invalid as Begin() is
2147483647 > 0 : true
2147483647 > -1 : true
2147483647 > -2147483648: true
2147483646 > 2147483647: false
1 > 2147483647: false
0 > 2147483647: false
-1 > 2147483647: false
-2147483648 > 2147483647: false
13725 > -2147483648: true
--Valuate() with excessive CPU usage--
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [unknown()] regression/main.nut line [2034]
*FUNCTION [unknown()] regression/main.nut line [2050]
*FUNCTION [Valuate()] NATIVE line [-1]
*FUNCTION [Start()] regression/main.nut line [2035]
*FUNCTION [Start()] regression/main.nut line [2051]
[id] 0
[this] TABLE
[Infinite] CLOSURE
[list] INSTANCE
[this] INSTANCE
ERROR: The script died unexpectedly.
@@ -12,24 +12,25 @@
* bug fixes can be found in the normal changelog. Note that removed API
* functions may still be available if you return an older API version
* in GetAPIVersion() in info.nut.
*
* \b 14.0
* This version is not yet released. The following changes are not set in stone yet.
* API additions:
* \li AITimeMode
* \li AITown::ROAD_LAYOUT_RANDOM
* \li AIVehicle::IsPrimaryVehicle
* \li AITileList_StationCoverage
* API removals:
* \li AIError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
* \li AIInfo::CONFIG_RANDOM, no longer used.
* Other changes:
* \li AIGroupList accepts an optional filter function
* \li AIIndustryList accepts an optional filter function
* \li AISignList accepts an optional filter function
* \li AISubsidyList accepts an optional filter function
* \li AITownList accepts an optional filter function
* \li AIVehicleList accepts an optional filter function
@@ -78,28 +78,29 @@
* \li GSGroup::GetSecondaryColour
* \li GSGroupList
* \li GSVehicleList_Group
* \li GSVehicleList_DefaultGroup
* \li GSGoal::IsValidGoalDestination
* \li GSGoal::SetDestination
* \li GSIndustry::GetProductionLevel
* \li GSIndustry::SetProductionLevel
* \li GSStoryPage::IsValidStoryPageElementType
* \li GSStoryPage::IsValidStoryPageButtonColour
* \li GSStoryPage::IsValidStoryPageButtonFlags
* \li GSStoryPage::IsValidStoryPageButtonCursor
* \li GSTileList_StationCoverage
* \li GSError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
* \li GSInfo::CONFIG_RANDOM, no longer used.
* \li GSGroupList accepts an optional filter function
* \li GSIndustryList accepts an optional filter function
* \li GSSignList accepts an optional filter function
* \li GSSubsidyList accepts an optional filter function
* \li GSTownList accepts an optional filter function
* \li GSVehicleList accepts an optional filter function
* \li GSInfo::AddSettings easy_value / medium_value / hard_value are replaced with default_value
* \b 13.0
@@ -138,12 +138,22 @@ ScriptTileList_StationType::ScriptTileLi
if ((station_type & ScriptStation::STATION_BUS_STOP) != 0) station_type_value |= (1 << ::STATION_BUS);
if ((station_type & ScriptStation::STATION_AIRPORT) != 0) station_type_value |= (1 << ::STATION_AIRPORT) | (1 << ::STATION_OILRIG);
if ((station_type & ScriptStation::STATION_DOCK) != 0) station_type_value |= (1 << ::STATION_DOCK) | (1 << ::STATION_OILRIG);
TileArea ta(::TileXY(rect->left, rect->top), rect->Width(), rect->Height());
for (TileIndex cur_tile : ta) {
if (!::IsTileType(cur_tile, MP_STATION)) continue;
if (::GetStationIndex(cur_tile) != station_id) continue;
if (!HasBit(station_type_value, ::GetStationType(cur_tile))) continue;
this->AddTile(cur_tile);
ScriptTileList_StationCoverage::ScriptTileList_StationCoverage(StationID station_id)
if (!ScriptStation::IsValidStation(station_id)) return;
BitmapTileIterator it(::Station::Get(station_id)->catchment_tiles);
for (TileIndex tile = it; tile != INVALID_TILE; tile = ++it) {
this->AddTile(tile);
@@ -95,13 +95,26 @@ public:
* @api ai game
* @ingroup ScriptList
*/
class ScriptTileList_StationType : public ScriptTileList {
public:
/**
* @param station_id The station to create the ScriptTileList for.
* @param station_type The StationType to create the ScriptList for.
ScriptTileList_StationType(StationID station_id, ScriptStation::StationType station_type);
};
* Creates a list of tiles in the catchment area of the StationID.
class ScriptTileList_StationCoverage : public ScriptTileList {
ScriptTileList_StationCoverage(StationID station_id);
#endif /* SCRIPT_TILELIST_HPP */
Status change: