MinchinWeb's MetaLibrary
v.9
Library functions of OpenTTD AI writers.
|
Lakes. More...
Public Member Functions | |
function | InitializePath (sources, goals) |
function | FindPath (iterations) |
function | AddPoint (myTileID) |
Seeds a point into Lakes. More... | |
function | GetPathLength () |
Get the minimum distance between the source and destination tiles. More... | |
function | Preseed () |
Adds 'starter' tile groups across the map. More... | |
Private Member Functions | |
constructor () | |
function | _AddGridPoints () |
Seeds the grid points to Lakes. More... | |
function | _AllGroups (StartGroupArray) |
Given a starting group, return all groups attached to it. More... | |
function | _AddNeighbour (NextTile) |
Processes NextTile s neighbours. More... | |
Private Attributes | |
_heap_class = import("queue.fibonacci_heap", "", 3) | |
_map = null | |
AIList that tells which group each tile belongs in. More... | |
_connections = null | |
Array that shows the connections to each tile group. More... | |
_areas = null | |
Array of the defined tile groups. More... | |
_open_neighbours = null | |
Array of tiles that are open from each tile group. More... | |
_group_tiles = null | |
Array of AIList's of the tiles that are in each group. More... | |
_AGroup = null | |
array of groups containing source tiles More... | |
_BGroup = null | |
array of groups containing goal tiles More... | |
_A = null | |
array of source tiles More... | |
_B = null | |
array of goal tiles More... | |
_running = null | |
is Lakes currently running? More... | |
Lakes.
Lakes is a replacement for WaterBody Check (_MinchinWeb_WBC_). Lakes serves to determine if two water tiles are connected by water (i.e. if a ship could sail between them). It trades memory usage for speed by caching results. Like WaterBody Check, it will keep trying to find a connections until there is no possible connection left.
Approximate program flow:
|
private |
|
private |
|
private |
function _MinchinWeb_Lakes_::AddPoint | ( | myTileID | ) |
function _MinchinWeb_Lakes_::FindPath | ( | iterations | ) |
Try to find if the source and goal tiles are within the same waterbody.
iterations | After how many iterations it should abort for a moment. This value should either be -1 for infinite, or > 0. Any other value aborts immediately and will never find a path. |
function _MinchinWeb_Lakes_::GetPathLength | ( | ) |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |