Room
Public member functions
// Construct a new Room object
Room(u_int id, std::shared_ptr<Client> client, Levels &levels, const std::vector<std::shared_ptr<Client>> &allClients, bool privateRoom = false);
// Get the state of the room (WAIT | RUN | END | STOPPED)
State getState() const;
// Get the id of the room
u_int getId() const;
// Get the number of players in the room
unsigned int getNbPlayer() const;
// Get the progress of the game
unsigned int getProgress() const;
// Get max number of players allowed in the room
unsigned int getMaxPlayer() const;
// Add a new player to the room
void addPlayer(std::shared_ptr<Client> client);
// remove a player from the room
void removePlayer(std::shared_ptr<Client> client);
// Move a player in the room
void movePlayer(std::shared_ptr<Client> client, char move, char nbr = 1);
// Checks if a client is in the room
bool isClientInRoom(std::shared_ptr<Client> client);
// Get the player associated with a client
Player &getPlayer(std::shared_ptr<Client> client);
// Send a packet to all players in the room
void sendToAll(const Stream &stream);
// Get the id of the next missile to create
u_int &getMissilesIds();
// Add a monster in the room
void addMonster(IEntity::Type type, int x, int y);
// Get the position of the nearest player from an entity
std::pair<short, short> getNearestPlayerPos(const IEntity &entity);
// Check if the room is private
bool isPrivate() const;
// Check if the it remain monsters in the room
bool isMonster() const;
// Get the id of the next Bomb to create
size_t &getBombIds();
// Get the id of the next Laser to create
size_t &getLaserIds();
// Get the id of the next Ray to create
size_t &getRayIds();
// Apply damage to all monsters in a zone
void degInZone(float x, float y, size_t radius, Player &player);
// Get the Players object
std::vector<std::unique_ptr<Player>> &getPlayers();
// Send a message in the chat
void sendChat(std::shared_ptr<Client> client, const std::string &message);Public member attributes
Member functions documentation
Constructor
Parameters
getState
Return value
getId
Return value
getNbPlayer
Return value
getProgress
Return value
getMaxPlayer
Return value
addPlayer
Parameters
removePlayer
Parameters
movePlayer
Parameters
isClientInRoom
Parameters
Return value
getPlayer
Parameters
Return value
sendToAll
Parameters
getMissilesIds
Return value
addMonster
Parameters
getNearestPlayerPos
Parameters
Return value
isPrivate
Return value
isMonster
Return value
getBombIds
Return value
getLaserIds
Return value
getRayIds
Return value
degInZone
Parameters
getPlayers
Return value
sendChat
Parameters
Last updated