mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
initial commit for rooms
This commit is contained in:
parent
76a13be3c3
commit
d8d4563292
22 changed files with 428 additions and 452 deletions
|
|
@ -6,7 +6,7 @@
|
|||
#include <QMap>
|
||||
|
||||
class Server_Game;
|
||||
class Server_ChatChannel;
|
||||
class Server_Room;
|
||||
class Server_ProtocolHandler;
|
||||
class ServerInfo_User;
|
||||
|
||||
|
|
@ -18,22 +18,21 @@ class Server : public QObject
|
|||
signals:
|
||||
void pingClockTimeout();
|
||||
private slots:
|
||||
void gameClosing();
|
||||
void broadcastChannelUpdate();
|
||||
void gameClosing(int gameId);
|
||||
void broadcastRoomUpdate();
|
||||
public:
|
||||
Server(QObject *parent = 0);
|
||||
~Server();
|
||||
AuthenticationResult loginUser(Server_ProtocolHandler *session, QString &name, const QString &password);
|
||||
QList<Server_Game *> getGames() const { return games.values(); }
|
||||
Server_Game *getGame(int gameId) const;
|
||||
const QMap<QString, Server_ChatChannel *> &getChatChannels() { return chatChannels; }
|
||||
void broadcastGameListUpdate(Server_Game *game);
|
||||
const QMap<int, Server_Room *> &getRooms() { return rooms; }
|
||||
int getNextGameId() { return nextGameId++; }
|
||||
|
||||
const QMap<QString, Server_ProtocolHandler *> &getUsers() const { return users; }
|
||||
void addClient(Server_ProtocolHandler *player);
|
||||
void removeClient(Server_ProtocolHandler *player);
|
||||
virtual QString getLoginMessage() const = 0;
|
||||
Server_Game *createGame(const QString &description, const QString &password, int maxPlayers, bool spectatorsAllowed, bool spectatorsNeedPassword, bool spectatorsCanTalk, bool spectatorsSeeEverything, Server_ProtocolHandler *creator);
|
||||
|
||||
virtual bool getGameShouldPing() const = 0;
|
||||
virtual int getMaxGameInactivityTime() const = 0;
|
||||
|
|
@ -42,12 +41,12 @@ protected:
|
|||
QMap<int, Server_Game *> games;
|
||||
QList<Server_ProtocolHandler *> clients;
|
||||
QMap<QString, Server_ProtocolHandler *> users;
|
||||
QMap<QString, Server_ChatChannel *> chatChannels;
|
||||
QMap<int, Server_Room *> rooms;
|
||||
|
||||
virtual AuthenticationResult checkUserPassword(const QString &user, const QString &password) = 0;
|
||||
virtual ServerInfo_User *getUserData(const QString &name) = 0;
|
||||
int nextGameId;
|
||||
void addChatChannel(Server_ChatChannel *newChannel);
|
||||
void addRoom(Server_Room *newRoom);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue