com.b3dgs.lionengine.game.map
Interface PathBasedMap<TTile extends AbstractPathTile>

Type Parameters:
TTile - type of tile used.
All Superinterfaces:
TileBasedMap<TTile>
All Known Implementing Classes:
AbstractPathMap

public interface PathBasedMap<TTile extends AbstractPathTile>
extends TileBasedMap<TTile>

Describe a tile based map which supports pathfinding. The setRef/getRef functions allows to store special id. Theses id can represent an entry which is over the map. This way, it is realy easy and fast to search an entry at specified location.


Method Summary
 boolean blocked(Pathfindable mover, int v, int h, boolean ignoreRef)
          Check if current location is blocking or not.
 boolean checkFreePlace(int tx, int ty, int w, int h, int id)
          Check if area if unused.
 java.util.List<Point2D> getAllFreePlaceArround(int tx, int ty, int w, int h, int id, int radius)
          Search list of free area from this area.
 float getCost(Pathfindable mover, int sx, int sy, int tx, int ty)
          Get the cost of the complete path, from start till end.
 Point2D getFreePlaceArround(int tx, int ty, int w, int h, int id, int radius)
          Search a free area from this area.
 int getRef(int v, int h)
          Get ref id.
 TTile getTileArround(Pathfindable mover, int v, int h, int width, int height)
          Search the first unblocking tile arround location (clock way).
 void pathFinderVisited(int v, int h)
          Mark the tile as visited.
 void setRef(int v, int h, int id)
          Set ref id.
 
Methods inherited from interface com.b3dgs.lionengine.game.map.TileBasedMap
getHeightInTiles, getPatternsNumber, getTile, getTileHeight, getTileWidth, getWidthInTiles, renderTile
 

Method Detail

pathFinderVisited

void pathFinderVisited(int v,
                       int h)
Mark the tile as visited.

Parameters:
v - vertical location.
h - horizontal location.

getTileArround

TTile getTileArround(Pathfindable mover,
                     int v,
                     int h,
                     int width,
                     int height)
Search the first unblocking tile arround location (clock way).

Parameters:
mover - object searching path.
v - vertical location.
h - horizontal location.
width - number of horizontal tiles to search.
height - number of vertical tiles to search.
Returns:
unblocking tile found.

getFreePlaceArround

Point2D getFreePlaceArround(int tx,
                            int ty,
                            int w,
                            int h,
                            int id,
                            int radius)
Search a free area from this area.

Parameters:
tx - horizontal location.
ty - vertical location.
w - width in tile.
h - height in tile.
id - id to ignore.
radius - search size.
Returns:
free place found.

getAllFreePlaceArround

java.util.List<Point2D> getAllFreePlaceArround(int tx,
                                               int ty,
                                               int w,
                                               int h,
                                               int id,
                                               int radius)
Search list of free area from this area.

Parameters:
tx - horizontal location.
ty - vertical location.
w - width in tile.
h - height in tile.
id - id to ignore.
radius - search size.
Returns:
list of free places found.

checkFreePlace

boolean checkFreePlace(int tx,
                       int ty,
                       int w,
                       int h,
                       int id)
Check if area if unused.

Parameters:
tx - horizontal location.
ty - vertical location.
w - width in tile.
h - height in tile.
id - id to ignore.
Returns:
true if area is free (area id = 0).

blocked

boolean blocked(Pathfindable mover,
                int v,
                int h,
                boolean ignoreRef)
Check if current location is blocking or not.

Parameters:
mover - object moving on map.
v - vertical location.
h - horizontal location.
ignoreRef - ignore map ref array checking.
Returns:
true if blocking, false else.

getCost

float getCost(Pathfindable mover,
              int sx,
              int sy,
              int tx,
              int ty)
Get the cost of the complete path, from start till end.

Parameters:
mover - object moving on map.
sx - starting location x.
sy - starting location y.
tx - ending location x.
ty - ending location y.
Returns:
total cost.

setRef

void setRef(int v,
            int h,
            int id)
Set ref id.

Parameters:
v - vertical index.
h - horizontal index.
id - id to store.

getRef

int getRef(int v,
           int h)
Get ref id.

Parameters:
v - vertical index.
h - horizontal index.
Returns:
id found.