mirror of https://github.com/OpenTTD/OpenTTD
Add: [Script] ScriptTileList_StationCoverage (#12015)
parent
0858377e9e
commit
b0f3417025
|
@ -1358,6 +1358,21 @@ function Regression::Station()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
function Regression::Tile()
|
||||||
{
|
{
|
||||||
print("");
|
print("");
|
||||||
|
@ -1989,6 +2004,7 @@ function Regression::Start()
|
||||||
this.Road();
|
this.Road();
|
||||||
this.Sign();
|
this.Sign();
|
||||||
this.Station();
|
this.Station();
|
||||||
|
this.StationList();
|
||||||
this.Tile();
|
this.Tile();
|
||||||
this.TileList();
|
this.TileList();
|
||||||
this.Town();
|
this.Town();
|
||||||
|
|
|
@ -7761,6 +7761,153 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
GetCargoPlannedFromVia(1000, 1000, 0, 1000): -1
|
GetCargoPlannedFromVia(1000, 1000, 0, 1000): -1
|
||||||
GetCargoPlannedFromVia(1000, 1000, 1000, 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
|
||||||
|
TileList_StationCoverage:
|
||||||
|
34439
|
||||||
|
34438
|
||||||
|
34437
|
||||||
|
34436
|
||||||
|
34435
|
||||||
|
34434
|
||||||
|
34433
|
||||||
|
34432
|
||||||
|
34187
|
||||||
|
34186
|
||||||
|
34185
|
||||||
|
34184
|
||||||
|
34183
|
||||||
|
34182
|
||||||
|
34181
|
||||||
|
34180
|
||||||
|
34179
|
||||||
|
34178
|
||||||
|
34177
|
||||||
|
34176
|
||||||
|
33931
|
||||||
|
33930
|
||||||
|
33929
|
||||||
|
33928
|
||||||
|
33927
|
||||||
|
33926
|
||||||
|
33925
|
||||||
|
33924
|
||||||
|
33923
|
||||||
|
33922
|
||||||
|
33921
|
||||||
|
33920
|
||||||
|
33675
|
||||||
|
33674
|
||||||
|
33673
|
||||||
|
33672
|
||||||
|
33671
|
||||||
|
33670
|
||||||
|
33669
|
||||||
|
33668
|
||||||
|
33667
|
||||||
|
33666
|
||||||
|
33665
|
||||||
|
33664
|
||||||
|
33419
|
||||||
|
33418
|
||||||
|
33417
|
||||||
|
33416
|
||||||
|
33415
|
||||||
|
33414
|
||||||
|
33413
|
||||||
|
33412
|
||||||
|
33411
|
||||||
|
33410
|
||||||
|
33409
|
||||||
|
33408
|
||||||
|
33163
|
||||||
|
33162
|
||||||
|
33161
|
||||||
|
33160
|
||||||
|
33159
|
||||||
|
33158
|
||||||
|
33157
|
||||||
|
33156
|
||||||
|
33155
|
||||||
|
33154
|
||||||
|
33153
|
||||||
|
33152
|
||||||
|
32907
|
||||||
|
32906
|
||||||
|
32905
|
||||||
|
32904
|
||||||
|
32903
|
||||||
|
32902
|
||||||
|
32901
|
||||||
|
32900
|
||||||
|
32899
|
||||||
|
32898
|
||||||
|
32897
|
||||||
|
32896
|
||||||
|
32651
|
||||||
|
32650
|
||||||
|
32649
|
||||||
|
32648
|
||||||
|
32647
|
||||||
|
32646
|
||||||
|
32645
|
||||||
|
32644
|
||||||
|
32643
|
||||||
|
32642
|
||||||
|
32641
|
||||||
|
32640
|
||||||
|
|
||||||
--Tile--
|
--Tile--
|
||||||
HasTreeOnTile(): false
|
HasTreeOnTile(): false
|
||||||
IsFarmTile(): true
|
IsFarmTile(): true
|
||||||
|
@ -9589,9 +9736,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
--Valuate() with excessive CPU usage--
|
--Valuate() with excessive CPU usage--
|
||||||
Your script made an error: excessive CPU usage in valuator function
|
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 [Valuate()] NATIVE line [-1]
|
||||||
*FUNCTION [Start()] regression/main.nut line [2035]
|
*FUNCTION [Start()] regression/main.nut line [2051]
|
||||||
|
|
||||||
[id] 0
|
[id] 0
|
||||||
[this] TABLE
|
[this] TABLE
|
||||||
|
@ -9600,7 +9747,7 @@ Your script made an error: excessive CPU usage in valuator function
|
||||||
[this] INSTANCE
|
[this] INSTANCE
|
||||||
Your script made an error: excessive CPU usage in valuator function
|
Your script made an error: excessive CPU usage in valuator function
|
||||||
|
|
||||||
*FUNCTION [Start()] regression/main.nut line [2035]
|
*FUNCTION [Start()] regression/main.nut line [2051]
|
||||||
|
|
||||||
[Infinite] CLOSURE
|
[Infinite] CLOSURE
|
||||||
[list] INSTANCE
|
[list] INSTANCE
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
* \li AITimeMode
|
* \li AITimeMode
|
||||||
* \li AITown::ROAD_LAYOUT_RANDOM
|
* \li AITown::ROAD_LAYOUT_RANDOM
|
||||||
* \li AIVehicle::IsPrimaryVehicle
|
* \li AIVehicle::IsPrimaryVehicle
|
||||||
|
* \li AITileList_StationCoverage
|
||||||
*
|
*
|
||||||
* API removals:
|
* API removals:
|
||||||
* \li AIError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
|
* \li AIError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
|
||||||
|
|
|
@ -87,10 +87,11 @@
|
||||||
* \li GSStoryPage::IsValidStoryPageButtonColour
|
* \li GSStoryPage::IsValidStoryPageButtonColour
|
||||||
* \li GSStoryPage::IsValidStoryPageButtonFlags
|
* \li GSStoryPage::IsValidStoryPageButtonFlags
|
||||||
* \li GSStoryPage::IsValidStoryPageButtonCursor
|
* \li GSStoryPage::IsValidStoryPageButtonCursor
|
||||||
|
* \li GSTileList_StationCoverage
|
||||||
*
|
*
|
||||||
* API removals:
|
* API removals:
|
||||||
* \li GSError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
|
* \li GSError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
|
||||||
* \li AIInfo::CONFIG_RANDOM, no longer used.
|
* \li GSInfo::CONFIG_RANDOM, no longer used.
|
||||||
*
|
*
|
||||||
* Other changes:
|
* Other changes:
|
||||||
* \li GSGroupList accepts an optional filter function
|
* \li GSGroupList accepts an optional filter function
|
||||||
|
|
|
@ -147,3 +147,13 @@ ScriptTileList_StationType::ScriptTileList_StationType(StationID station_id, Scr
|
||||||
this->AddTile(cur_tile);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -104,4 +104,17 @@ public:
|
||||||
ScriptTileList_StationType(StationID station_id, ScriptStation::StationType station_type);
|
ScriptTileList_StationType(StationID station_id, ScriptStation::StationType station_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a list of tiles in the catchment area of the StationID.
|
||||||
|
* @api ai game
|
||||||
|
* @ingroup ScriptList
|
||||||
|
*/
|
||||||
|
class ScriptTileList_StationCoverage : public ScriptTileList {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @param station_id The station to create the ScriptTileList for.
|
||||||
|
*/
|
||||||
|
ScriptTileList_StationCoverage(StationID station_id);
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* SCRIPT_TILELIST_HPP */
|
#endif /* SCRIPT_TILELIST_HPP */
|
||||||
|
|
Loading…
Reference in New Issue