Room change, room list with flags

This commit is contained in:
Torsten Schulz
2017-07-24 23:41:12 +02:00
parent 105232a9e3
commit b9d2b3e347
6 changed files with 102 additions and 7 deletions

11
room.h
View File

@@ -22,7 +22,8 @@ namespace Yc {
none = 0,
dice = 1,
poker = 2,
rounds = 4
rounds = 4,
password = 8
};
Room(Server *parent, Json::Value roomParams);
@@ -32,7 +33,8 @@ namespace Yc {
bool addUser(std::string userName, std::string color, std::string password, int socket);
bool addUser(User *user, std::string password);
bool userNameExists(std::string userName);
void removeUser(std::string _token);
void removeUser(std::string _token, bool silent = false);
void removeUser(User *user, bool silent = false);
void setStop();
void addMessage(User::MsgType type, const char* messageText, std::string userName = "", std::string color = "");
void addMessage(User::MsgType type, std::string messageText, std::string userName = "", std::string color = "");
@@ -42,6 +44,10 @@ namespace Yc {
bool canDice();
unsigned int addDice(User *user, int diceValue);
bool accessAllowed(std::string userName, std::string password);
bool userIsInRoom(std::string userName);
void addUserWhenQueueEmpty(User *user);
bool userToNewRoom(User *user, std::string newRoom, std::string password);
unsigned int flags();
private:
struct Message {
User::MsgType type;
@@ -65,6 +71,7 @@ namespace Yc {
time_t _lastRoundEnd;
int _roundLength;
std::vector<std::pair<User *, int>> _diceValues;
std::mutex mutexQueue;
void _handleDice();
void _startDiceRound();
void _endDiceRound();