MinchinWeb's MetaLibrary v.11
Library functions for OpenTTD AI (and GS) writers.
|
Extra functions. More...
Classes | |
class | Info |
Public Member Functions | |
function | MinDistance (TileID, TargetArray) |
Get the minimum distance between TileID and any of the tiles in TargetArray. | |
function | MultiMax (i1, i2) |
function | MultiMax (i1, i2, i3) |
function | MultiMax (i1, i2, i3, i4) |
Static Public Member Functions | |
function | SignLocation (text) |
Get the location of a sign. | |
function | MidPoint (TileA, TileB) |
Find the tile halfway between two other tiles. | |
function | Perpendicular (SlopeIn) |
Get the perpendicular slope. | |
function | Slope (TileA, TileB) |
Get the slope between two tiles. | |
function | Within (Bound1, Bound2, Value) |
Does Value fall between the bounds? | |
function | WithinFloat (Bound1, Bound2, Value) |
Does Value fall between the bounds? | |
function | MinAbsFloat (Value1, Value2) |
Takes the absolute value of both numbers and then returns the smaller of the two. | |
function | MaxAbsFloat (Value1, Value2) |
Takes the absolute value of both numbers and then returns the larger of the two. | |
function | AbsFloat (Value) |
Returns the absolute value of a given number. | |
function | Sign (Value) |
Returns the sign of a given number. | |
function | MinFloat (Value1, Value2) |
Returns the smaller of the two numbers. | |
function | MaxFloat (Value1, Value2) |
Returns the larger of the two numbers. | |
function | MinAbsFloatKeepSign (Value1, Value2) |
Takes the absolute value of both numbers and then returns the number with the lesser of the two, sign intact. | |
function | MaxAbsFloatKeepSign (Value1, Value2) |
Takes the absolute value of both numbers and then returns the number with the greater of the two, sign intact. | |
function | NextCardinalTile (StartTile, TowardsTile) |
The tile that is neighbouring StartTile that is closest to TowardsTile | |
function | GetOpenTTDRevision () |
Returns the revision number of the current build of OpenTTD. | |
function | MultiMax (i1) |
Get the maximum when provided with more than two inputs (up to four) |
Private Member Functions | |
constructor () |
Private Attributes | |
_infinity = null | |
pointer to _MinchinWeb_C_::Infinity() |
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 321 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 391 of file Extras.nut.
|
static |
Takes the absolute value of both numbers and then returns the larger of the two.
Definition at line 311 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 365 of file Extras.nut.
|
static |
Returns the larger of the two numbers.
Definition at line 345 of file Extras.nut.
|
static |
Find the tile halfway between two other tiles.
TileA | one 'end' tile |
TileB | the other 'end' tile |
Definition at line 249 of file Extras.nut.
|
static |
Takes the absolute value of both numbers and then returns the smaller of the two.
Definition at line 301 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 353 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. |
Definition at line 397 of file Extras.nut.
|
static |
Returns the smaller of the two numbers.
Definition at line 337 of file Extras.nut.
|
static |
Get the maximum when provided with more than two inputs (up to four)
i1... | input values |
Definition at line 406 of file Extras.nut.
function _MinchinWeb_Extras_::MultiMax | ( | i1 | , |
i2 | ) |
Definition at line 409 of file Extras.nut.
function _MinchinWeb_Extras_::MultiMax | ( | i1 | , |
i2 | , | ||
i3 | ) |
Definition at line 412 of file Extras.nut.
function _MinchinWeb_Extras_::MultiMax | ( | i1 | , |
i2 | , | ||
i3 | , | ||
i4 | ) |
Definition at line 415 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.
Definition at line 377 of file Extras.nut.
|
static |
Get the perpendicular slope.
SlopeIn | original slope |
Definition at line 258 of file Extras.nut.
|
static |
Returns the sign of a given number.
Definition at line 329 of file Extras.nut.
|
static |
Get the location of a sign.
text | message to search for |
Definition at line 238 of file Extras.nut.
|
static |
Get the slope between two tiles.
TileA | first 'end' tile |
TileB | tile at the other 'end' |
Definition at line 267 of file Extras.nut.
|
static |
Does Value fall between the bounds?
Bound1 | one limit |
Bound2 | another limit |
Value | the value being tested |
Definition at line 284 of file Extras.nut.
|
static |
Does Value fall between the bounds?
Bound1 | one limit |
Bound2 | another limit |
Value | the value being tested |
Definition at line 291 of file Extras.nut.
|
private |
pointer to _MinchinWeb_C_::Infinity()
Definition at line 35 of file Extras.nut.