MinchinWeb's MetaLibrary
v.9
Library functions of OpenTTD AI writers.
|
Line Walker. More...
Public Member Functions | |
function | Start (Tile) |
Sets the starting tile for LineWalker. More... | |
function | End (Tile) |
Sets the ending tile for LineWalker. More... | |
function | Slope (Slope, ThirdQuadrant=false) |
Sets the slope for LineWalker. More... | |
function | Reset () |
Resets the variables for the LineWalker. More... | |
function | Restart () |
Moves the LineWalker to the original starting position. More... | |
function | Walk () |
'Walks' the LineWalker one tile at a tile More... | |
function | IsEnd () |
Returns True if we are at the edge of the bounding box defined by the Starting and Ending point. More... | |
function | GetStart () |
Returns the tile the LineWalker is starting on. More... | |
function | GetEnd () |
Returns the tile the LineWalker is ending on. More... | |
Private Member Functions | |
constructor () | |
Private Attributes | |
_start = null | |
start tile More... | |
_end = null | |
end tile More... | |
_slope = null | |
line slope More... | |
_startx = null | |
x value of start tile More... | |
_starty = null | |
y value of start tile More... | |
_endx = null | |
x value of end tile More... | |
_endy = null | |
y value of end tile More... | |
_past_end = null | |
_x = null | |
x value of current tile More... | |
_y = null | |
y value of current tile More... | |
_dirx = null | |
_current_tile = null | |
current tile More... | |
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.
LineWalker
is designed to be a persistent class. 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.
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.
ThirdQuadrant == true
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.