mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-14 10:04:46 -07:00
initial commit for rooms
This commit is contained in:
parent
76a13be3c3
commit
d8d4563292
22 changed files with 428 additions and 452 deletions
48
common/server_room.h
Normal file
48
common/server_room.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef SERVER_ROOM_H
|
||||
#define SERVER_ROOM_H
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
class Server_ProtocolHandler;
|
||||
class RoomEvent;
|
||||
class ServerInfo_User;
|
||||
class Server_Game;
|
||||
class Server;
|
||||
|
||||
class Server_Room : public QObject, public QList<Server_ProtocolHandler *> {
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void roomInfoChanged();
|
||||
void gameCreated(Server_Game *game);
|
||||
void gameClosing(int gameId);
|
||||
private:
|
||||
int id;
|
||||
QString name;
|
||||
QString description;
|
||||
bool autoJoin;
|
||||
QString joinMessage;
|
||||
QMap<int, Server_Game *> games;
|
||||
private slots:
|
||||
void removeGame();
|
||||
public:
|
||||
Server_Room(int _id, const QString &_name, const QString &_description, bool _autoJoin, const QString &_joinMessage, Server *parent);
|
||||
int getId() const { return id; }
|
||||
QString getName() const { return name; }
|
||||
QString getDescription() const { return description; }
|
||||
bool getAutoJoin() const { return autoJoin; }
|
||||
const QMap<int, Server_Game *> &getGames() const { return games; }
|
||||
Server *getServer() const;
|
||||
|
||||
QList<ServerInfo_User *> addClient(Server_ProtocolHandler *client);
|
||||
void removeClient(Server_ProtocolHandler *client);
|
||||
void say(Server_ProtocolHandler *client, const QString &s);
|
||||
void broadcastGameListUpdate(Server_Game *game);
|
||||
Server_Game *createGame(const QString &description, const QString &password, int maxPlayers, bool spectatorsAllowed, bool spectatorsNeedPassword, bool spectatorsCanTalk, bool spectatorsSeeEverything, Server_ProtocolHandler *creator);
|
||||
|
||||
void sendRoomEvent(RoomEvent *event);
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue