WormAIDev  Worm SELF_VERSION
 All Classes Files Functions Variables Pages
Static Public Member Functions | Static Public Attributes | List of all members
WormTiles Class Reference

Define the WormTiles class containing tile related functions. More...

Static Public Member Functions

static function SafeAddSquare (list, tile, radius)
 Add a square area to an AITileList containing tiles that are within radius tiles from the center tile, taking the edges of the map into account.
static function SafeAddRectangle (tile_list, center_tile, x_min, y_min, x_plus, y_plus)
 A safe implementation of AITileList.AddRectangle.
static function GetDirection (tilefrom, tileto)
 Get the direction from one tile to another.
static function GetNextDirection (direction, clockwise)
 Get the next direction clockwise or counterclockwise relative to the specified direction.
static function DirectionToRailTrackDirection (direction)
 Convert our tile direction to AIRail RailTrack direction.

Static Public Attributes

static DIR_NE = 2
static DIR_NW = 0
static DIR_SE = 1
static DIR_SW = 3

Detailed Description

Define the WormTiles class containing tile related functions.

Member Function Documentation

function WormTiles::DirectionToRailTrackDirection ( direction  )
static

Convert our tile direction to AIRail RailTrack direction.

Parameters
directionThe tile direction.
Returns
The RailTrack direction.
function WormTiles::GetDirection ( tilefrom  ,
tileto   
)
static

Get the direction from one tile to another.

Note
Taken from SimpleAI.
Parameters
tilefromThe first tile.
tiletoThe second tile
Returns
The direction from the first tile to the second tile.
function WormTiles::GetNextDirection ( direction  ,
clockwise   
)
static

Get the next direction clockwise or counterclockwise relative to the specified direction.

Parameters
directionThe current direction
clockwiseBoolean: true go clockwise, false go counter clockwise.
Returns
The next direction.
function WormTiles::SafeAddRectangle ( tile_list  ,
center_tile  ,
x_min  ,
y_min  ,
x_plus  ,
y_plus   
)
static

A safe implementation of AITileList.AddRectangle.

Only valid tiles are added to the tile list.

Note
Taken from AdmiralAI.
Parameters
tile_listThe AITileList to add the tiles to.
center_tileThe center of the rectangle.
x_minThe amount of tiles to the north-east, relative to center_tile.
y_minThe amount of tiles to the north-west, relative to center_tile.
x_plusThe amount of tiles to the south-west, relative to center_tile.
y_plusThe amount of tiles to the south-east, relative to center_tile.
function WormTiles::SafeAddSquare ( list  ,
tile  ,
radius   
)
static

Add a square area to an AITileList containing tiles that are within radius tiles from the center tile, taking the edges of the map into account.

Note
This function was taken from Rondje. Name was changed from SafeAddRectangle to SafeAddSquare.
Parameters
listThe AITileList in which the valid tiles will be returned.
tileThe center tile.
radiusThe radius of tiles.

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