MinchinWeb's MetaLibrary v.11
Library functions for OpenTTD AI (and GS) writers.
Loading...
Searching...
No Matches
_MinchinWeb_SW_ Class Reference

Spiral Walker. More...

Public Member Functions

function Start (Tile)
 Sets the starting tile for SpiralWalker.
function Reset ()
 Resets the variables for the SpiralWalker.
function Restart ()
 Moves the SpiralWalker to the original starting position.
function Walk ()
 'Walks' the SpiralWalker one tile at a tile
function GetStart ()
 Returns the tile the SpiralWalker is starting on.
function GetStage ()
 Returns the Stage the SpiralWalker is on.
function GetTile ()
 Returns the Tile the SpiralWalker is on.
function GetStep ()
 Returns the number of steps the SpiralWalker has done.

Private Member Functions

 constructor ()

Private Attributes

 _start = null
 start tile
 _start_x = null
 x value of start tile
 _start_y = null
 y value of start tile
 _x = null
 x value of current tile
 _y = null
 y value of current tile
 _current_tile = null
 current tile
 _dx = null
 _dy = null
 _Steps = null
 see GetStep()
 _Stage = null
 see GetStage()
 _StageMax = null
 _StageSteps = null

Detailed Description

Spiral Walker.

Version
v.3.1 (2025-07-16)
Author
W. Minchin (MinchinWeb)
Since
MetaLibrary v.4

The SpiralWalker class allows you to define a starting point, and then 'walk' all the tiles in a spiral outward. It was originally used to find a build-able spot for my HQ in WmDOT, but is useful for many other things as well.

Note
SpiralWalker is designed to be a persistent class.
See also
_MinchinWeb_LW_
Todo

add image showing the walk out pattern

cap at map bounds

Definition at line 45 of file Spiral.Walker.nut.

Member Function Documentation

◆ constructor()

_MinchinWeb_SW_::constructor ( )
inlineprivate

Definition at line 59 of file Spiral.Walker.nut.

◆ GetStage()

function _MinchinWeb_SW_::GetStage ( )
inline

Returns the Stage the SpiralWalker is on.

Basically, the line segments its completed plus one; it takes four stages to complete a revolution.

Returns
stage number
See also
GetStep()
Todo
Add an image showing how stages are counted

Definition at line 105 of file Spiral.Walker.nut.

◆ GetStart()

function _MinchinWeb_SW_::GetStart ( )
inline

Returns the tile the SpiralWalker is starting on.

Returns
The tile the SpiralWalker is starting on
See also
Start()

Definition at line 95 of file Spiral.Walker.nut.

◆ GetStep()

function _MinchinWeb_SW_::GetStep ( )
inline

Returns the number of steps the SpiralWalker has done.

Returns
The number of steps the SpiralWalker has done.
See also
GetStage()
Todo
Add an image showing how steps are counted

Definition at line 119 of file Spiral.Walker.nut.

◆ GetTile()

function _MinchinWeb_SW_::GetTile ( )
inline

Returns the Tile the SpiralWalker is on.

Returns
the Tile the SpiralWalker is on.
See also
GetStep()
GetStage()

Definition at line 112 of file Spiral.Walker.nut.

◆ Reset()

function _MinchinWeb_SW_::Reset ( )

Resets the variables for the SpiralWalker.

See also
Restart()

Definition at line 140 of file Spiral.Walker.nut.

◆ Restart()

function _MinchinWeb_SW_::Restart ( )

Moves the SpiralWalker to the original starting position.

See also
Reset()

Definition at line 149 of file Spiral.Walker.nut.

◆ Start()

function _MinchinWeb_SW_::Start ( Tile )

Sets the starting tile for SpiralWalker.

See also
Restart()

Definition at line 124 of file Spiral.Walker.nut.

◆ Walk()

function _MinchinWeb_SW_::Walk ( )

'Walks' the SpiralWalker one tile at a tile

Returns
the tile that the SpiralWalker is now "standing on"
Note
This is where (most) of the action is!
Before calling this function, you need to set the Start().

Definition at line 162 of file Spiral.Walker.nut.

Member Data Documentation

◆ _current_tile

_MinchinWeb_SW_::_current_tile = null
private

current tile

Definition at line 51 of file Spiral.Walker.nut.

◆ _dx

_MinchinWeb_SW_::_dx = null
private

Definition at line 52 of file Spiral.Walker.nut.

◆ _dy

_MinchinWeb_SW_::_dy = null
private

Definition at line 53 of file Spiral.Walker.nut.

◆ _Stage

_MinchinWeb_SW_::_Stage = null
private

see GetStage()

Definition at line 55 of file Spiral.Walker.nut.

◆ _StageMax

_MinchinWeb_SW_::_StageMax = null
private

Definition at line 56 of file Spiral.Walker.nut.

◆ _StageSteps

_MinchinWeb_SW_::_StageSteps = null
private

Definition at line 57 of file Spiral.Walker.nut.

◆ _start

_MinchinWeb_SW_::_start = null
private

start tile

Definition at line 46 of file Spiral.Walker.nut.

◆ _start_x

_MinchinWeb_SW_::_start_x = null
private

x value of start tile

Definition at line 47 of file Spiral.Walker.nut.

◆ _start_y

_MinchinWeb_SW_::_start_y = null
private

y value of start tile

Definition at line 48 of file Spiral.Walker.nut.

◆ _Steps

_MinchinWeb_SW_::_Steps = null
private

see GetStep()

Definition at line 54 of file Spiral.Walker.nut.

◆ _x

_MinchinWeb_SW_::_x = null
private

x value of current tile

Definition at line 49 of file Spiral.Walker.nut.

◆ _y

_MinchinWeb_SW_::_y = null
private

y value of current tile

Definition at line 50 of file Spiral.Walker.nut.


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