mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-24 15:43:54 -07:00
boom
This commit is contained in:
parent
d329376e93
commit
1c2aa15b22
38 changed files with 638 additions and 1651 deletions
42
common/server.h
Normal file
42
common/server.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef SERVER_H
|
||||
#define SERVER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
|
||||
class Server_Game;
|
||||
class Server_ChatChannel;
|
||||
class Server_ProtocolHandler;
|
||||
|
||||
enum AuthenticationResult { PasswordWrong = 0, PasswordRight = 1, UnknownUser = 2 };
|
||||
|
||||
class Server : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void gameClosing();
|
||||
void broadcastChannelUpdate();
|
||||
public:
|
||||
Server(QObject *parent = 0);
|
||||
~Server();
|
||||
virtual AuthenticationResult checkUserPassword(const QString &user, const QString &password) = 0;
|
||||
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);
|
||||
|
||||
void addClient(Server_ProtocolHandler *player);
|
||||
void removeClient(Server_ProtocolHandler *player);
|
||||
virtual QStringList getLoginMessage() const = 0;
|
||||
Server_Game *createGame(const QString &description, const QString &password, int maxPlayers, bool spectatorsAllowed, const QString &playerName);
|
||||
private:
|
||||
QMap<int, Server_Game *> games;
|
||||
QList<Server_ProtocolHandler *> clients;
|
||||
QMap<QString, Server_ChatChannel *> chatChannels;
|
||||
protected:
|
||||
int nextGameId;
|
||||
void addChatChannel(Server_ChatChannel *newChannel);
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue