Game
The Game class is used to manage all the different rooms in the program.
Public member functions
Member functions documentation
Constructor
The constructor of the Game class.
createRoom
This method creates a new room with a client (player).
Parameters
packet
: A reference to the packet containing the information about the client that wants to create a room.privateRoom
: A boolean which is true if the room must be private, false otherwise. (default: false)
searchRoom
This method searches a room for the client that sent the command. If no room is found or all rooms are full, it will create a new one and add the client to it.
Parameters
packet
: A reference to the packet containing the information about the client that wants to search a room.
getRoom
This method returns a reference to a room. The room can be find by its id or by a client that is in it.
Parameters
id
: The id of the room to get.client
: A shared pointer to the client that is in the room to get.
Returns
A reference to the room that has the id or the client passed as parameter.