everything compiles again; enough for today

This commit is contained in:
Max-Wilhelm Bruker
2009-11-12 00:09:24 +01:00
parent dd5ae4d74d
commit cb0e4d07e4
29 changed files with 340 additions and 766 deletions

View File

@@ -7,6 +7,7 @@
#include <QObject>
#include <QDebug>
#include "protocol_item_ids.h"
#include "protocol_datastructures.h"
class QXmlStreamReader;
class QXmlStreamWriter;
@@ -52,6 +53,7 @@ class Command : public ProtocolItem {
Q_OBJECT
private:
int cmdId;
int ticks;
static int lastCmdId;
protected:
QString getItemType() const { return "cmd"; }
@@ -59,6 +61,7 @@ protected:
public:
Command(const QString &_itemName = QString(), int _cmdId = -1);
int getCmdId() const { return cmdId; }
int tick() { return ++ticks; }
};
class InvalidCommand : public Command {
@@ -106,8 +109,6 @@ public:
class ProtocolResponse : public ProtocolItem {
Q_OBJECT
public:
enum ResponseCode { RespNothing, RespOk, RespInvalidCommand, RespNameNotFound, RespLoginNeeded, RespContextError, RespWrongPassword, RespSpectatorsNotAllowed };
private:
int cmdId;
ResponseCode responseCode;
@@ -158,31 +159,16 @@ public:
class Event_ChatListChannels : public GenericEvent {
Q_OBJECT
public:
class ChannelInfo {
private:
QString name;
QString description;
int playerCount;
bool autoJoin;
public:
ChannelInfo(const QString &_name, const QString &_description, int _playerCount, bool _autoJoin)
: name(_name), description(_description), playerCount(_playerCount), autoJoin(_autoJoin) { }
QString getName() const { return name; }
QString getDescription() const { return description; }
int getPlayerCount() const { return playerCount; }
bool getAutoJoin() const { return autoJoin; }
};
private:
QList<ChannelInfo> channelList;
QList<ServerChatChannelInfo> channelList;
public:
Event_ChatListChannels() : GenericEvent("chat_list_channels") { }
int getItemId() const { return ItemId_Event_ChatListChannels; }
void addChannel(const QString &_name, const QString &_description, int _playerCount, bool _autoJoin)
{
channelList.append(ChannelInfo(_name, _description, _playerCount, _autoJoin));
channelList.append(ServerChatChannelInfo(_name, _description, _playerCount, _autoJoin));
}
const QList<ChannelInfo> &getChannelList() const { return channelList; }
const QList<ServerChatChannelInfo> &getChannelList() const { return channelList; }
bool readElement(QXmlStreamReader *xml);
void writeElement(QXmlStreamWriter *xml);
@@ -190,25 +176,16 @@ public:
class Event_ChatListPlayers : public ChatEvent {
Q_OBJECT
public:
class PlayerInfo {
private:
QString name;
public:
PlayerInfo(const QString &_name)
: name(_name) { }
QString getName() const { return name; }
};
private:
QList<PlayerInfo> playerList;
QList<ServerPlayerInfo> playerList;
public:
Event_ChatListPlayers(const QString &_channel) : ChatEvent("chat_list_players", _channel) { }
int getItemId() const { return ItemId_Event_ChatListPlayers; }
void addPlayer(const QString &_name)
{
playerList.append(PlayerInfo(_name));
playerList.append(ServerPlayerInfo(_name));
}
const QList<PlayerInfo> &getPlayerList() const { return playerList; }
const QList<ServerPlayerInfo> &getPlayerList() const { return playerList; }
bool readElement(QXmlStreamReader *xml);
void writeElement(QXmlStreamWriter *xml);
@@ -216,39 +193,16 @@ public:
class Event_ListGames : public GenericEvent {
Q_OBJECT
public:
class GameInfo {
private:
int gameId;
QString description;
bool hasPassword;
int playerCount;
int maxPlayers;
QString creatorName;
bool spectatorsAllowed;
int spectatorCount;
public:
GameInfo(int _gameId, const QString &_description, bool _hasPassword, int _playerCount, int _maxPlayers, const QString &_creatorName, bool _spectatorsAllowed, int _spectatorCount)
: gameId(_gameId), description(_description), hasPassword(_hasPassword), playerCount(_playerCount), maxPlayers(_maxPlayers), creatorName(_creatorName), spectatorsAllowed(_spectatorsAllowed), spectatorCount(_spectatorCount) { }
int getGameId() const { return gameId; }
QString getDescription() const { return description; }
bool getHasPassword() const { return hasPassword; }
int getPlayerCount() const { return playerCount; }
int getMaxPlayers() const { return maxPlayers; }
QString getCreatorName() const { return creatorName; }
bool getSpectatorsAllowed() const { return spectatorsAllowed; }
int getSpectatorCount() const { return spectatorCount; }
};
private:
QList<GameInfo> gameList;
QList<ServerGameInfo> gameList;
public:
Event_ListGames() : GenericEvent("list_games") { }
int getItemId() const { return ItemId_Event_ListGames; }
void addGame(int _gameId, const QString &_description, bool _hasPassword, int _playerCount, int _maxPlayers, const QString &_creatorName, bool _spectatorsAllowed, int _spectatorCount)
{
gameList.append(GameInfo(_gameId, _description, _hasPassword, _playerCount, _maxPlayers, _creatorName, _spectatorsAllowed, _spectatorCount));
gameList.append(ServerGameInfo(_gameId, _description, _hasPassword, _playerCount, _maxPlayers, _creatorName, _spectatorsAllowed, _spectatorCount));
}
const QList<GameInfo> &getGameList() const { return gameList; }
const QList<ServerGameInfo> &getGameList() const { return gameList; }
bool readElement(QXmlStreamReader *xml);
void writeElement(QXmlStreamWriter *xml);