MinchinWeb's MetaLibrary v.11
Library functions for OpenTTD AI (and GS) writers.
|
Dominion Land System (Road Pathfinder) More...
Classes | |
class | Info |
Public Member Functions | |
function | SetDatum (NewDatum) |
Sets network Datum. | |
function | GetDatum () |
Returns the currently set Datum. | |
function | IsGridPoint (Point) |
Is the tile given a grid point. | |
function | GridPoints (End1, End2) |
Get all the grid points between two tiles. | |
function | AllGridPoints () |
Get all grid points. | |
function | FindPath (cycles=10000) |
Run the pathfinder. | |
function | InitializePath (StartArray, EndArray) |
Initializes the pathfinder. | |
function | BuildPath () |
Build the path. | |
function | InitializePathOnTowns (StartTown, EndTown) |
Initializes the pathfinder using two towns. | |
function | GetPath () |
Returns the path stored by the pathfinder. | |
function | GetPathLength () |
Returns the length of the path stored by the pathfinder. | |
function | PathToTilePairs () |
Convert the path to tile pairs. | |
function | PathToTiles () |
Get all the tiles in the path. | |
function | TilePairsToBuild () |
Get the road tile pairs that need built. | |
function | GetBuildCost () |
Determine how much it will cost to build the path. | |
function | PresetOriginal () |
function | PresetPerfectPath () |
function | PresetQuickAndDirty () |
function | PresetCheckExisting () |
function | PresetPresetMode6 () |
function | PresetPresetStreetcar () |
Private Member Functions | |
constructor () |
Private Attributes | |
_grid_x = null | |
Grid spacing in x direction (default is 8 tiles) | |
_grid_y = null | |
Grid spacing in y direction (default is 8 tiles) | |
_datum = null | |
This is the 'centre' of our survey system. | |
_base_datum = null | |
this is the 'grid point' closest to 0,0 | |
_pathfinder = null | |
the pathfinder itself | |
_start_tile = null | |
starting tile | |
_end_tile = null | |
ending tile | |
_path = null | |
used to store that path as a array of tile pairs | |
_running = null | |
Is the pathfinder currently running? | |
_road_type = null | |
See http://noai.openttd.org/api/trunk/classAIRoad.html |
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. |
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.
Definition at line 550 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 478 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::GetPathLength | ( | ) |
Returns the length of the path stored by the pathfinder.
Definition at line 487 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 |
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 470 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::IsGridPoint | ( | Point | ) |
Is the tile given a grid point.
Definition at line 263 of file Dominion.Roads.nut.
function _MinchinWeb_DLS_::PathToTilePairs | ( | ) |
Convert the path to tile pairs.
Definition at line 506 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 527 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.