mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-21 23:00:24 -08:00
rooms work mostly
This commit is contained in:
@@ -20,18 +20,6 @@ enum ResponseCode { RespNothing, RespOk, RespInvalidCommand, RespInvalidData, Re
|
||||
// list index, whereas cards in any other zone are referenced by their ids.
|
||||
enum ZoneType { PrivateZone, PublicZone, HiddenZone };
|
||||
|
||||
class ServerInfo_Room : public SerializableItem_Map {
|
||||
public:
|
||||
ServerInfo_Room(int _id = -1, const QString &_name = QString(), const QString &_description = QString(), int _gameCount = -1, int _playerCount = -1, bool _autoJoin = false);
|
||||
static SerializableItem *newItem() { return new ServerInfo_Room; }
|
||||
int getRoomId() const { return static_cast<SerializableItem_Int *>(itemMap.value("room_id"))->getData(); }
|
||||
QString getName() const { return static_cast<SerializableItem_String *>(itemMap.value("name"))->getData(); }
|
||||
QString getDescription() const { return static_cast<SerializableItem_String *>(itemMap.value("description"))->getData(); }
|
||||
int getGameCount() const { return static_cast<SerializableItem_Int *>(itemMap.value("game_count"))->getData(); }
|
||||
int getPlayerCount() const { return static_cast<SerializableItem_Int *>(itemMap.value("player_count"))->getData(); }
|
||||
bool getAutoJoin() const { return static_cast<SerializableItem_Bool *>(itemMap.value("auto_join"))->getData(); }
|
||||
};
|
||||
|
||||
class ServerInfo_User : public SerializableItem_Map {
|
||||
public:
|
||||
enum UserLevelFlags {
|
||||
@@ -42,7 +30,7 @@ public:
|
||||
IsAdmin = 0x08
|
||||
};
|
||||
ServerInfo_User(const QString &_name = QString(), int _userLevel = IsNothing, const QString &_country = QString(), const QByteArray &_avatarBmp = QByteArray());
|
||||
ServerInfo_User(const ServerInfo_User *other);
|
||||
ServerInfo_User(const ServerInfo_User *other, bool complete = true);
|
||||
static SerializableItem *newItem() { return new ServerInfo_User; }
|
||||
QString getName() const { return static_cast<SerializableItem_String *>(itemMap.value("name"))->getData(); }
|
||||
int getUserLevel() const { return static_cast<SerializableItem_Int *>(itemMap.value("userlevel"))->getData(); }
|
||||
@@ -66,6 +54,25 @@ public:
|
||||
int getSpectatorCount() const { return static_cast<SerializableItem_Int *>(itemMap.value("spectator_count"))->getData(); }
|
||||
};
|
||||
|
||||
class ServerInfo_Room : public SerializableItem_Map {
|
||||
private:
|
||||
QList<ServerInfo_Game *> gameList;
|
||||
QList<ServerInfo_User *> userList;
|
||||
protected:
|
||||
void extractData();
|
||||
public:
|
||||
ServerInfo_Room(int _id = -1, const QString &_name = QString(), const QString &_description = QString(), int _gameCount = -1, int _playerCount = -1, bool _autoJoin = false, const QList<ServerInfo_Game *> &_gameList = QList<ServerInfo_Game *>(), const QList<ServerInfo_User *> &_userList = QList<ServerInfo_User *>());
|
||||
static SerializableItem *newItem() { return new ServerInfo_Room; }
|
||||
int getRoomId() const { return static_cast<SerializableItem_Int *>(itemMap.value("room_id"))->getData(); }
|
||||
QString getName() const { return static_cast<SerializableItem_String *>(itemMap.value("name"))->getData(); }
|
||||
QString getDescription() const { return static_cast<SerializableItem_String *>(itemMap.value("description"))->getData(); }
|
||||
int getGameCount() const { return static_cast<SerializableItem_Int *>(itemMap.value("game_count"))->getData(); }
|
||||
int getPlayerCount() const { return static_cast<SerializableItem_Int *>(itemMap.value("player_count"))->getData(); }
|
||||
bool getAutoJoin() const { return static_cast<SerializableItem_Bool *>(itemMap.value("auto_join"))->getData(); }
|
||||
const QList<ServerInfo_Game *> &getGameList() const { return gameList; }
|
||||
const QList<ServerInfo_User *> &getUserList() const { return userList; }
|
||||
};
|
||||
|
||||
class ServerInfo_CardCounter : public SerializableItem_Map {
|
||||
public:
|
||||
ServerInfo_CardCounter(int _id = -1, int _value = 0);
|
||||
|
||||
Reference in New Issue
Block a user