Bomberman
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
BBM::LuaMap Class Reference

#include <LuaMap.hpp>

Collaboration diagram for BBM::LuaMap:

Public Member Functions

 LuaMap ()
 ctor More...
 
 ~LuaMap ()
 dtor More...
 
void clearDanger (void)
 Clear danger map. More...
 
bool setDanger (int xpos, int ypos, int dangerLevel)
 set dangerlevel at xpos ypos More...
 
void setPlayer (Vector3f pos)
 set player position More...
 
std::vector< Vector2fpathfind (Vector2f root, Vector2f target, bool throughBreakable) const
 A star pathfinding between two points. More...
 
Vector2f findSafeSpace (const std::vector< std::vector< int >> &dangerMap) const
 find a safe space for current player More...
 

Static Public Member Functions

static int getMap (lua_State *L)
 push table of table of the map More...
 
static int getDanger (lua_State *L)
 push table of table of the danger map More...
 
static int getPath (lua_State *L)
 get array of nodes, path from a to b More...
 
static int getPlayer (lua_State *L)
 get player pos More...
 
static int getPlayerRound (lua_State *L)
 get rounded player pos More...
 
static int getClosestSafeSpace (lua_State *L)
 get closest safe space of player More...
 
static int getDangerLevelPlayer (lua_State *L)
 get danger level of player More...
 
static int getDangerLevel (lua_State *L)
 is xpos ypos in danger More...
 
static int getBlockType (lua_State *L)
 get block type at x y More...
 
static int canPutBomb (lua_State *L)
 Check if current player can put a bomb with an escape. More...
 
static int getRadius (lua_State *L)
 Get current explosion radius of the player. More...
 
static int getEnemies (lua_State *L)
 Get enemies position. More...
 
static int getEnemiesRound (lua_State *L)
 Get enemies position rounded. More...
 

Public Attributes

std::vector< std::vector< int > > _map
 map blocks in 2D grid More...
 
std::vector< std::vector< int > > _danger
 dangers in 2D grid More...
 
Vector2f _player
 player position More...
 
std::vector< Vector2f_enemies
 other players position More...
 
Vector2f _roundedPlayer
 rounded player position More...
 
int currRadius
 Explosion radius of current player. More...
 

Private Member Functions

std::vector< Vector2ffillPath (std::vector< Vector2f > &path, std::unordered_map< Vector2f, Vector2f > &cameFrom, Vector2f node) const
 unwind path for a_star More...
 
std::vector< Vector2fgetNeighbors (Vector2f node, bool throughBreakable) const
 get neighbors of node for a_star More...
 

Private Attributes

std::vector< Vector2f_dirs
 

Constructor & Destructor Documentation

◆ LuaMap()

BBM::LuaMap::LuaMap ( )

ctor

◆ ~LuaMap()

BBM::LuaMap::~LuaMap ( )

dtor

Member Function Documentation

◆ canPutBomb()

int BBM::LuaMap::canPutBomb ( lua_State *  L)
static

Check if current player can put a bomb with an escape.

◆ clearDanger()

void BBM::LuaMap::clearDanger ( void  )

Clear danger map.

◆ fillPath()

std::vector< Vector2f > BBM::LuaMap::fillPath ( std::vector< Vector2f > &  path,
std::unordered_map< Vector2f, Vector2f > &  cameFrom,
Vector2f  node 
) const
private

unwind path for a_star

◆ findSafeSpace()

Vector2f BBM::LuaMap::findSafeSpace ( const std::vector< std::vector< int >> &  dangerMap) const

find a safe space for current player

◆ getBlockType()

int BBM::LuaMap::getBlockType ( lua_State *  L)
static

get block type at x y

◆ getClosestSafeSpace()

int BBM::LuaMap::getClosestSafeSpace ( lua_State *  L)
static

get closest safe space of player

◆ getDanger()

int BBM::LuaMap::getDanger ( lua_State *  L)
static

push table of table of the danger map

◆ getDangerLevel()

int BBM::LuaMap::getDangerLevel ( lua_State *  L)
static

is xpos ypos in danger

◆ getDangerLevelPlayer()

int BBM::LuaMap::getDangerLevelPlayer ( lua_State *  L)
static

get danger level of player

◆ getEnemies()

int BBM::LuaMap::getEnemies ( lua_State *  L)
static

Get enemies position.

◆ getEnemiesRound()

int BBM::LuaMap::getEnemiesRound ( lua_State *  L)
static

Get enemies position rounded.

◆ getMap()

int BBM::LuaMap::getMap ( lua_State *  L)
static

push table of table of the map

◆ getNeighbors()

std::vector< Vector2f > BBM::LuaMap::getNeighbors ( Vector2f  node,
bool  throughBreakable 
) const
private

get neighbors of node for a_star

◆ getPath()

int BBM::LuaMap::getPath ( lua_State *  L)
static

get array of nodes, path from a to b

◆ getPlayer()

int BBM::LuaMap::getPlayer ( lua_State *  L)
static

get player pos

◆ getPlayerRound()

int BBM::LuaMap::getPlayerRound ( lua_State *  L)
static

get rounded player pos

◆ getRadius()

int BBM::LuaMap::getRadius ( lua_State *  L)
static

Get current explosion radius of the player.

◆ pathfind()

std::vector< Vector2f > BBM::LuaMap::pathfind ( Vector2f  root,
Vector2f  target,
bool  throughBreakable 
) const

A star pathfinding between two points.

◆ setDanger()

bool BBM::LuaMap::setDanger ( int  xpos,
int  ypos,
int  dangerLevel 
)

set dangerlevel at xpos ypos

◆ setPlayer()

void BBM::LuaMap::setPlayer ( Vector3f  pos)

set player position

Member Data Documentation

◆ _danger

std::vector<std::vector<int> > BBM::LuaMap::_danger

dangers in 2D grid

◆ _dirs

std::vector<Vector2f> BBM::LuaMap::_dirs
private
Initial value:
= {
Vector2f(1, 0), Vector2f(-1, 0), Vector2f(0, 1), Vector2f(0, -1)
}

◆ _enemies

std::vector<Vector2f> BBM::LuaMap::_enemies

other players position

◆ _map

std::vector<std::vector<int> > BBM::LuaMap::_map

map blocks in 2D grid

◆ _player

Vector2f BBM::LuaMap::_player

player position

◆ _roundedPlayer

Vector2f BBM::LuaMap::_roundedPlayer

rounded player position

◆ currRadius

int BBM::LuaMap::currRadius

Explosion radius of current player.


The documentation for this class was generated from the following files:
BBM::Vector2f
Vector2< float > Vector2f
Definition: Vector2.hpp:178