MinchinWeb's MetaLibrary v.11
Library functions for OpenTTD AI (and GS) writers.
|
Line Walker. More...
Public Member Functions | |
function | Start (Tile) |
Sets the starting tile for LineWalker. | |
function | End (Tile) |
Sets the ending tile for LineWalker. | |
function | Slope (Slope, ThirdQuadrant=false) |
Sets the slope for LineWalker. | |
function | Reset () |
Resets the variables for the LineWalker. | |
function | Restart () |
Moves the LineWalker to the original starting position. | |
function | Walk () |
'Walks' the LineWalker one tile at a tile | |
function | IsEnd () |
Returns True if we are at the edge of the bounding box defined by the Starting and Ending point. | |
function | GetStart () |
Returns the tile the LineWalker is starting on. | |
function | GetEnd () |
Returns the tile the LineWalker is ending on. |
Private Member Functions | |
constructor () |
Private Attributes | |
_start = null | |
start tile | |
_end = null | |
end tile | |
_slope = null | |
line slope | |
_start_x = null | |
x value of start tile | |
_start_y = null | |
y value of start tile | |
_end_x = null | |
x value of end tile | |
_end_y = null | |
y value of end tile | |
_past_end = null | |
_x = null | |
x value of current tile | |
_y = null | |
y value of current tile | |
_dir_x = null | |
_current_tile = null | |
current tile |
Line Walker.
The LineWalker class allows you to define a starting and endpoint, and then 'walk' all the tiles between the two. Alternately, you can give a starting point and a slope. It was originally part of my Ship Pathfinder, also part of Minchinweb's MetaLibrary.
Definition at line 53 of file Line.Walker.nut.
|
inlineprivate |
Definition at line 67 of file Line.Walker.nut.
function _MinchinWeb_LW_::End | ( | Tile | ) |
Sets the ending tile for LineWalker.
Definition at line 187 of file Line.Walker.nut.
|
inline |
Returns the tile the LineWalker is ending on.
Definition at line 142 of file Line.Walker.nut.
|
inline |
Returns the tile the LineWalker is starting on.
Definition at line 135 of file Line.Walker.nut.
|
inline |
Returns True if we are at the edge of the bounding box defined by the Starting and Ending point.
Definition at line 129 of file Line.Walker.nut.
function _MinchinWeb_LW_::Reset | ( | ) |
Resets the variables for the LineWalker.
Definition at line 260 of file Line.Walker.nut.
function _MinchinWeb_LW_::Restart | ( | ) |
Moves the LineWalker to the original starting position.
Definition at line 275 of file Line.Walker.nut.
function _MinchinWeb_LW_::Slope | ( | Slope | , |
ThirdQuadrant | = false ) |
Sets the slope for LineWalker.
Definition at line 220 of file Line.Walker.nut.
function _MinchinWeb_LW_::Start | ( | Tile | ) |
Sets the starting tile for LineWalker.
Definition at line 148 of file Line.Walker.nut.
function _MinchinWeb_LW_::Walk | ( | ) |
'Walks' the LineWalker one tile at a tile
Definition at line 284 of file Line.Walker.nut.
|
private |
current tile
Definition at line 65 of file Line.Walker.nut.
|
private |
Definition at line 64 of file Line.Walker.nut.
|
private |
end tile
Definition at line 55 of file Line.Walker.nut.
|
private |
x value of end tile
Definition at line 59 of file Line.Walker.nut.
|
private |
y value of end tile
Definition at line 60 of file Line.Walker.nut.
|
private |
Definition at line 61 of file Line.Walker.nut.
|
private |
line slope
Definition at line 56 of file Line.Walker.nut.
|
private |
start tile
Definition at line 54 of file Line.Walker.nut.
|
private |
x value of start tile
Definition at line 57 of file Line.Walker.nut.
|
private |
y value of start tile
Definition at line 58 of file Line.Walker.nut.
|
private |
x value of current tile
Definition at line 62 of file Line.Walker.nut.
|
private |
y value of current tile
Definition at line 63 of file Line.Walker.nut.