MinchinWeb's MetaLibrary
v.9
Library functions of OpenTTD AI writers.

Extra functions. More...
Public Member Functions  
function  MinDistance (TileID, TargetArray) 
Get the minimum distance between TileID and any of the tiles in TargetArray. More...  
Static Public Member Functions  
function  SignLocation (text) 
Get the location of a sign. More...  
function  MidPoint (TileA, TileB) 
Find the tile halfway between two other tiles. More...  
function  Perpendicular (SlopeIn) 
Get the perpendicular slope. More...  
function  Slope (TileA, TileB) 
Get the slope between two tiles. More...  
function  Within (Bound1, Bound2, Value) 
Does Value fall between the bounds? More...  
function  WithinFloat (Bound1, Bound2, Value) 
Does Value fall between the bounds? More...  
function  MinAbsFloat (Value1, Value2) 
Takes the absolute value of both numbers and then returns the smaller of the two. More...  
function  MaxAbsFloat (Value1, Value2) 
Takes the absolute value of both numbers and then returns the larger of the two. More...  
function  AbsFloat (Value) 
Returns the absolute value of a given number. More...  
function  Sign (Value) 
Returns the sign of a given number. More...  
function  MinFloat (Value1, Value2) 
Returns the smaller of the two numbers. More...  
function  MaxFloat (Value1, Value2) 
Returns the larger of the two numbers. More...  
function  MinAbsFloatKeepSign (Value1, Value2) 
Takes the absolute value of both numbers and then returns the number with the lesser of the two, sign intact. More...  
function  MaxAbsFloatKeepSign (Value1, Value2) 
Takes the absolute value of both numbers and then returns the number with the greater of the two, sign intact. More...  
function  NextCardinalTile (StartTile, TowardsTile) 
The tile that is neighbouring StartTile that is closest to TowardsTile More...  
function  GetOpenTTDRevision () 
Returns the revision number of the current build of OpenTTD. More...  
Private Member Functions  
constructor ()  
Private Attributes  
_infinity = null  
pointer to _MinchinWeb_C_::Infinity() More...  
Extra functions.
These are 'random' functions that didn't seem to fit well elsewhere. Many of them are math helper functions. Many others are helpful in dealing geometry.
Definition at line 34 of file Extras.nut.

static 
Returns the absolute value of a given number.
Definition at line 296 of file Extras.nut.

inlineprivate 
Definition at line 37 of file Extras.nut.

static 
Returns the revision number of the current build of OpenTTD.
Definition at line 367 of file Extras.nut.

static 
Takes the absolute value of both numbers and then returns the larger of the two.
Definition at line 286 of file Extras.nut.

static 
Takes the absolute value of both numbers and then returns the number with the greater of the two, sign intact.
Definition at line 341 of file Extras.nut.

static 
Returns the larger of the two numbers.
Definition at line 321 of file Extras.nut.

static 
Find the tile halfway between two other tiles.
TileA  one 'end' tile 
TileB  the other 'end' tile 
TileID
of the tile halfway between TileA
and TileB
Definition at line 223 of file Extras.nut.

static 
Takes the absolute value of both numbers and then returns the smaller of the two.
Definition at line 276 of file Extras.nut.

static 
Takes the absolute value of both numbers and then returns the number with the lesser of the two, sign intact.
Definition at line 329 of file Extras.nut.
function _MinchinWeb_Extras_::MinDistance  (  TileID  , 
TargetArray  
) 
Get the minimum distance between TileID and any of the tiles in TargetArray.
TileID  Tile we measure distance from 
TargetArray  An array to tiles that we want to measure distance to. This can also be an AIList where the items are tiles. 
1
; therefore invalid tiles are always 'closer' that valid tiles. Definition at line 373 of file Extras.nut.

static 
Returns the smaller of the two numbers.
Definition at line 313 of file Extras.nut.

static 
The tile that is neighbouring StartTile
that is closest to TowardsTile
Given a StartTile
and a TowardsTile
, will give the tile immediately next (Manhattan Distance == 1) to StartTile
that is closest to TowardsTile
.
StartTile
Definition at line 353 of file Extras.nut.

static 
Get the perpendicular slope.
SlopeIn  original slope 
SlopeIn
(as a floating point number) Definition at line 232 of file Extras.nut.

static 
Returns the sign of a given number.
Definition at line 305 of file Extras.nut.

static 
Get the location of a sign.
text  message to search for 
null
if no matching sign can be found. Definition at line 212 of file Extras.nut.

static 
Get the slope between two tiles.
TileA  first 'end' tile 
TileB  tile at the other 'end' 
1/Infinity
is returned. Definition at line 241 of file Extras.nut.

static 
Does Value
fall between the bounds?
Bound1  one limit 
Bound2  another limit 
Value  the value being tested 
True
is Value
falls between the bounds, False
otherwise. Bound1
be larger than Bound2
or visversa. Definition at line 258 of file Extras.nut.

static 
Does Value
fall between the bounds?
Bound1  one limit 
Bound2  another limit 
Value  the value being tested 
True
is Value
falls between the bounds, False
otherwise. Bound1
be larger than Bound2
or visversa. Definition at line 266 of file Extras.nut.

private 
pointer to _MinchinWeb_C_::Infinity()
Definition at line 35 of file Extras.nut.