mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
more ISL code, mutex fixes
This commit is contained in:
parent
0ae18d7b2e
commit
572e4eaafa
9 changed files with 107 additions and 48 deletions
|
|
@ -6,7 +6,9 @@
|
|||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QMutex>
|
||||
#include <QMetaType>
|
||||
#include "pb/serverinfo_room.pb.h"
|
||||
#include "serverinfo_user_container.h"
|
||||
|
||||
class Server_ProtocolHandler;
|
||||
class RoomEvent;
|
||||
|
|
@ -19,7 +21,8 @@ class Server;
|
|||
class Server_Room : public QObject {
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void roomInfoChanged();
|
||||
void roomInfoChanged(ServerInfo_Room roomInfo);
|
||||
void gameListChanged(ServerInfo_Game gameInfo);
|
||||
private:
|
||||
int id;
|
||||
QString name;
|
||||
|
|
@ -28,7 +31,11 @@ private:
|
|||
QString joinMessage;
|
||||
QStringList gameTypes;
|
||||
QMap<int, Server_Game *> games;
|
||||
QMap<int, ServerInfo_Game> externalGames;
|
||||
QList<Server_ProtocolHandler *> userList;
|
||||
QMap<QString, ServerInfo_User_Container> externalUsers;
|
||||
private slots:
|
||||
void broadcastGameListUpdate(ServerInfo_Game gameInfo);
|
||||
public:
|
||||
mutable QMutex roomMutex;
|
||||
Server_Room(int _id, const QString &_name, const QString &_description, bool _autoJoin, const QString &_joinMessage, const QStringList &_gameTypes, Server *parent);
|
||||
|
|
@ -41,19 +48,26 @@ public:
|
|||
const QStringList &getGameTypes() const { return gameTypes; }
|
||||
const QMap<int, Server_Game *> &getGames() const { return games; }
|
||||
Server *getServer() const;
|
||||
ServerInfo_Room getInfo(bool complete, bool showGameTypes = false, bool updating = false) const;
|
||||
ServerInfo_Room getInfo(bool complete, bool showGameTypes = false, bool updating = false, bool includeExternalData = true) const;
|
||||
int getGamesCreatedByUser(const QString &name) const;
|
||||
QList<ServerInfo_Game> getGamesOfUser(const QString &name) const;
|
||||
|
||||
void addClient(Server_ProtocolHandler *client);
|
||||
void removeClient(Server_ProtocolHandler *client);
|
||||
|
||||
void addExternalUser(const ServerInfo_User &userInfo);
|
||||
void removeExternalUser(const QString &name);
|
||||
|
||||
void say(Server_ProtocolHandler *client, const QString &s);
|
||||
void broadcastGameListUpdate(Server_Game *game);
|
||||
Server_Game *createGame(const QString &description, const QString &password, int maxPlayers, const QList<int> &_gameTypes, bool onlyBuddies, bool onlyRegistered, bool spectatorsAllowed, bool spectatorsNeedPassword, bool spectatorsCanTalk, bool spectatorsSeeEverything, Server_ProtocolHandler *creator);
|
||||
|
||||
void addGame(Server_Game *game);
|
||||
void removeGame(Server_Game *game);
|
||||
|
||||
void sendRoomEvent(RoomEvent *event);
|
||||
void sendRoomEvent(RoomEvent *event, bool sendToIsl = true);
|
||||
RoomEvent *prepareRoomEvent(const ::google::protobuf::Message &roomEvent);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ServerInfo_Game)
|
||||
Q_DECLARE_METATYPE(ServerInfo_Room)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue