chat event

This commit is contained in:
Max-Wilhelm Bruker 2009-10-27 02:57:54 +01:00
parent e1fc3ddb88
commit d329376e93
7 changed files with 94 additions and 73 deletions

View file

@ -6,6 +6,8 @@ TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
MOC_DIR = build
OBJECTS_DIR = build
# Input
HEADERS += protocol.h widget.h protocol_items.h

View file

@ -121,16 +121,25 @@ void GameEvent::extractParameters()
gameId = parameters["game_id"].toInt(&ok);
if (!ok)
gameId = -1;
isPublic = parameters["is_public"].toInt();
playerId = parameters["player_id"].toInt(&ok);
if (!ok)
playerId = -1;
}
GameEvent::GameEvent(const QString &_eventName, int _gameId, bool _isPublic, int _playerId)
: ProtocolItem(_eventName), gameId(_gameId), isPublic(_isPublic), playerId(_playerId)
GameEvent::GameEvent(const QString &_eventName, int _gameId, int _playerId)
: ProtocolItem(_eventName), gameId(_gameId), playerId(_playerId)
{
setParameter("game_id", gameId);
setParameter("is_public", isPublic);
setParameter("player_id", playerId);
}
void ChatEvent::extractParameters()
{
channel = parameters["channel"];
}
ChatEvent::ChatEvent(const QString &_eventName, const QString &_channel)
: ProtocolItem(_eventName), channel(_channel)
{
setParameter("channel", channel);
}

View file

@ -103,13 +103,23 @@ class GameEvent : public ProtocolItem {
Q_OBJECT
private:
int gameId;
bool isPublic;
int playerId;
protected:
QString getItemType() const { return "game_event"; }
void extractParameters();
public:
GameEvent(const QString &_eventName, int _gameId, bool _isPublic, int _playerId);
GameEvent(const QString &_eventName, int _gameId, int _playerId);
};
class ChatEvent : public ProtocolItem {
Q_OBJECT
private:
QString channel;
protected:
QString getItemType() const { return "chat_event"; }
void extractParameters();
public:
ChatEvent(const QString &_eventName, const QString &_channel);
};
#endif

View file

@ -305,8 +305,8 @@ Command_SubmitDeck::Command_SubmitDeck(int _gameId)
: GameCommand("submit_deck", _gameId)
{
}
Event_Say::Event_Say(int _gameId, bool _isPublic, int _playerId, const QString &_message)
: GameEvent("say", _gameId, _isPublic, _playerId), message(_message)
Event_Say::Event_Say(int _gameId, int _playerId, const QString &_message)
: GameEvent("say", _gameId, _playerId), message(_message)
{
setParameter("message", message);
}
@ -315,8 +315,8 @@ void Event_Say::extractParameters()
GameEvent::extractParameters();
message = parameters["message"];
}
Event_Join::Event_Join(int _gameId, bool _isPublic, int _playerId, const QString &_playerName, bool _spectator)
: GameEvent("join", _gameId, _isPublic, _playerId), playerName(_playerName), spectator(_spectator)
Event_Join::Event_Join(int _gameId, int _playerId, const QString &_playerName, bool _spectator)
: GameEvent("join", _gameId, _playerId), playerName(_playerName), spectator(_spectator)
{
setParameter("player_name", playerName);
setParameter("spectator", spectator);
@ -327,20 +327,20 @@ void Event_Join::extractParameters()
playerName = parameters["player_name"];
spectator = (parameters["spectator"] == "1");
}
Event_Leave::Event_Leave(int _gameId, bool _isPublic, int _playerId)
: GameEvent("leave", _gameId, _isPublic, _playerId)
Event_Leave::Event_Leave(int _gameId, int _playerId)
: GameEvent("leave", _gameId, _playerId)
{
}
Event_GameClosed::Event_GameClosed(int _gameId, bool _isPublic, int _playerId)
: GameEvent("game_closed", _gameId, _isPublic, _playerId)
Event_GameClosed::Event_GameClosed(int _gameId, int _playerId)
: GameEvent("game_closed", _gameId, _playerId)
{
}
Event_ReadyStart::Event_ReadyStart(int _gameId, bool _isPublic, int _playerId)
: GameEvent("ready_start", _gameId, _isPublic, _playerId)
Event_ReadyStart::Event_ReadyStart(int _gameId, int _playerId)
: GameEvent("ready_start", _gameId, _playerId)
{
}
Event_SetupZones::Event_SetupZones(int _gameId, bool _isPublic, int _playerId, int _deckSize, int _sbSize)
: GameEvent("setup_zones", _gameId, _isPublic, _playerId), deckSize(_deckSize), sbSize(_sbSize)
Event_SetupZones::Event_SetupZones(int _gameId, int _playerId, int _deckSize, int _sbSize)
: GameEvent("setup_zones", _gameId, _playerId), deckSize(_deckSize), sbSize(_sbSize)
{
setParameter("deck_size", deckSize);
setParameter("sb_size", sbSize);
@ -351,16 +351,16 @@ void Event_SetupZones::extractParameters()
deckSize = parameters["deck_size"].toInt();
sbSize = parameters["sb_size"].toInt();
}
Event_GameStart::Event_GameStart(int _gameId, bool _isPublic, int _playerId)
: GameEvent("game_start", _gameId, _isPublic, _playerId)
Event_GameStart::Event_GameStart(int _gameId, int _playerId)
: GameEvent("game_start", _gameId, _playerId)
{
}
Event_Shuffle::Event_Shuffle(int _gameId, bool _isPublic, int _playerId)
: GameEvent("shuffle", _gameId, _isPublic, _playerId)
Event_Shuffle::Event_Shuffle(int _gameId, int _playerId)
: GameEvent("shuffle", _gameId, _playerId)
{
}
Event_RollDie::Event_RollDie(int _gameId, bool _isPublic, int _playerId, int _sides, int _value)
: GameEvent("roll_die", _gameId, _isPublic, _playerId), sides(_sides), value(_value)
Event_RollDie::Event_RollDie(int _gameId, int _playerId, int _sides, int _value)
: GameEvent("roll_die", _gameId, _playerId), sides(_sides), value(_value)
{
setParameter("sides", sides);
setParameter("value", value);
@ -371,8 +371,8 @@ void Event_RollDie::extractParameters()
sides = parameters["sides"].toInt();
value = parameters["value"].toInt();
}
Event_MoveCard::Event_MoveCard(int _gameId, bool _isPublic, int _playerId, int _cardId, const QString &_cardName, const QString &_startZone, int _position, const QString &_targetZone, int _x, int _y, bool _faceDown)
: GameEvent("move_card", _gameId, _isPublic, _playerId), cardId(_cardId), cardName(_cardName), startZone(_startZone), position(_position), targetZone(_targetZone), x(_x), y(_y), faceDown(_faceDown)
Event_MoveCard::Event_MoveCard(int _gameId, int _playerId, int _cardId, const QString &_cardName, const QString &_startZone, int _position, const QString &_targetZone, int _x, int _y, bool _faceDown)
: GameEvent("move_card", _gameId, _playerId), cardId(_cardId), cardName(_cardName), startZone(_startZone), position(_position), targetZone(_targetZone), x(_x), y(_y), faceDown(_faceDown)
{
setParameter("card_id", cardId);
setParameter("card_name", cardName);
@ -395,8 +395,8 @@ void Event_MoveCard::extractParameters()
y = parameters["y"].toInt();
faceDown = (parameters["face_down"] == "1");
}
Event_CreateToken::Event_CreateToken(int _gameId, bool _isPublic, int _playerId, const QString &_zone, int _cardId, const QString &_cardName, const QString &_pt, int _x, int _y)
: GameEvent("create_token", _gameId, _isPublic, _playerId), zone(_zone), cardId(_cardId), cardName(_cardName), pt(_pt), x(_x), y(_y)
Event_CreateToken::Event_CreateToken(int _gameId, int _playerId, const QString &_zone, int _cardId, const QString &_cardName, const QString &_pt, int _x, int _y)
: GameEvent("create_token", _gameId, _playerId), zone(_zone), cardId(_cardId), cardName(_cardName), pt(_pt), x(_x), y(_y)
{
setParameter("zone", zone);
setParameter("card_id", cardId);
@ -415,8 +415,8 @@ void Event_CreateToken::extractParameters()
x = parameters["x"].toInt();
y = parameters["y"].toInt();
}
Event_CreateArrow::Event_CreateArrow(int _gameId, bool _isPublic, int _playerId, int _arrowId, int _startPlayerId, const QString &_startZone, int _startCardId, int _targetPlayerId, const QString &_targetZone, int _targetCardId, int _color)
: GameEvent("create_arrow", _gameId, _isPublic, _playerId), arrowId(_arrowId), startPlayerId(_startPlayerId), startZone(_startZone), startCardId(_startCardId), targetPlayerId(_targetPlayerId), targetZone(_targetZone), targetCardId(_targetCardId), color(_color)
Event_CreateArrow::Event_CreateArrow(int _gameId, int _playerId, int _arrowId, int _startPlayerId, const QString &_startZone, int _startCardId, int _targetPlayerId, const QString &_targetZone, int _targetCardId, int _color)
: GameEvent("create_arrow", _gameId, _playerId), arrowId(_arrowId), startPlayerId(_startPlayerId), startZone(_startZone), startCardId(_startCardId), targetPlayerId(_targetPlayerId), targetZone(_targetZone), targetCardId(_targetCardId), color(_color)
{
setParameter("arrow_id", arrowId);
setParameter("start_player_id", startPlayerId);
@ -439,8 +439,8 @@ void Event_CreateArrow::extractParameters()
targetCardId = parameters["target_card_id"].toInt();
color = parameters["color"].toInt();
}
Event_DeleteArrow::Event_DeleteArrow(int _gameId, bool _isPublic, int _playerId, int _arrowId)
: GameEvent("delete_arrow", _gameId, _isPublic, _playerId), arrowId(_arrowId)
Event_DeleteArrow::Event_DeleteArrow(int _gameId, int _playerId, int _arrowId)
: GameEvent("delete_arrow", _gameId, _playerId), arrowId(_arrowId)
{
setParameter("arrow_id", arrowId);
}
@ -449,8 +449,8 @@ void Event_DeleteArrow::extractParameters()
GameEvent::extractParameters();
arrowId = parameters["arrow_id"].toInt();
}
Event_SetCardAttr::Event_SetCardAttr(int _gameId, bool _isPublic, int _playerId, const QString &_zone, int _cardId, const QString &_attrName, const QString &_attrValue)
: GameEvent("set_card_attr", _gameId, _isPublic, _playerId), zone(_zone), cardId(_cardId), attrName(_attrName), attrValue(_attrValue)
Event_SetCardAttr::Event_SetCardAttr(int _gameId, int _playerId, const QString &_zone, int _cardId, const QString &_attrName, const QString &_attrValue)
: GameEvent("set_card_attr", _gameId, _playerId), zone(_zone), cardId(_cardId), attrName(_attrName), attrValue(_attrValue)
{
setParameter("zone", zone);
setParameter("card_id", cardId);
@ -465,8 +465,8 @@ void Event_SetCardAttr::extractParameters()
attrName = parameters["attr_name"];
attrValue = parameters["attr_value"];
}
Event_AddCounter::Event_AddCounter(int _gameId, bool _isPublic, int _playerId, int _counterId, const QString &_counterName, int _color, int _radius, int _value)
: GameEvent("add_counter", _gameId, _isPublic, _playerId), counterId(_counterId), counterName(_counterName), color(_color), radius(_radius), value(_value)
Event_AddCounter::Event_AddCounter(int _gameId, int _playerId, int _counterId, const QString &_counterName, int _color, int _radius, int _value)
: GameEvent("add_counter", _gameId, _playerId), counterId(_counterId), counterName(_counterName), color(_color), radius(_radius), value(_value)
{
setParameter("counter_id", counterId);
setParameter("counter_name", counterName);
@ -483,8 +483,8 @@ void Event_AddCounter::extractParameters()
radius = parameters["radius"].toInt();
value = parameters["value"].toInt();
}
Event_SetCounter::Event_SetCounter(int _gameId, bool _isPublic, int _playerId, int _counterId, int _value)
: GameEvent("set_counter", _gameId, _isPublic, _playerId), counterId(_counterId), value(_value)
Event_SetCounter::Event_SetCounter(int _gameId, int _playerId, int _counterId, int _value)
: GameEvent("set_counter", _gameId, _playerId), counterId(_counterId), value(_value)
{
setParameter("counter_id", counterId);
setParameter("value", value);
@ -495,8 +495,8 @@ void Event_SetCounter::extractParameters()
counterId = parameters["counter_id"].toInt();
value = parameters["value"].toInt();
}
Event_DelCounter::Event_DelCounter(int _gameId, bool _isPublic, int _playerId, int _counterId)
: GameEvent("del_counter", _gameId, _isPublic, _playerId), counterId(_counterId)
Event_DelCounter::Event_DelCounter(int _gameId, int _playerId, int _counterId)
: GameEvent("del_counter", _gameId, _playerId), counterId(_counterId)
{
setParameter("counter_id", counterId);
}
@ -505,8 +505,8 @@ void Event_DelCounter::extractParameters()
GameEvent::extractParameters();
counterId = parameters["counter_id"].toInt();
}
Event_SetActivePlayer::Event_SetActivePlayer(int _gameId, bool _isPublic, int _playerId, int _activePlayerId)
: GameEvent("set_active_player", _gameId, _isPublic, _playerId), activePlayerId(_activePlayerId)
Event_SetActivePlayer::Event_SetActivePlayer(int _gameId, int _playerId, int _activePlayerId)
: GameEvent("set_active_player", _gameId, _playerId), activePlayerId(_activePlayerId)
{
setParameter("active_player_id", activePlayerId);
}
@ -515,8 +515,8 @@ void Event_SetActivePlayer::extractParameters()
GameEvent::extractParameters();
activePlayerId = parameters["active_player_id"].toInt();
}
Event_SetActivePhase::Event_SetActivePhase(int _gameId, bool _isPublic, int _playerId, int _phase)
: GameEvent("set_active_phase", _gameId, _isPublic, _playerId), phase(_phase)
Event_SetActivePhase::Event_SetActivePhase(int _gameId, int _playerId, int _phase)
: GameEvent("set_active_phase", _gameId, _playerId), phase(_phase)
{
setParameter("phase", phase);
}
@ -525,8 +525,8 @@ void Event_SetActivePhase::extractParameters()
GameEvent::extractParameters();
phase = parameters["phase"].toInt();
}
Event_DumpZone::Event_DumpZone(int _gameId, bool _isPublic, int _playerId, int _zoneOwnerId, const QString &_zone, int _numberCards)
: GameEvent("dump_zone", _gameId, _isPublic, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone), numberCards(_numberCards)
Event_DumpZone::Event_DumpZone(int _gameId, int _playerId, int _zoneOwnerId, const QString &_zone, int _numberCards)
: GameEvent("dump_zone", _gameId, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone), numberCards(_numberCards)
{
setParameter("zone_owner_id", zoneOwnerId);
setParameter("zone", zone);
@ -539,8 +539,8 @@ void Event_DumpZone::extractParameters()
zone = parameters["zone"];
numberCards = parameters["number_cards"].toInt();
}
Event_StopDumpZone::Event_StopDumpZone(int _gameId, bool _isPublic, int _playerId, int _zoneOwnerId, const QString &_zone)
: GameEvent("stop_dump_zone", _gameId, _isPublic, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone)
Event_StopDumpZone::Event_StopDumpZone(int _gameId, int _playerId, int _zoneOwnerId, const QString &_zone)
: GameEvent("stop_dump_zone", _gameId, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone)
{
setParameter("zone_owner_id", zoneOwnerId);
setParameter("zone", zone);

View file

@ -362,7 +362,7 @@ class Event_Say : public GameEvent {
private:
QString message;
public:
Event_Say(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_message = QString());
Event_Say(int _gameId = -1, int _playerId = -1, const QString &_message = QString());
QString getMessage() const { return message; }
static ProtocolItem *newItem() { return new Event_Say; }
protected:
@ -374,7 +374,7 @@ private:
QString playerName;
bool spectator;
public:
Event_Join(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_playerName = QString(), bool _spectator = false);
Event_Join(int _gameId = -1, int _playerId = -1, const QString &_playerName = QString(), bool _spectator = false);
QString getPlayerName() const { return playerName; }
bool getSpectator() const { return spectator; }
static ProtocolItem *newItem() { return new Event_Join; }
@ -385,21 +385,21 @@ class Event_Leave : public GameEvent {
Q_OBJECT
private:
public:
Event_Leave(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
Event_Leave(int _gameId = -1, int _playerId = -1);
static ProtocolItem *newItem() { return new Event_Leave; }
};
class Event_GameClosed : public GameEvent {
Q_OBJECT
private:
public:
Event_GameClosed(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
Event_GameClosed(int _gameId = -1, int _playerId = -1);
static ProtocolItem *newItem() { return new Event_GameClosed; }
};
class Event_ReadyStart : public GameEvent {
Q_OBJECT
private:
public:
Event_ReadyStart(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
Event_ReadyStart(int _gameId = -1, int _playerId = -1);
static ProtocolItem *newItem() { return new Event_ReadyStart; }
};
class Event_SetupZones : public GameEvent {
@ -408,7 +408,7 @@ private:
int deckSize;
int sbSize;
public:
Event_SetupZones(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _deckSize = -1, int _sbSize = -1);
Event_SetupZones(int _gameId = -1, int _playerId = -1, int _deckSize = -1, int _sbSize = -1);
int getDeckSize() const { return deckSize; }
int getSbSize() const { return sbSize; }
static ProtocolItem *newItem() { return new Event_SetupZones; }
@ -419,14 +419,14 @@ class Event_GameStart : public GameEvent {
Q_OBJECT
private:
public:
Event_GameStart(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
Event_GameStart(int _gameId = -1, int _playerId = -1);
static ProtocolItem *newItem() { return new Event_GameStart; }
};
class Event_Shuffle : public GameEvent {
Q_OBJECT
private:
public:
Event_Shuffle(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
Event_Shuffle(int _gameId = -1, int _playerId = -1);
static ProtocolItem *newItem() { return new Event_Shuffle; }
};
class Event_RollDie : public GameEvent {
@ -435,7 +435,7 @@ private:
int sides;
int value;
public:
Event_RollDie(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _sides = -1, int _value = -1);
Event_RollDie(int _gameId = -1, int _playerId = -1, int _sides = -1, int _value = -1);
int getSides() const { return sides; }
int getValue() const { return value; }
static ProtocolItem *newItem() { return new Event_RollDie; }
@ -454,7 +454,7 @@ private:
int y;
bool faceDown;
public:
Event_MoveCard(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _cardId = -1, const QString &_cardName = QString(), const QString &_startZone = QString(), int _position = -1, const QString &_targetZone = QString(), int _x = -1, int _y = -1, bool _faceDown = false);
Event_MoveCard(int _gameId = -1, int _playerId = -1, int _cardId = -1, const QString &_cardName = QString(), const QString &_startZone = QString(), int _position = -1, const QString &_targetZone = QString(), int _x = -1, int _y = -1, bool _faceDown = false);
int getCardId() const { return cardId; }
QString getCardName() const { return cardName; }
QString getStartZone() const { return startZone; }
@ -477,7 +477,7 @@ private:
int x;
int y;
public:
Event_CreateToken(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_zone = QString(), int _cardId = -1, const QString &_cardName = QString(), const QString &_pt = QString(), int _x = -1, int _y = -1);
Event_CreateToken(int _gameId = -1, int _playerId = -1, const QString &_zone = QString(), int _cardId = -1, const QString &_cardName = QString(), const QString &_pt = QString(), int _x = -1, int _y = -1);
QString getZone() const { return zone; }
int getCardId() const { return cardId; }
QString getCardName() const { return cardName; }
@ -500,7 +500,7 @@ private:
int targetCardId;
int color;
public:
Event_CreateArrow(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _arrowId = -1, int _startPlayerId = -1, const QString &_startZone = QString(), int _startCardId = -1, int _targetPlayerId = -1, const QString &_targetZone = QString(), int _targetCardId = -1, int _color = -1);
Event_CreateArrow(int _gameId = -1, int _playerId = -1, int _arrowId = -1, int _startPlayerId = -1, const QString &_startZone = QString(), int _startCardId = -1, int _targetPlayerId = -1, const QString &_targetZone = QString(), int _targetCardId = -1, int _color = -1);
int getArrowId() const { return arrowId; }
int getStartPlayerId() const { return startPlayerId; }
QString getStartZone() const { return startZone; }
@ -518,7 +518,7 @@ class Event_DeleteArrow : public GameEvent {
private:
int arrowId;
public:
Event_DeleteArrow(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _arrowId = -1);
Event_DeleteArrow(int _gameId = -1, int _playerId = -1, int _arrowId = -1);
int getArrowId() const { return arrowId; }
static ProtocolItem *newItem() { return new Event_DeleteArrow; }
protected:
@ -532,7 +532,7 @@ private:
QString attrName;
QString attrValue;
public:
Event_SetCardAttr(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_zone = QString(), int _cardId = -1, const QString &_attrName = QString(), const QString &_attrValue = QString());
Event_SetCardAttr(int _gameId = -1, int _playerId = -1, const QString &_zone = QString(), int _cardId = -1, const QString &_attrName = QString(), const QString &_attrValue = QString());
QString getZone() const { return zone; }
int getCardId() const { return cardId; }
QString getAttrName() const { return attrName; }
@ -550,7 +550,7 @@ private:
int radius;
int value;
public:
Event_AddCounter(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _counterId = -1, const QString &_counterName = QString(), int _color = -1, int _radius = -1, int _value = -1);
Event_AddCounter(int _gameId = -1, int _playerId = -1, int _counterId = -1, const QString &_counterName = QString(), int _color = -1, int _radius = -1, int _value = -1);
int getCounterId() const { return counterId; }
QString getCounterName() const { return counterName; }
int getColor() const { return color; }
@ -566,7 +566,7 @@ private:
int counterId;
int value;
public:
Event_SetCounter(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _counterId = -1, int _value = -1);
Event_SetCounter(int _gameId = -1, int _playerId = -1, int _counterId = -1, int _value = -1);
int getCounterId() const { return counterId; }
int getValue() const { return value; }
static ProtocolItem *newItem() { return new Event_SetCounter; }
@ -578,7 +578,7 @@ class Event_DelCounter : public GameEvent {
private:
int counterId;
public:
Event_DelCounter(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _counterId = -1);
Event_DelCounter(int _gameId = -1, int _playerId = -1, int _counterId = -1);
int getCounterId() const { return counterId; }
static ProtocolItem *newItem() { return new Event_DelCounter; }
protected:
@ -589,7 +589,7 @@ class Event_SetActivePlayer : public GameEvent {
private:
int activePlayerId;
public:
Event_SetActivePlayer(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _activePlayerId = -1);
Event_SetActivePlayer(int _gameId = -1, int _playerId = -1, int _activePlayerId = -1);
int getActivePlayerId() const { return activePlayerId; }
static ProtocolItem *newItem() { return new Event_SetActivePlayer; }
protected:
@ -600,7 +600,7 @@ class Event_SetActivePhase : public GameEvent {
private:
int phase;
public:
Event_SetActivePhase(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _phase = -1);
Event_SetActivePhase(int _gameId = -1, int _playerId = -1, int _phase = -1);
int getPhase() const { return phase; }
static ProtocolItem *newItem() { return new Event_SetActivePhase; }
protected:
@ -613,7 +613,7 @@ private:
QString zone;
int numberCards;
public:
Event_DumpZone(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString(), int _numberCards = -1);
Event_DumpZone(int _gameId = -1, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString(), int _numberCards = -1);
int getZoneOwnerId() const { return zoneOwnerId; }
QString getZone() const { return zone; }
int getNumberCards() const { return numberCards; }
@ -627,7 +627,7 @@ private:
int zoneOwnerId;
QString zone;
public:
Event_StopDumpZone(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString());
Event_StopDumpZone(int _gameId = -1, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString());
int getZoneOwnerId() const { return zoneOwnerId; }
QString getZone() const { return zone; }
static ProtocolItem *newItem() { return new Event_StopDumpZone; }

View file

@ -44,9 +44,9 @@ while (<file>) {
$type = 'game_event';
$namePrefix = 'Event';
$baseClass = 'GameEvent';
$parentConstructorCall = "$baseClass(\"$name1\", _gameId, _isPublic, _playerId)";
$constructorParamsH = "int _gameId = -1, bool _isPublic = false, int _playerId = -1";
$constructorParamsCpp = "int _gameId, bool _isPublic, int _playerId";
$parentConstructorCall = "$baseClass(\"$name1\", _gameId, _playerId)";
$constructorParamsH = "int _gameId = -1, int _playerId = -1";
$constructorParamsCpp = "int _gameId, int _playerId";
}
$className = $namePrefix . '_' . $name2;
print headerfile "class $className : public $baseClass {\n"

View file

@ -50,7 +50,7 @@ void Widget::startClicked()
ProtocolResponse *test4 = new ProtocolResponse(123, ProtocolResponse::RespContextError);
test4->write(xmlWriter);
GameEvent *test5 = new Event_RollDie(1234, true, 1, 20, 13);
GameEvent *test5 = new Event_RollDie(1234, 1, 20, 13);
test5->write(xmlWriter);
}