MinchinWeb's MetaLibrary
v.9
Library functions of OpenTTD AI writers.
|
Dominion Land System (Road Pathfinder) More...
Classes | |
class | Info |
Public Member Functions | |
function | SetDatum (NewDatum) |
Sets network Datum. More... | |
function | GetDatum () |
Returns the currently set Datum. More... | |
function | IsGridPoint (Point) |
Is the tile given a grid point. More... | |
function | GridPoints (End1, End2) |
Get all the grid points between two tiles. More... | |
function | AllGridPoints () |
Get all grid points. More... | |
function | FindPath (cycles=10000) |
Run the pathfinder. More... | |
function | InitializePath (StartArray, EndArray) |
Initializes the pathfinder. More... | |
function | BuildPath () |
Build the path. More... | |
function | InitializePathOnTowns (StartTown, EndTown) |
Initializes the pathfinder using two towns. More... | |
function | GetPath () |
Returns the path stored by the pathfinder. More... | |
function | GetPathLength () |
Returns the length of the path stored by the pathfinder. More... | |
function | PathToTilePairs () |
Convert the path to tile pairs. More... | |
function | PathToTiles () |
Get all the tiles in the path. More... | |
function | TilePairsToBuild () |
Get the road tile pairs that need built. More... | |
function | GetBuildCost () |
Determine how much it will cost to build the path. More... | |
function | PresetOriginal () |
function | PresetPerfectPath () |
function | PresetQuickAndDirty () |
function | PresetCheckExisting () |
function | PresetPresetMode6 () |
function | PresetPresetStreetcar () |
Private Member Functions | |
constructor () | |
Private Attributes | |
_gridx = null | |
Grid spacing in x direction (default is 8 tiles) More... | |
_gridy = null | |
Grid spacing in y direction (default is 8 tiles) More... | |
_datum = null | |
This is the 'centre' of our survey system. More... | |
_basedatum = null | |
this is the 'grid point' closest to 0,0 More... | |
_pathfinder = null | |
the pathfinder itself More... | |
_starttile = null | |
starting tile More... | |
_endtile = null | |
ending tile More... | |
_path = null | |
used to store that path as a array of tile pairs More... | |
_running = null | |
Is the pathfinder currently running? More... | |
_road_type = null | |
See http://noai.openttd.org/api/trunk/classAIRoad.html More... | |
Dominion Land System (Road Pathfinder)
Dominion Land System refers to the system of survey in Western Canada. Land was surveyed into 1/2 mile x 1/2 mile "quarter sections" that would be sold to settlers (around 1905, the price was $10). Roads were placed on a 1 mile x 2 mile grid along the edges of these quarter sections.
Here, we follow the same idea, although on a square grid. The default grid is 8x8 tiles. This is designed to run as a wrapper on the main road pathfinder.
Definition at line 63 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::AllGridPoints | ( | ) |
Get all grid points.
Definition at line 330 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::BuildPath | ( | ) |
Build the path.
Definition at line 399 of file Dominion.Roads.nut.
|
inlineprivate |
Definition at line 75 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::FindPath | ( | cycles | = 10000 | ) |
Run the pathfinder.
cycles | number of iterations to run before returning. |
True
when the path is found cycles
Definition at line 335 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::GetBuildCost | ( | ) |
Determine how much it will cost to build the path.
Turns to 'test mode,' builds the route provided, and returns the cost.
False
if the test build fails somewhere. Definition at line 558 of file Dominion.Roads.nut.
|
inline |
Returns the currently set Datum.
Definition at line 99 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::GetPath | ( | ) |
Returns the path stored by the pathfinder.
Definition at line 482 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::GetPathLength | ( | ) |
Returns the length of the path stored by the pathfinder.
Definition at line 492 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::GridPoints | ( | End1 | , |
End2 | |||
) |
Get all the grid points between two tiles.
End1 | expected to be a TileIndex |
End2 | expected to be a TileIndex |
End1
and End2
will NOT be included in the return array. Definition at line 272 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::InitializePath | ( | StartArray | , |
EndArray | |||
) |
Initializes the pathfinder.
StartArray | the first item assumed be a TileIndex, the of the items in the array are ignored. |
EndArray | the first item assumed be a TileIndex, the of the items in the array are ignored. |
Definition at line 391 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::InitializePathOnTowns | ( | StartTown | , |
EndTown | |||
) |
Initializes the pathfinder using two towns.
StartTown | Assumed to be a TownID |
EndTown | Assumed to be a TownID |
Definition at line 473 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::IsGridPoint | ( | Point | ) |
Is the tile given a grid point.
True
if and only if Point
is a gird point; False
otherwise. Definition at line 263 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::PathToTilePairs | ( | ) |
Convert the path to tile pairs.
Definition at line 512 of file Dominion.Roads.nut.
|
inline |
Get all the tiles in the path.
Definition at line 176 of file Dominion.Roads.nut.
|
inline |
Pass-thru functions to RoadPathfinder
Definition at line 221 of file Dominion.Roads.nut.
|
inline |
Pass-thru functions to RoadPathfinder
Definition at line 200 of file Dominion.Roads.nut.
|
inline |
Pass-thru functions to RoadPathfinder
Definition at line 207 of file Dominion.Roads.nut.
|
inline |
Pass-thru functions to RoadPathfinder
Definition at line 228 of file Dominion.Roads.nut.
|
inline |
Pass-thru functions to RoadPathfinder
Definition at line 235 of file Dominion.Roads.nut.
|
inline |
Pass-thru functions to RoadPathfinder
Definition at line 214 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::SetDatum | ( | NewDatum | ) |
Sets network Datum.
Used to set the datum for our road system.
NewDatum | assumed to be a TileIndex |
Definition at line 255 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::TilePairsToBuild | ( | ) |
Get the road tile pairs that need built.
Similar to PathToTilePairs(), but only returns those pairs where there isn't a current road connection.
Definition at line 534 of file Dominion.Roads.nut.
|
private |
this is the 'grid point' closest to 0,0
Definition at line 67 of file Dominion.Roads.nut.
|
private |
This is the 'centre' of our survey system.
Definition at line 66 of file Dominion.Roads.nut.
|
private |
ending tile
Definition at line 70 of file Dominion.Roads.nut.
|
private |
Grid spacing in x direction (default is 8 tiles)
Definition at line 64 of file Dominion.Roads.nut.
|
private |
Grid spacing in y direction (default is 8 tiles)
Definition at line 65 of file Dominion.Roads.nut.
|
private |
used to store that path as a array of tile pairs
Definition at line 71 of file Dominion.Roads.nut.
|
private |
the pathfinder itself
Definition at line 68 of file Dominion.Roads.nut.
|
private |
See http://noai.openttd.org/api/trunk/classAIRoad.html
Definition at line 73 of file Dominion.Roads.nut.
|
private |
Is the pathfinder currently running?
Definition at line 72 of file Dominion.Roads.nut.
|
private |
starting tile
Definition at line 69 of file Dominion.Roads.nut.