Rail  1
 All Classes Functions Variables
Classes | Public Member Functions | Public Attributes | List of all members
Rail Class Reference

A Rail Pathfinder. More...

Classes

class  Cost

Public Member Functions

function GetAuthor ()
function GetName ()
function GetShortName ()
function GetDescription ()
function GetVersion ()
function GetDate ()
function CreateInstance ()
function GetCategory ()
function InitializePath (sources, goals, ignored_tiles=[])
 Initialize a path search between sources and goals.
function FindPath (iterations)
 Try to find the path as indicated with InitializePath with the lowest cost.
function _GetBridgeNumSlopes (end_a, end_b)
function _nonzero (a, b)
function _Cost (path, new_tile, new_direction, self)
function _Estimate (cur_tile, cur_direction, goal_tiles, self)
function _Neighbours (path, cur_node, self)
function _CheckDirection (tile, existing_direction, new_direction, self)
function _dir (from, to)
function _GetDirection (pre_from, from, to, is_bridge)
function _GetTunnelsBridges (last_node, cur_node, bridge_dir)
 Get a list of all bridges and tunnels that can be build from the current tile.
function _IsSlopedRail (start, middle, end)

Public Attributes

 _aystar_class = "graph.aystar"
 _max_cost = null
 The maximum cost for a route.
 _cost_tile = null
 The cost for a single tile.
 _cost_diagonal_tile = null
 The cost for a diagonal tile.
 _cost_turn = null
 The cost that is added to _cost_tile if the direction changes.
 _cost_slope = null
 The extra cost if a rail tile is sloped.
 _cost_bridge_per_tile = null
 The cost per tile of a new bridge, this is added to _cost_tile.
 _cost_tunnel_per_tile = null
 The cost per tile of a new tunnel, this is added to _cost_tile.
 _cost_coast = null
 The extra cost for a coast tile.
 _pathfinder = null
 A reference to the used AyStar object.
 _max_bridge_length = null
 The maximum length of a bridge that will be build.
 _max_tunnel_length = null
 The maximum length of a tunnel that will be build.
 cost = null
 Used to change the costs.
 _running = null
 _goals = null

Detailed Description

A Rail Pathfinder.

Member Function Documentation

function Rail::_GetTunnelsBridges ( last_node  ,
cur_node  ,
bridge_dir   
)

Get a list of all bridges and tunnels that can be build from the current tile.

Bridges will only be build starting on non-flat tiles for performance reasons. Tunnels will only be build if no terraforming is needed on both ends.

function Rail::FindPath ( iterations  )

Try to find the path as indicated with InitializePath with the lowest cost.

Parameters
iterationsAfter how many iterations it should abort for a moment. This value should either be -1 for infinite, or > 0. Any other value aborts immediatly and will never find a path.
Returns
A route if one was found, or false if the amount of iterations was reached, or null if no path was found. You can call this function over and over as long as it returns false, which is an indication it is not yet done looking for a route.
See Also
AyStar::FindPath()
function Rail::InitializePath ( sources  ,
goals  ,
ignored_tiles  = [] 
)
inline

Initialize a path search between sources and goals.

Parameters
sourcesThe source tiles.
goalsThe target tiles.
ignored_tilesAn array of tiles that cannot occur in the final path.
See Also
AyStar::InitializePath()

The documentation for this class was generated from the following files: