removed some useless game events in favor of event context classes; added some preliminary icons
This commit is contained in:
parent
388e9255c7
commit
0c508f63ec
23 changed files with 399 additions and 226 deletions
|
@ -30,5 +30,10 @@
|
|||
<file>resources/remove_row.svg</file>
|
||||
<file>resources/arrow_left_green.svg</file>
|
||||
<file>resources/arrow_right_green.svg</file>
|
||||
<file>resources/icon_ready_start.svg</file>
|
||||
<file>resources/icon_not_ready_start.svg</file>
|
||||
<file>resources/icon_conceded.svg</file>
|
||||
<file>resources/icon_player.svg</file>
|
||||
<file>resources/icon_spectator.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -470,26 +470,11 @@ void Player::setCardAttrHelper(CardItem *card, const QString &aname, const QStri
|
|||
}
|
||||
}
|
||||
|
||||
void Player::eventDeckSelect(Event_DeckSelect *event)
|
||||
{
|
||||
emit logDeckSelect(this, event->getDeckId());
|
||||
}
|
||||
|
||||
void Player::eventSay(Event_Say *event)
|
||||
{
|
||||
emit logSay(this, event->getMessage());
|
||||
}
|
||||
|
||||
void Player::eventReadyStart(Event_ReadyStart * /*event*/)
|
||||
{
|
||||
emit logReadyStart(this);
|
||||
}
|
||||
|
||||
void Player::eventConcede(Event_Concede * /*event*/)
|
||||
{
|
||||
emit logConcede(this);
|
||||
}
|
||||
|
||||
void Player::eventShuffle(Event_Shuffle * /*event*/)
|
||||
{
|
||||
emit logShuffle(this);
|
||||
|
@ -670,13 +655,10 @@ void Player::eventDrawCards(Event_DrawCards *event)
|
|||
emit logDrawCards(this, event->getNumberCards());
|
||||
}
|
||||
|
||||
void Player::processGameEvent(GameEvent *event)
|
||||
void Player::processGameEvent(GameEvent *event, GameEventContext *context)
|
||||
{
|
||||
switch (event->getItemId()) {
|
||||
case ItemId_Event_DeckSelect: eventDeckSelect(qobject_cast<Event_DeckSelect *>(event)); break;
|
||||
case ItemId_Event_Say: eventSay(qobject_cast<Event_Say *>(event)); break;
|
||||
case ItemId_Event_ReadyStart: eventReadyStart(qobject_cast<Event_ReadyStart *>(event)); break;
|
||||
case ItemId_Event_Concede: eventConcede(qobject_cast<Event_Concede *>(event)); break;
|
||||
case ItemId_Event_Shuffle: eventShuffle(qobject_cast<Event_Shuffle *>(event)); break;
|
||||
case ItemId_Event_RollDie: eventRollDie(qobject_cast<Event_RollDie *>(event)); break;
|
||||
case ItemId_Event_CreateArrows: eventCreateArrows(qobject_cast<Event_CreateArrows *>(event)); break;
|
||||
|
|
|
@ -23,10 +23,8 @@ class ServerInfo_Counter;
|
|||
class CommandContainer;
|
||||
class GameCommand;
|
||||
class GameEvent;
|
||||
class Event_DeckSelect;
|
||||
class GameEventContext;
|
||||
class Event_Say;
|
||||
class Event_ReadyStart;
|
||||
class Event_Concede;
|
||||
class Event_Shuffle;
|
||||
class Event_RollDie;
|
||||
class Event_CreateArrows;
|
||||
|
@ -48,10 +46,7 @@ signals:
|
|||
void toggleZoneView(Player *player, QString zoneName, int number);
|
||||
void newCardAdded(AbstractCardItem *card);
|
||||
// Log events
|
||||
void logDeckSelect(Player *player, int deckId);
|
||||
void logSay(Player *player, QString message);
|
||||
void logReadyStart(Player *player);
|
||||
void logConcede(Player *player);
|
||||
void logShuffle(Player *player);
|
||||
void logRollDie(Player *player, int sides, int roll);
|
||||
void logCreateArrow(Player *player, Player *startPlayer, QString startCard, Player *targetPlayer, QString targetCard);
|
||||
|
@ -102,7 +97,6 @@ private:
|
|||
QAction *aTap, *aUntap, *aDoesntUntap, *aFlip, *aAddCounter, *aRemoveCounter, *aSetCounters,
|
||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToGraveyard, *aMoveToExile;
|
||||
|
||||
|
||||
void actTap(CardItem *card);
|
||||
void actUntap(CardItem *card);
|
||||
void actDoesntUntap(CardItem *card);
|
||||
|
@ -135,10 +129,7 @@ private:
|
|||
|
||||
void initSayMenu();
|
||||
|
||||
void eventDeckSelect(Event_DeckSelect *event);
|
||||
void eventSay(Event_Say *event);
|
||||
void eventReadyStart(Event_ReadyStart *event);
|
||||
void eventConcede(Event_Concede *event);
|
||||
void eventShuffle(Event_Shuffle *event);
|
||||
void eventRollDie(Event_RollDie *event);
|
||||
void eventCreateArrows(Event_CreateArrows *event);
|
||||
|
@ -189,7 +180,7 @@ public:
|
|||
void setActive(bool _active);
|
||||
|
||||
void processPlayerInfo(ServerInfo_Player *info);
|
||||
void processGameEvent(GameEvent *event);
|
||||
void processGameEvent(GameEvent *event, GameEventContext *context);
|
||||
void sendGameCommand(GameCommand *command);
|
||||
void sendCommandContainer(CommandContainer *cont);
|
||||
};
|
||||
|
|
|
@ -1,28 +1,58 @@
|
|||
#include <QHeaderView>
|
||||
#include "playerlistwidget.h"
|
||||
#include "protocol_datastructures.h"
|
||||
#include "pingpixmapgenerator.h"
|
||||
|
||||
PlayerListWidget::PlayerListWidget(QWidget *parent)
|
||||
: QTreeWidget(parent)
|
||||
: QTreeWidget(parent), gameStarted(false)
|
||||
{
|
||||
setColumnCount(2);
|
||||
readyIcon = QIcon(":/resources/icon_ready_start.svg");
|
||||
notReadyIcon = QIcon(":/resources/icon_not_ready_start.svg");
|
||||
concededIcon = QIcon(":/resources/icon_conceded.svg");
|
||||
playerIcon = QIcon(":/resources/icon_player.svg");
|
||||
spectatorIcon = QIcon(":/resources/icon_spectator.svg");
|
||||
|
||||
setColumnCount(5);
|
||||
setRootIsDecorated(false);
|
||||
setSelectionMode(NoSelection);
|
||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void PlayerListWidget::retranslateUi()
|
||||
{
|
||||
headerItem()->setText(0, tr("Player name"));
|
||||
headerItem()->setText(1, tr("Role"));
|
||||
headerItem()->setText(0, QString());
|
||||
headerItem()->setText(1, QString());
|
||||
headerItem()->setText(2, QString());
|
||||
headerItem()->setText(3, tr("Player name"));
|
||||
headerItem()->setText(4, tr("Deck"));
|
||||
}
|
||||
|
||||
void PlayerListWidget::addPlayer(ServerInfo_Player *player)
|
||||
void PlayerListWidget::addPlayer(ServerInfo_PlayerProperties *player)
|
||||
{
|
||||
QTreeWidgetItem *newPlayer = new QTreeWidgetItem;
|
||||
newPlayer->setText(0, player->getName());
|
||||
newPlayer->setText(1, player->getSpectator() ? tr("Spectator") : tr("Player"));
|
||||
addTopLevelItem(newPlayer);
|
||||
players.insert(player->getPlayerId(), newPlayer);
|
||||
updatePlayerProperties(player);
|
||||
addTopLevelItem(newPlayer);
|
||||
}
|
||||
|
||||
void PlayerListWidget::updatePlayerProperties(ServerInfo_PlayerProperties *prop)
|
||||
{
|
||||
QTreeWidgetItem *player = players.value(prop->getPlayerId(), 0);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
player->setIcon(1, prop->getSpectator() ? spectatorIcon : playerIcon);
|
||||
player->setIcon(2, gameStarted ? (prop->getConceded() ? concededIcon : QIcon()) : (prop->getReadyStart() ? readyIcon : notReadyIcon));
|
||||
player->setText(3, prop->getName());
|
||||
|
||||
QString deckText;
|
||||
switch (prop->getDeckId()) {
|
||||
case -2: deckText = tr("no deck"); break;
|
||||
case -1: deckText = tr("local deck"); break;
|
||||
default: deckText = tr("ID #%1").arg(prop->getDeckId());
|
||||
}
|
||||
player->setText(4, deckText);
|
||||
}
|
||||
|
||||
void PlayerListWidget::removePlayer(int playerId)
|
||||
|
@ -41,8 +71,7 @@ void PlayerListWidget::setActivePlayer(int playerId)
|
|||
i.next();
|
||||
QTreeWidgetItem *twi = i.value();
|
||||
QColor c = i.key() == playerId ? QColor(150, 255, 150) : Qt::white;
|
||||
twi->setBackground(0, c);
|
||||
twi->setBackground(1, c);
|
||||
twi->setBackground(3, c);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,3 +82,10 @@ void PlayerListWidget::updatePing(int playerId, int pingTime)
|
|||
return;
|
||||
twi->setIcon(0, QIcon(PingPixmapGenerator::generatePixmap(10, pingTime, 10)));
|
||||
}
|
||||
|
||||
void PlayerListWidget::setGameStarted(bool _gameStarted)
|
||||
{
|
||||
gameStarted = _gameStarted;
|
||||
for (int i = 0; i < players.size(); ++i)
|
||||
players[i]->setIcon(2, gameStarted ? QIcon() : notReadyIcon);
|
||||
}
|
||||
|
|
|
@ -3,20 +3,25 @@
|
|||
|
||||
#include <QTreeWidget>
|
||||
#include <QMap>
|
||||
#include <QIcon>
|
||||
|
||||
class ServerInfo_Player;
|
||||
class ServerInfo_PlayerProperties;
|
||||
|
||||
class PlayerListWidget : public QTreeWidget {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QMap<int, QTreeWidgetItem *> players;
|
||||
QIcon readyIcon, notReadyIcon, concededIcon, playerIcon, spectatorIcon;
|
||||
bool gameStarted;
|
||||
public:
|
||||
PlayerListWidget(QWidget *parent = 0);
|
||||
void retranslateUi();
|
||||
void addPlayer(ServerInfo_Player *player);
|
||||
void addPlayer(ServerInfo_PlayerProperties *player);
|
||||
void removePlayer(int playerId);
|
||||
void setActivePlayer(int playerId);
|
||||
void updatePing(int playerId, int pingTime);
|
||||
void updatePlayerProperties(ServerInfo_PlayerProperties *prop);
|
||||
void setGameStarted(bool _gameStarted);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -229,17 +229,19 @@ Player *TabGame::addPlayer(int playerId, const QString &playerName)
|
|||
void TabGame::processGameEventContainer(GameEventContainer *cont)
|
||||
{
|
||||
const QList<GameEvent *> &eventList = cont->getEventList();
|
||||
GameEventContext *context = cont->getContext();
|
||||
for (int i = 0; i < eventList.size(); ++i) {
|
||||
GameEvent *event = eventList[i];
|
||||
|
||||
switch (event->getItemId()) {
|
||||
case ItemId_Event_GameStateChanged: eventGameStateChanged(qobject_cast<Event_GameStateChanged *>(event)); break;
|
||||
case ItemId_Event_Join: eventJoin(qobject_cast<Event_Join *>(event)); break;
|
||||
case ItemId_Event_Leave: eventLeave(qobject_cast<Event_Leave *>(event)); break;
|
||||
case ItemId_Event_GameClosed: eventGameClosed(qobject_cast<Event_GameClosed *>(event)); break;
|
||||
case ItemId_Event_SetActivePlayer: eventSetActivePlayer(qobject_cast<Event_SetActivePlayer *>(event)); break;
|
||||
case ItemId_Event_SetActivePhase: eventSetActivePhase(qobject_cast<Event_SetActivePhase *>(event)); break;
|
||||
case ItemId_Event_Ping: eventPing(qobject_cast<Event_Ping *>(event)); break;
|
||||
case ItemId_Event_GameStateChanged: eventGameStateChanged(qobject_cast<Event_GameStateChanged *>(event), context); break;
|
||||
case ItemId_Event_PlayerPropertiesChanged: eventPlayerPropertiesChanged(qobject_cast<Event_PlayerPropertiesChanged *>(event), context); break;
|
||||
case ItemId_Event_Join: eventJoin(qobject_cast<Event_Join *>(event), context); break;
|
||||
case ItemId_Event_Leave: eventLeave(qobject_cast<Event_Leave *>(event), context); break;
|
||||
case ItemId_Event_GameClosed: eventGameClosed(qobject_cast<Event_GameClosed *>(event), context); break;
|
||||
case ItemId_Event_SetActivePlayer: eventSetActivePlayer(qobject_cast<Event_SetActivePlayer *>(event), context); break;
|
||||
case ItemId_Event_SetActivePhase: eventSetActivePhase(qobject_cast<Event_SetActivePhase *>(event), context); break;
|
||||
case ItemId_Event_Ping: eventPing(qobject_cast<Event_Ping *>(event), context); break;
|
||||
|
||||
default: {
|
||||
Player *player = players.value(event->getPlayerId(), 0);
|
||||
|
@ -247,7 +249,7 @@ void TabGame::processGameEventContainer(GameEventContainer *cont)
|
|||
qDebug() << "unhandled game event: invalid player id";
|
||||
break;
|
||||
}
|
||||
player->processGameEvent(event);
|
||||
player->processGameEvent(event, context);
|
||||
emit userEvent();
|
||||
}
|
||||
}
|
||||
|
@ -275,6 +277,7 @@ void TabGame::startGame()
|
|||
{
|
||||
currentPhase = -1;
|
||||
|
||||
playerListWidget->setGameStarted(true);
|
||||
started = true;
|
||||
deckViewContainer->hide();
|
||||
gameView->show();
|
||||
|
@ -284,27 +287,31 @@ void TabGame::startGame()
|
|||
void TabGame::stopGame()
|
||||
{
|
||||
currentPhase = -1;
|
||||
|
||||
playerListWidget->setActivePlayer(-1);
|
||||
playerListWidget->setGameStarted(false);
|
||||
started = false;
|
||||
gameView->hide();
|
||||
phasesToolbar->hide();
|
||||
deckViewContainer->show();
|
||||
}
|
||||
|
||||
void TabGame::eventGameStateChanged(Event_GameStateChanged *event)
|
||||
void TabGame::eventGameStateChanged(Event_GameStateChanged *event, GameEventContext * /*context*/)
|
||||
{
|
||||
const QList<ServerInfo_Player *> &plList = event->getPlayerList();
|
||||
for (int i = 0; i < plList.size(); ++i) {
|
||||
ServerInfo_Player *pl = plList[i];
|
||||
if (pl->getSpectator()) {
|
||||
if (!spectators.contains(pl->getPlayerId())) {
|
||||
spectators.insert(pl->getPlayerId(), pl->getName());
|
||||
playerListWidget->addPlayer(pl);
|
||||
ServerInfo_PlayerProperties *prop = pl->getProperties();
|
||||
if (prop->getSpectator()) {
|
||||
if (!spectators.contains(prop->getPlayerId())) {
|
||||
spectators.insert(prop->getPlayerId(), prop->getName());
|
||||
playerListWidget->addPlayer(prop);
|
||||
}
|
||||
} else {
|
||||
Player *player = players.value(pl->getPlayerId(), 0);
|
||||
Player *player = players.value(prop->getPlayerId(), 0);
|
||||
if (!player) {
|
||||
player = addPlayer(pl->getPlayerId(), pl->getName());
|
||||
playerListWidget->addPlayer(pl);
|
||||
player = addPlayer(prop->getPlayerId(), prop->getName());
|
||||
playerListWidget->addPlayer(prop);
|
||||
}
|
||||
player->processPlayerInfo(pl);
|
||||
if (player->getLocal() && pl->getDeck()) {
|
||||
|
@ -327,9 +334,23 @@ void TabGame::eventGameStateChanged(Event_GameStateChanged *event)
|
|||
emit userEvent();
|
||||
}
|
||||
|
||||
void TabGame::eventJoin(Event_Join *event)
|
||||
void TabGame::eventPlayerPropertiesChanged(Event_PlayerPropertiesChanged *event, GameEventContext *context)
|
||||
{
|
||||
ServerInfo_Player *playerInfo = event->getPlayer();
|
||||
Player *player = players.value(event->getProperties()->getPlayerId(), 0);
|
||||
if (!player)
|
||||
return;
|
||||
playerListWidget->updatePlayerProperties(event->getProperties());
|
||||
if (context) switch (context->getItemId()) {
|
||||
case ItemId_Context_ReadyStart: messageLog->logReadyStart(player); break;
|
||||
case ItemId_Context_Concede: messageLog->logConcede(player); break;
|
||||
case ItemId_Context_DeckSelect: messageLog->logDeckSelect(player, static_cast<Context_DeckSelect *>(context)->getDeckId()); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
|
||||
void TabGame::eventJoin(Event_Join *event, GameEventContext * /*context*/)
|
||||
{
|
||||
ServerInfo_PlayerProperties *playerInfo = event->getPlayer();
|
||||
if (playerInfo->getSpectator()) {
|
||||
spectators.insert(playerInfo->getPlayerId(), playerInfo->getName());
|
||||
messageLog->logJoinSpectator(playerInfo->getName());
|
||||
|
@ -342,7 +363,7 @@ void TabGame::eventJoin(Event_Join *event)
|
|||
emit userEvent();
|
||||
}
|
||||
|
||||
void TabGame::eventLeave(Event_Leave *event)
|
||||
void TabGame::eventLeave(Event_Leave *event, GameEventContext * /*context*/)
|
||||
{
|
||||
int playerId = event->getPlayerId();
|
||||
|
||||
|
@ -360,7 +381,7 @@ void TabGame::eventLeave(Event_Leave *event)
|
|||
emit userEvent();
|
||||
}
|
||||
|
||||
void TabGame::eventGameClosed(Event_GameClosed * /*event*/)
|
||||
void TabGame::eventGameClosed(Event_GameClosed * /*event*/, GameEventContext * /*context*/)
|
||||
{
|
||||
started = false;
|
||||
messageLog->logGameClosed();
|
||||
|
@ -383,7 +404,7 @@ Player *TabGame::setActivePlayer(int id)
|
|||
return player;
|
||||
}
|
||||
|
||||
void TabGame::eventSetActivePlayer(Event_SetActivePlayer *event)
|
||||
void TabGame::eventSetActivePlayer(Event_SetActivePlayer *event, GameEventContext * /*context*/)
|
||||
{
|
||||
Player *player = setActivePlayer(event->getActivePlayerId());
|
||||
if (!player)
|
||||
|
@ -400,7 +421,7 @@ void TabGame::setActivePhase(int phase)
|
|||
}
|
||||
}
|
||||
|
||||
void TabGame::eventSetActivePhase(Event_SetActivePhase *event)
|
||||
void TabGame::eventSetActivePhase(Event_SetActivePhase *event, GameEventContext * /*context*/)
|
||||
{
|
||||
int phase = event->getPhase();
|
||||
if (currentPhase != phase)
|
||||
|
@ -409,7 +430,7 @@ void TabGame::eventSetActivePhase(Event_SetActivePhase *event)
|
|||
emit userEvent();
|
||||
}
|
||||
|
||||
void TabGame::eventPing(Event_Ping *event)
|
||||
void TabGame::eventPing(Event_Ping *event, GameEventContext * /*context*/)
|
||||
{
|
||||
const QList<ServerInfo_PlayerPing *> &pingList = event->getPingList();
|
||||
for (int i = 0; i < pingList.size(); ++i)
|
||||
|
|
|
@ -21,9 +21,11 @@ class PhasesToolbar;
|
|||
class PlayerListWidget;
|
||||
class ProtocolResponse;
|
||||
class GameEventContainer;
|
||||
class GameEventContext;
|
||||
class GameCommand;
|
||||
class CommandContainer;
|
||||
class Event_GameStateChanged;
|
||||
class Event_PlayerPropertiesChanged;
|
||||
class Event_Join;
|
||||
class Event_Leave;
|
||||
class Event_GameClosed;
|
||||
|
@ -72,15 +74,16 @@ private:
|
|||
void startGame();
|
||||
void stopGame();
|
||||
|
||||
void eventGameStateChanged(Event_GameStateChanged *event);
|
||||
void eventJoin(Event_Join *event);
|
||||
void eventLeave(Event_Leave *event);
|
||||
void eventGameClosed(Event_GameClosed *event);
|
||||
void eventGameStateChanged(Event_GameStateChanged *event, GameEventContext *context);
|
||||
void eventPlayerPropertiesChanged(Event_PlayerPropertiesChanged *event, GameEventContext *context);
|
||||
void eventJoin(Event_Join *event, GameEventContext *context);
|
||||
void eventLeave(Event_Leave *event, GameEventContext *context);
|
||||
void eventGameClosed(Event_GameClosed *event, GameEventContext *context);
|
||||
Player *setActivePlayer(int id);
|
||||
void eventSetActivePlayer(Event_SetActivePlayer *event);
|
||||
void eventSetActivePlayer(Event_SetActivePlayer *event, GameEventContext *context);
|
||||
void setActivePhase(int phase);
|
||||
void eventSetActivePhase(Event_SetActivePhase *event);
|
||||
void eventPing(Event_Ping *event);
|
||||
void eventSetActivePhase(Event_SetActivePhase *event, GameEventContext *context);
|
||||
void eventPing(Event_Ping *event, GameEventContext *context);
|
||||
signals:
|
||||
void gameClosing(TabGame *tab);
|
||||
private slots:
|
||||
|
|
|
@ -260,27 +260,27 @@
|
|||
<context>
|
||||
<name>ChatChannelSelector</name>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="139"/>
|
||||
<location filename="../src/tab_server.cpp" line="140"/>
|
||||
<source>Chat channels</source>
|
||||
<translation>Chaträume</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="140"/>
|
||||
<location filename="../src/tab_server.cpp" line="141"/>
|
||||
<source>Joi&n</source>
|
||||
<translation>Teil&nehmen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="143"/>
|
||||
<location filename="../src/tab_server.cpp" line="144"/>
|
||||
<source>Channel</source>
|
||||
<translation>Raum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="144"/>
|
||||
<location filename="../src/tab_server.cpp" line="145"/>
|
||||
<source>Description</source>
|
||||
<translation>Beschreibung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="145"/>
|
||||
<location filename="../src/tab_server.cpp" line="146"/>
|
||||
<source>Players</source>
|
||||
<translation>Spieler</translation>
|
||||
</message>
|
||||
|
@ -841,20 +841,20 @@
|
|||
<context>
|
||||
<name>GameSelector</name>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="103"/>
|
||||
<location filename="../src/tab_server.cpp" line="104"/>
|
||||
<source>C&reate</source>
|
||||
<translation>Spiel e&rstellen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="104"/>
|
||||
<location filename="../src/tab_server.cpp" line="105"/>
|
||||
<source>&Join</source>
|
||||
<translation>&Teilnehmen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="66"/>
|
||||
<location filename="../src/tab_server.cpp" line="67"/>
|
||||
<location filename="../src/tab_server.cpp" line="68"/>
|
||||
<location filename="../src/tab_server.cpp" line="69"/>
|
||||
<location filename="../src/tab_server.cpp" line="70"/>
|
||||
<source>Error</source>
|
||||
<translation>Fehler</translation>
|
||||
</message>
|
||||
|
@ -863,47 +863,47 @@
|
|||
<translation type="obsolete">XXX</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="66"/>
|
||||
<location filename="../src/tab_server.cpp" line="67"/>
|
||||
<source>Wrong password.</source>
|
||||
<translation>Falsches Passwort.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="67"/>
|
||||
<location filename="../src/tab_server.cpp" line="68"/>
|
||||
<source>Spectators are not allowed in this game.</source>
|
||||
<translation>In diesem Spiel sind keine Zuschauer zugelassen.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="68"/>
|
||||
<location filename="../src/tab_server.cpp" line="69"/>
|
||||
<source>The game is already full.</source>
|
||||
<translation>Das Spiel ist bereits voll.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="69"/>
|
||||
<location filename="../src/tab_server.cpp" line="70"/>
|
||||
<source>The game does not exist any more.</source>
|
||||
<translation>Dieses Spiel gibt es nicht mehr.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="85"/>
|
||||
<location filename="../src/tab_server.cpp" line="86"/>
|
||||
<source>Join game</source>
|
||||
<translation>Spiel beitreten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="85"/>
|
||||
<location filename="../src/tab_server.cpp" line="86"/>
|
||||
<source>Password:</source>
|
||||
<translation>Passwort:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="101"/>
|
||||
<location filename="../src/tab_server.cpp" line="102"/>
|
||||
<source>Games</source>
|
||||
<translation>Spiele</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="102"/>
|
||||
<location filename="../src/tab_server.cpp" line="103"/>
|
||||
<source>&Show full games</source>
|
||||
<translation>&Volle Spiele anzeigen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="105"/>
|
||||
<location filename="../src/tab_server.cpp" line="106"/>
|
||||
<source>J&oin as spectator</source>
|
||||
<translation>&Zuschauen</translation>
|
||||
</message>
|
||||
|
@ -2149,12 +2149,12 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../src/player.cpp" line="416"/>
|
||||
<location filename="../src/player.cpp" line="964"/>
|
||||
<location filename="../src/player.cpp" line="957"/>
|
||||
<source>Number:</source>
|
||||
<translation>Anzahl:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/player.cpp" line="964"/>
|
||||
<location filename="../src/player.cpp" line="957"/>
|
||||
<source>Set counters</source>
|
||||
<translation>Setze Zählmarken</translation>
|
||||
</message>
|
||||
|
@ -2190,24 +2190,41 @@
|
|||
<context>
|
||||
<name>PlayerListWidget</name>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="15"/>
|
||||
<location filename="../src/playerlistwidget.cpp" line="26"/>
|
||||
<source>Player name</source>
|
||||
<translation>Spielername</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="16"/>
|
||||
<location filename="../src/playerlistwidget.cpp" line="27"/>
|
||||
<source>Deck</source>
|
||||
<translation>Deck</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="50"/>
|
||||
<source>no deck</source>
|
||||
<translation>kein Deck</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="51"/>
|
||||
<source>local deck</source>
|
||||
<translation>lokales Deck</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="52"/>
|
||||
<source>ID #%1</source>
|
||||
<translation>ID #%1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Role</source>
|
||||
<translation>Rolle</translation>
|
||||
<translation type="obsolete">Rolle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="23"/>
|
||||
<source>Spectator</source>
|
||||
<translation>Zuschauer</translation>
|
||||
<translation type="obsolete">Zuschauer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="23"/>
|
||||
<source>Player</source>
|
||||
<translation>Spieler</translation>
|
||||
<translation type="obsolete">Spieler</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -2259,7 +2276,7 @@
|
|||
<context>
|
||||
<name>ServerMessageLog</name>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="219"/>
|
||||
<location filename="../src/tab_server.cpp" line="220"/>
|
||||
<source>Server messages</source>
|
||||
<translation>Servernachrichten</translation>
|
||||
</message>
|
||||
|
@ -2476,12 +2493,12 @@ Bitte geben Sie einen Namen ein:</translation>
|
|||
<translation>Sind Sie sicher, dass Sie das Spiel verlassen möchten?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_game.cpp" line="397"/>
|
||||
<location filename="../src/tab_game.cpp" line="440"/>
|
||||
<source>Load deck</source>
|
||||
<translation>Deck laden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_game.h" line="104"/>
|
||||
<location filename="../src/tab_game.h" line="108"/>
|
||||
<source>Game %1: %2</source>
|
||||
<translation>Spiel %1: %2</translation>
|
||||
</message>
|
||||
|
|
|
@ -218,27 +218,27 @@
|
|||
<context>
|
||||
<name>ChatChannelSelector</name>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="139"/>
|
||||
<location filename="../src/tab_server.cpp" line="140"/>
|
||||
<source>Chat channels</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="140"/>
|
||||
<location filename="../src/tab_server.cpp" line="141"/>
|
||||
<source>Joi&n</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="143"/>
|
||||
<location filename="../src/tab_server.cpp" line="144"/>
|
||||
<source>Channel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="144"/>
|
||||
<location filename="../src/tab_server.cpp" line="145"/>
|
||||
<source>Description</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="145"/>
|
||||
<location filename="../src/tab_server.cpp" line="146"/>
|
||||
<source>Players</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -476,65 +476,65 @@
|
|||
<context>
|
||||
<name>GameSelector</name>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="103"/>
|
||||
<location filename="../src/tab_server.cpp" line="104"/>
|
||||
<source>C&reate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="104"/>
|
||||
<location filename="../src/tab_server.cpp" line="105"/>
|
||||
<source>&Join</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="66"/>
|
||||
<location filename="../src/tab_server.cpp" line="67"/>
|
||||
<location filename="../src/tab_server.cpp" line="68"/>
|
||||
<location filename="../src/tab_server.cpp" line="69"/>
|
||||
<location filename="../src/tab_server.cpp" line="70"/>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="66"/>
|
||||
<location filename="../src/tab_server.cpp" line="67"/>
|
||||
<source>Wrong password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="67"/>
|
||||
<location filename="../src/tab_server.cpp" line="68"/>
|
||||
<source>Spectators are not allowed in this game.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="68"/>
|
||||
<location filename="../src/tab_server.cpp" line="69"/>
|
||||
<source>The game is already full.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="69"/>
|
||||
<location filename="../src/tab_server.cpp" line="70"/>
|
||||
<source>The game does not exist any more.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="85"/>
|
||||
<location filename="../src/tab_server.cpp" line="86"/>
|
||||
<source>Join game</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="85"/>
|
||||
<location filename="../src/tab_server.cpp" line="86"/>
|
||||
<source>Password:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="101"/>
|
||||
<location filename="../src/tab_server.cpp" line="102"/>
|
||||
<source>Games</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="102"/>
|
||||
<location filename="../src/tab_server.cpp" line="103"/>
|
||||
<source>&Show full games</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="105"/>
|
||||
<location filename="../src/tab_server.cpp" line="106"/>
|
||||
<source>J&oin as spectator</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1440,7 +1440,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../src/player.cpp" line="416"/>
|
||||
<location filename="../src/player.cpp" line="964"/>
|
||||
<location filename="../src/player.cpp" line="957"/>
|
||||
<source>Number:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1465,7 +1465,7 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/player.cpp" line="964"/>
|
||||
<location filename="../src/player.cpp" line="957"/>
|
||||
<source>Set counters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1473,23 +1473,28 @@
|
|||
<context>
|
||||
<name>PlayerListWidget</name>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="15"/>
|
||||
<location filename="../src/playerlistwidget.cpp" line="26"/>
|
||||
<source>Player name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="16"/>
|
||||
<source>Role</source>
|
||||
<location filename="../src/playerlistwidget.cpp" line="27"/>
|
||||
<source>Deck</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="23"/>
|
||||
<source>Spectator</source>
|
||||
<location filename="../src/playerlistwidget.cpp" line="50"/>
|
||||
<source>no deck</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="23"/>
|
||||
<source>Player</source>
|
||||
<location filename="../src/playerlistwidget.cpp" line="51"/>
|
||||
<source>local deck</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/playerlistwidget.cpp" line="52"/>
|
||||
<source>ID #%1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@ -1542,7 +1547,7 @@
|
|||
<context>
|
||||
<name>ServerMessageLog</name>
|
||||
<message>
|
||||
<location filename="../src/tab_server.cpp" line="219"/>
|
||||
<location filename="../src/tab_server.cpp" line="220"/>
|
||||
<source>Server messages</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1758,12 +1763,12 @@ Please enter a name:</source>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_game.cpp" line="397"/>
|
||||
<location filename="../src/tab_game.cpp" line="440"/>
|
||||
<source>Load deck</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/tab_game.h" line="104"/>
|
||||
<location filename="../src/tab_game.h" line="108"/>
|
||||
<source>Game %1: %2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -21,6 +21,7 @@ void ProtocolItem::initializeHash()
|
|||
registerSerializableItem("zone", ServerInfo_Zone::newItem);
|
||||
registerSerializableItem("counter", ServerInfo_Counter::newItem);
|
||||
registerSerializableItem("arrow", ServerInfo_Arrow::newItem);
|
||||
registerSerializableItem("player_properties", ServerInfo_PlayerProperties::newItem);
|
||||
registerSerializableItem("player", ServerInfo_Player::newItem);
|
||||
registerSerializableItem("player_ping", ServerInfo_PlayerPing::newItem);
|
||||
registerSerializableItem("file", DeckList_File::newItem);
|
||||
|
@ -43,6 +44,7 @@ void ProtocolItem::initializeHash()
|
|||
registerSerializableItem("generic_eventlist_chat_channels", Event_ListChatChannels::newItem);
|
||||
registerSerializableItem("game_eventjoin", Event_Join::newItem);
|
||||
registerSerializableItem("game_eventgame_state_changed", Event_GameStateChanged::newItem);
|
||||
registerSerializableItem("game_eventplayer_properties_changed", Event_PlayerPropertiesChanged::newItem);
|
||||
registerSerializableItem("game_eventcreate_arrows", Event_CreateArrows::newItem);
|
||||
registerSerializableItem("game_eventcreate_counters", Event_CreateCounters::newItem);
|
||||
registerSerializableItem("game_eventdraw_cards", Event_DrawCards::newItem);
|
||||
|
@ -234,6 +236,11 @@ GameEvent::GameEvent(const QString &_eventName, int _playerId)
|
|||
insertItem(new SerializableItem_Int("player_id", _playerId));
|
||||
}
|
||||
|
||||
GameEventContext::GameEventContext(const QString &_contextName)
|
||||
: ProtocolItem("game_event_context", _contextName)
|
||||
{
|
||||
}
|
||||
|
||||
ChatEvent::ChatEvent(const QString &_eventName, const QString &_channel)
|
||||
: ProtocolItem("chat_event", _eventName)
|
||||
{
|
||||
|
@ -261,23 +268,53 @@ Event_ListGames::Event_ListGames(const QList<ServerInfo_Game *> &_gameList)
|
|||
itemList.append(_gameList[i]);
|
||||
}
|
||||
|
||||
Event_Join::Event_Join(ServerInfo_Player *player)
|
||||
Event_Join::Event_Join(ServerInfo_PlayerProperties *player)
|
||||
: GameEvent("join", -1)
|
||||
{
|
||||
if (!player)
|
||||
player = new ServerInfo_Player;
|
||||
player = new ServerInfo_PlayerProperties;
|
||||
insertItem(player);
|
||||
}
|
||||
|
||||
GameEventContainer::GameEventContainer(const QList<GameEvent *> &_eventList, int _gameId)
|
||||
GameEventContainer::GameEventContainer(const QList<GameEvent *> &_eventList, int _gameId, GameEventContext *_context)
|
||||
: ProtocolItem("container", "game_event")
|
||||
{
|
||||
insertItem(new SerializableItem_Int("game_id", _gameId));
|
||||
|
||||
context = _context;
|
||||
if (_context)
|
||||
itemList.append(_context);
|
||||
|
||||
for (int i = 0; i < _eventList.size(); ++i)
|
||||
itemList.append(_eventList[i]);
|
||||
}
|
||||
|
||||
void GameEventContainer::extractData()
|
||||
{
|
||||
for (int i = 0; i < itemList.size(); ++i) {
|
||||
GameEvent *_event = dynamic_cast<GameEvent *>(itemList[i]);
|
||||
GameEventContext *_context = dynamic_cast<GameEventContext *>(itemList[i]);
|
||||
if (_event)
|
||||
eventList.append(_event);
|
||||
else if (_context)
|
||||
context = _context;
|
||||
}
|
||||
}
|
||||
|
||||
void GameEventContainer::setContext(GameEventContext *_context)
|
||||
{
|
||||
for (int i = 0; i < itemList.size(); ++i) {
|
||||
GameEventContext *temp = qobject_cast<GameEventContext *>(itemList[i]);
|
||||
if (temp) {
|
||||
delete temp;
|
||||
itemList.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
itemList.append(_context);
|
||||
context = _context;
|
||||
}
|
||||
|
||||
GameEventContainer *GameEventContainer::makeNew(GameEvent *event, int _gameId)
|
||||
{
|
||||
return new GameEventContainer(QList<GameEvent *>() << event, _gameId);
|
||||
|
@ -293,6 +330,14 @@ Event_GameStateChanged::Event_GameStateChanged(bool _gameStarted, int _activePla
|
|||
itemList.append(_playerList[i]);
|
||||
}
|
||||
|
||||
Event_PlayerPropertiesChanged::Event_PlayerPropertiesChanged(ServerInfo_PlayerProperties *_properties)
|
||||
: GameEvent("player_properties_changed", -1)
|
||||
{
|
||||
if (!_properties)
|
||||
_properties = new ServerInfo_PlayerProperties;
|
||||
insertItem(_properties);
|
||||
}
|
||||
|
||||
Event_Ping::Event_Ping(const QList<ServerInfo_PlayerPing *> &_pingList)
|
||||
: GameEvent("ping", -1)
|
||||
{
|
||||
|
|
|
@ -27,11 +27,12 @@ enum ItemId {
|
|||
ItemId_Event_ChatListPlayers = ItemId_Other + 201,
|
||||
ItemId_Event_ListGames = ItemId_Other + 202,
|
||||
ItemId_Event_GameStateChanged = ItemId_Other + 203,
|
||||
ItemId_Event_CreateArrows = ItemId_Other + 204,
|
||||
ItemId_Event_CreateCounters = ItemId_Other + 205,
|
||||
ItemId_Event_DrawCards = ItemId_Other + 206,
|
||||
ItemId_Event_Join = ItemId_Other + 207,
|
||||
ItemId_Event_Ping = ItemId_Other + 208,
|
||||
ItemId_Event_PlayerPropertiesChanged = ItemId_Other + 204,
|
||||
ItemId_Event_CreateArrows = ItemId_Other + 205,
|
||||
ItemId_Event_CreateCounters = ItemId_Other + 206,
|
||||
ItemId_Event_DrawCards = ItemId_Other + 207,
|
||||
ItemId_Event_Join = ItemId_Other + 208,
|
||||
ItemId_Event_Ping = ItemId_Other + 209,
|
||||
ItemId_Response_DeckList = ItemId_Other + 300,
|
||||
ItemId_Response_DeckDownload = ItemId_Other + 301,
|
||||
ItemId_Response_DeckUpload = ItemId_Other + 302,
|
||||
|
@ -96,7 +97,7 @@ private:
|
|||
int ticks;
|
||||
static int lastCmdId;
|
||||
|
||||
// These are only for processing inside the server.
|
||||
// XXX Move these out. They are only for processing inside the server.
|
||||
ProtocolResponse *resp;
|
||||
QList<ProtocolItem *> itemQueue;
|
||||
GameEventContainer *gameEventQueuePublic;
|
||||
|
@ -234,13 +235,26 @@ public:
|
|||
int getPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("player_id"))->getData(); }
|
||||
};
|
||||
|
||||
class GameEventContainer : public ProtocolItem {
|
||||
class GameEventContext : public ProtocolItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GameEventContainer(const QList<GameEvent *> &_eventList = QList<GameEvent *>(), int _gameId = -1);
|
||||
GameEventContext(const QString &_contextName);
|
||||
};
|
||||
|
||||
class GameEventContainer : public ProtocolItem {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QList<GameEvent *> eventList;
|
||||
GameEventContext *context;
|
||||
protected:
|
||||
void extractData();
|
||||
public:
|
||||
GameEventContainer(const QList<GameEvent *> &_eventList = QList<GameEvent *>(), int _gameId = -1, GameEventContext *_context = 0);
|
||||
static SerializableItem *newItem() { return new GameEventContainer; }
|
||||
int getItemId() const { return ItemId_GameEventContainer; }
|
||||
QList<GameEvent *> getEventList() const { return typecastItemList<GameEvent *>(); }
|
||||
QList<GameEvent *> getEventList() const { return eventList; }
|
||||
GameEventContext *getContext() const { return context; }
|
||||
void setContext(GameEventContext *_context);
|
||||
static GameEventContainer *makeNew(GameEvent *event, int _gameId);
|
||||
|
||||
int getGameId() const { return static_cast<SerializableItem_Int *>(itemMap.value("game_id"))->getData(); }
|
||||
|
@ -284,10 +298,10 @@ public:
|
|||
class Event_Join : public GameEvent {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Event_Join(ServerInfo_Player * player = 0);
|
||||
Event_Join(ServerInfo_PlayerProperties *player = 0);
|
||||
static SerializableItem *newItem() { return new Event_Join; }
|
||||
int getItemId() const { return ItemId_Event_Join; }
|
||||
ServerInfo_Player *getPlayer() const { return static_cast<ServerInfo_Player *>(itemMap.value("player")); }
|
||||
ServerInfo_PlayerProperties *getPlayer() const { return static_cast<ServerInfo_PlayerProperties *>(itemMap.value("player_properties")); }
|
||||
};
|
||||
|
||||
class Event_GameStateChanged : public GameEvent {
|
||||
|
@ -302,6 +316,15 @@ public:
|
|||
int getActivePhase() const { return static_cast<SerializableItem_Int *>(itemMap.value("active_phase"))->getData(); }
|
||||
};
|
||||
|
||||
class Event_PlayerPropertiesChanged : public GameEvent {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Event_PlayerPropertiesChanged(ServerInfo_PlayerProperties *_properties = 0);
|
||||
static SerializableItem *newItem() { return new Event_PlayerPropertiesChanged; }
|
||||
int getItemId() const { return ItemId_Event_PlayerPropertiesChanged; }
|
||||
ServerInfo_PlayerProperties *getProperties() const { return static_cast<ServerInfo_PlayerProperties *>(itemMap.value("player_properties")); }
|
||||
};
|
||||
|
||||
class Event_Ping : public GameEvent {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -108,13 +108,25 @@ ServerInfo_Arrow::ServerInfo_Arrow(int _id, int _startPlayerId, const QString &_
|
|||
insertItem(new SerializableItem_Color("color", _color));
|
||||
}
|
||||
|
||||
ServerInfo_Player::ServerInfo_Player(int _playerId, const QString &_name, bool _spectator, bool _conceded, DeckList *_deck, const QList<ServerInfo_Zone *> &_zoneList, const QList<ServerInfo_Counter *> &_counterList, const QList<ServerInfo_Arrow *> &_arrowList)
|
||||
: SerializableItem_Map("player"), zoneList(_zoneList), counterList(_counterList), arrowList(_arrowList)
|
||||
ServerInfo_PlayerProperties::ServerInfo_PlayerProperties(int _playerId, const QString &_name, bool _spectator, bool _conceded, bool _readyStart, int _deckId)
|
||||
: SerializableItem_Map("player_properties")
|
||||
{
|
||||
insertItem(new SerializableItem_Int("player_id", _playerId));
|
||||
insertItem(new SerializableItem_String("name", _name));
|
||||
insertItem(new SerializableItem_Bool("spectator", _spectator));
|
||||
insertItem(new SerializableItem_Bool("conceded", _conceded));
|
||||
insertItem(new SerializableItem_Bool("ready_start", _readyStart));
|
||||
insertItem(new SerializableItem_Int("deck_id", _deckId));
|
||||
}
|
||||
|
||||
ServerInfo_Player::ServerInfo_Player(ServerInfo_PlayerProperties *_properties, DeckList *_deck, const QList<ServerInfo_Zone *> &_zoneList, const QList<ServerInfo_Counter *> &_counterList, const QList<ServerInfo_Arrow *> &_arrowList)
|
||||
: SerializableItem_Map("player"), zoneList(_zoneList), counterList(_counterList), arrowList(_arrowList)
|
||||
{
|
||||
if (!_properties)
|
||||
insertItem(new ServerInfo_PlayerProperties);
|
||||
else
|
||||
insertItem(_properties);
|
||||
|
||||
if (!_deck)
|
||||
insertItem(new DeckList);
|
||||
else
|
||||
|
|
|
@ -104,6 +104,18 @@ public:
|
|||
QColor getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); }
|
||||
};
|
||||
|
||||
class ServerInfo_PlayerProperties : public SerializableItem_Map {
|
||||
public:
|
||||
ServerInfo_PlayerProperties(int _playerId = -1, const QString &_name = QString(), bool _spectator = false, bool _conceded = false, bool _readyStart = false, int _deckId = -1);
|
||||
static SerializableItem *newItem() { return new ServerInfo_PlayerProperties; }
|
||||
int getPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("player_id"))->getData(); }
|
||||
QString getName() const { return static_cast<SerializableItem_String *>(itemMap.value("name"))->getData(); }
|
||||
bool getSpectator() const { return static_cast<SerializableItem_Bool *>(itemMap.value("spectator"))->getData(); }
|
||||
bool getConceded() const { return static_cast<SerializableItem_Bool *>(itemMap.value("conceded"))->getData(); }
|
||||
bool getReadyStart() const { return static_cast<SerializableItem_Bool *>(itemMap.value("ready_start"))->getData(); }
|
||||
int getDeckId() const { return static_cast<SerializableItem_Int *>(itemMap.value("deck_id"))->getData(); }
|
||||
};
|
||||
|
||||
class ServerInfo_Player : public SerializableItem_Map {
|
||||
private:
|
||||
QList<ServerInfo_Zone *> zoneList;
|
||||
|
@ -112,12 +124,9 @@ private:
|
|||
protected:
|
||||
void extractData();
|
||||
public:
|
||||
ServerInfo_Player(int _playerId = -1, const QString &_name = QString(), bool _spectator = false, bool _conceded = false, DeckList *_deck = 0, const QList<ServerInfo_Zone *> &_zoneList = QList<ServerInfo_Zone *>(), const QList<ServerInfo_Counter *> &_counterList = QList<ServerInfo_Counter *>(), const QList<ServerInfo_Arrow *> &_arrowList = QList<ServerInfo_Arrow *>());
|
||||
ServerInfo_Player(ServerInfo_PlayerProperties *_properties = 0, DeckList *_deck = 0, const QList<ServerInfo_Zone *> &_zoneList = QList<ServerInfo_Zone *>(), const QList<ServerInfo_Counter *> &_counterList = QList<ServerInfo_Counter *>(), const QList<ServerInfo_Arrow *> &_arrowList = QList<ServerInfo_Arrow *>());
|
||||
static SerializableItem *newItem() { return new ServerInfo_Player; }
|
||||
int getPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("player_id"))->getData(); }
|
||||
QString getName() const { return static_cast<SerializableItem_String *>(itemMap.value("name"))->getData(); }
|
||||
bool getSpectator() const { return static_cast<SerializableItem_Bool *>(itemMap.value("spectator"))->getData(); }
|
||||
bool getConceded() const { return static_cast<SerializableItem_Bool *>(itemMap.value("conceded"))->getData(); }
|
||||
ServerInfo_PlayerProperties *getProperties() const { return static_cast<ServerInfo_PlayerProperties *>(itemMap.value("player_properties")); }
|
||||
DeckList *getDeck() const;
|
||||
const QList<ServerInfo_Zone *> &getZoneList() const { return zoneList; }
|
||||
const QList<ServerInfo_Counter *> &getCounterList() const { return counterList; }
|
||||
|
|
|
@ -36,26 +36,26 @@ ItemId_Command_DumpZone = 1034,
|
|||
ItemId_Command_StopDumpZone = 1035,
|
||||
ItemId_Event_Say = 1036,
|
||||
ItemId_Event_Leave = 1037,
|
||||
ItemId_Event_DeckSelect = 1038,
|
||||
ItemId_Event_GameClosed = 1039,
|
||||
ItemId_Event_ReadyStart = 1040,
|
||||
ItemId_Event_Concede = 1041,
|
||||
ItemId_Event_Shuffle = 1042,
|
||||
ItemId_Event_RollDie = 1043,
|
||||
ItemId_Event_MoveCard = 1044,
|
||||
ItemId_Event_CreateToken = 1045,
|
||||
ItemId_Event_DeleteArrow = 1046,
|
||||
ItemId_Event_SetCardAttr = 1047,
|
||||
ItemId_Event_SetCounter = 1048,
|
||||
ItemId_Event_DelCounter = 1049,
|
||||
ItemId_Event_SetActivePlayer = 1050,
|
||||
ItemId_Event_SetActivePhase = 1051,
|
||||
ItemId_Event_DumpZone = 1052,
|
||||
ItemId_Event_StopDumpZone = 1053,
|
||||
ItemId_Event_ServerMessage = 1054,
|
||||
ItemId_Event_GameJoined = 1055,
|
||||
ItemId_Event_ChatJoinChannel = 1056,
|
||||
ItemId_Event_ChatLeaveChannel = 1057,
|
||||
ItemId_Event_ChatSay = 1058,
|
||||
ItemId_Event_GameClosed = 1038,
|
||||
ItemId_Event_Shuffle = 1039,
|
||||
ItemId_Event_RollDie = 1040,
|
||||
ItemId_Event_MoveCard = 1041,
|
||||
ItemId_Event_CreateToken = 1042,
|
||||
ItemId_Event_DeleteArrow = 1043,
|
||||
ItemId_Event_SetCardAttr = 1044,
|
||||
ItemId_Event_SetCounter = 1045,
|
||||
ItemId_Event_DelCounter = 1046,
|
||||
ItemId_Event_SetActivePlayer = 1047,
|
||||
ItemId_Event_SetActivePhase = 1048,
|
||||
ItemId_Event_DumpZone = 1049,
|
||||
ItemId_Event_StopDumpZone = 1050,
|
||||
ItemId_Event_ServerMessage = 1051,
|
||||
ItemId_Event_GameJoined = 1052,
|
||||
ItemId_Event_ChatJoinChannel = 1053,
|
||||
ItemId_Event_ChatLeaveChannel = 1054,
|
||||
ItemId_Event_ChatSay = 1055,
|
||||
ItemId_Context_ReadyStart = 1056,
|
||||
ItemId_Context_Concede = 1057,
|
||||
ItemId_Context_DeckSelect = 1058,
|
||||
ItemId_Other = 1059
|
||||
};
|
||||
|
|
|
@ -208,23 +208,10 @@ Event_Leave::Event_Leave(int _playerId)
|
|||
: GameEvent("leave", _playerId)
|
||||
{
|
||||
}
|
||||
Event_DeckSelect::Event_DeckSelect(int _playerId, int _deckId)
|
||||
: GameEvent("deck_select", _playerId)
|
||||
{
|
||||
insertItem(new SerializableItem_Int("deck_id", _deckId));
|
||||
}
|
||||
Event_GameClosed::Event_GameClosed(int _playerId)
|
||||
: GameEvent("game_closed", _playerId)
|
||||
{
|
||||
}
|
||||
Event_ReadyStart::Event_ReadyStart(int _playerId)
|
||||
: GameEvent("ready_start", _playerId)
|
||||
{
|
||||
}
|
||||
Event_Concede::Event_Concede(int _playerId)
|
||||
: GameEvent("concede", _playerId)
|
||||
{
|
||||
}
|
||||
Event_Shuffle::Event_Shuffle(int _playerId)
|
||||
: GameEvent("shuffle", _playerId)
|
||||
{
|
||||
|
@ -335,6 +322,19 @@ Event_ChatSay::Event_ChatSay(const QString &_channel, const QString &_playerName
|
|||
insertItem(new SerializableItem_String("player_name", _playerName));
|
||||
insertItem(new SerializableItem_String("message", _message));
|
||||
}
|
||||
Context_ReadyStart::Context_ReadyStart()
|
||||
: GameEventContext("ready_start")
|
||||
{
|
||||
}
|
||||
Context_Concede::Context_Concede()
|
||||
: GameEventContext("concede")
|
||||
{
|
||||
}
|
||||
Context_DeckSelect::Context_DeckSelect(int _deckId)
|
||||
: GameEventContext("deck_select")
|
||||
{
|
||||
insertItem(new SerializableItem_Int("deck_id", _deckId));
|
||||
}
|
||||
void ProtocolItem::initializeHashAuto()
|
||||
{
|
||||
itemNameHash.insert("cmdping", Command_Ping::newItem);
|
||||
|
@ -374,10 +374,7 @@ void ProtocolItem::initializeHashAuto()
|
|||
itemNameHash.insert("cmdstop_dump_zone", Command_StopDumpZone::newItem);
|
||||
itemNameHash.insert("game_eventsay", Event_Say::newItem);
|
||||
itemNameHash.insert("game_eventleave", Event_Leave::newItem);
|
||||
itemNameHash.insert("game_eventdeck_select", Event_DeckSelect::newItem);
|
||||
itemNameHash.insert("game_eventgame_closed", Event_GameClosed::newItem);
|
||||
itemNameHash.insert("game_eventready_start", Event_ReadyStart::newItem);
|
||||
itemNameHash.insert("game_eventconcede", Event_Concede::newItem);
|
||||
itemNameHash.insert("game_eventshuffle", Event_Shuffle::newItem);
|
||||
itemNameHash.insert("game_eventroll_die", Event_RollDie::newItem);
|
||||
itemNameHash.insert("game_eventmove_card", Event_MoveCard::newItem);
|
||||
|
@ -395,4 +392,7 @@ void ProtocolItem::initializeHashAuto()
|
|||
itemNameHash.insert("chat_eventchat_join_channel", Event_ChatJoinChannel::newItem);
|
||||
itemNameHash.insert("chat_eventchat_leave_channel", Event_ChatLeaveChannel::newItem);
|
||||
itemNameHash.insert("chat_eventchat_say", Event_ChatSay::newItem);
|
||||
itemNameHash.insert("game_event_contextready_start", Context_ReadyStart::newItem);
|
||||
itemNameHash.insert("game_event_contextconcede", Context_Concede::newItem);
|
||||
itemNameHash.insert("game_event_contextdeck_select", Context_DeckSelect::newItem);
|
||||
}
|
||||
|
|
|
@ -35,10 +35,7 @@
|
|||
2:stop_dump_zone:i,player_id:s,zone_name
|
||||
3:say:s,message
|
||||
3:leave
|
||||
3:deck_select:i,deck_id
|
||||
3:game_closed
|
||||
3:ready_start
|
||||
3:concede
|
||||
3:shuffle
|
||||
3:roll_die:i,sides:i,value
|
||||
3:move_card:i,card_id:s,card_name:s,start_zone:i,position:s,target_zone:i,x:i,y:i,new_card_id:b,face_down
|
||||
|
@ -56,3 +53,6 @@
|
|||
5:chat_join_channel:s,player_name
|
||||
5:chat_leave_channel:s,player_name
|
||||
5:chat_say:s,player_name:s,message
|
||||
6:ready_start
|
||||
6:concede
|
||||
6:deck_select:i,deck_id
|
||||
|
|
|
@ -321,14 +321,6 @@ public:
|
|||
static SerializableItem *newItem() { return new Event_Leave; }
|
||||
int getItemId() const { return ItemId_Event_Leave; }
|
||||
};
|
||||
class Event_DeckSelect : public GameEvent {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Event_DeckSelect(int _playerId = -1, int _deckId = -1);
|
||||
int getDeckId() const { return static_cast<SerializableItem_Int *>(itemMap.value("deck_id"))->getData(); };
|
||||
static SerializableItem *newItem() { return new Event_DeckSelect; }
|
||||
int getItemId() const { return ItemId_Event_DeckSelect; }
|
||||
};
|
||||
class Event_GameClosed : public GameEvent {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -336,20 +328,6 @@ public:
|
|||
static SerializableItem *newItem() { return new Event_GameClosed; }
|
||||
int getItemId() const { return ItemId_Event_GameClosed; }
|
||||
};
|
||||
class Event_ReadyStart : public GameEvent {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Event_ReadyStart(int _playerId = -1);
|
||||
static SerializableItem *newItem() { return new Event_ReadyStart; }
|
||||
int getItemId() const { return ItemId_Event_ReadyStart; }
|
||||
};
|
||||
class Event_Concede : public GameEvent {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Event_Concede(int _playerId = -1);
|
||||
static SerializableItem *newItem() { return new Event_Concede; }
|
||||
int getItemId() const { return ItemId_Event_Concede; }
|
||||
};
|
||||
class Event_Shuffle : public GameEvent {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -511,5 +489,27 @@ public:
|
|||
static SerializableItem *newItem() { return new Event_ChatSay; }
|
||||
int getItemId() const { return ItemId_Event_ChatSay; }
|
||||
};
|
||||
class Context_ReadyStart : public GameEventContext {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Context_ReadyStart();
|
||||
static SerializableItem *newItem() { return new Context_ReadyStart; }
|
||||
int getItemId() const { return ItemId_Context_ReadyStart; }
|
||||
};
|
||||
class Context_Concede : public GameEventContext {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Context_Concede();
|
||||
static SerializableItem *newItem() { return new Context_Concede; }
|
||||
int getItemId() const { return ItemId_Context_Concede; }
|
||||
};
|
||||
class Context_DeckSelect : public GameEventContext {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Context_DeckSelect(int _deckId = -1);
|
||||
int getDeckId() const { return static_cast<SerializableItem_Int *>(itemMap.value("deck_id"))->getData(); };
|
||||
static SerializableItem *newItem() { return new Context_DeckSelect; }
|
||||
int getItemId() const { return ItemId_Context_DeckSelect; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -66,6 +66,13 @@ while (<file>) {
|
|||
$parentConstructorCall = "$baseClass(\"$name1\", _channel)";
|
||||
$constructorParamsH = "const QString &_channel = QString()";
|
||||
$constructorParamsCpp = "const QString &_channel";
|
||||
} elsif ($type == 6) {
|
||||
$type = 'game_event_context';
|
||||
$namePrefix = 'Context';
|
||||
$baseClass = 'GameEventContext';
|
||||
$parentConstructorCall = "$baseClass(\"$name1\")";
|
||||
$constructorParamsH = "";
|
||||
$constructorParamsCpp = "";
|
||||
}
|
||||
$className = $namePrefix . '_' . $name2;
|
||||
$itemEnum .= "ItemId_$className = " . ++$itemId . ",\n";
|
||||
|
|
|
@ -180,7 +180,7 @@ Server_Player *Server_Game::addPlayer(Server_ProtocolHandler *handler, bool spec
|
|||
int playerId = keyList.isEmpty() ? 0 : (keyList.last() + 1);
|
||||
|
||||
Server_Player *newPlayer = new Server_Player(this, playerId, handler->getPlayerName(), spectator, handler);
|
||||
sendGameEvent(new Event_Join(new ServerInfo_Player(playerId, handler->getPlayerName(), spectator)));
|
||||
sendGameEvent(new Event_Join(newPlayer->getProperties()));
|
||||
players.insert(playerId, newPlayer);
|
||||
|
||||
if (broadcastUpdate)
|
||||
|
@ -275,14 +275,15 @@ QList<ServerInfo_Player *> Server_Game::getGameState(Server_Player *playerWhosAs
|
|||
zoneList.append(new ServerInfo_Zone(zone->getName(), zone->getType(), zone->hasCoords(), zone->cards.size(), cardList));
|
||||
}
|
||||
|
||||
result.append(new ServerInfo_Player(player->getPlayerId(), player->getPlayerName(), player->getSpectator(), player->getConceded(), player == playerWhosAsking ? player->getDeck() : 0, zoneList, counterList, arrowList));
|
||||
ServerInfo_PlayerProperties *properties = new ServerInfo_PlayerProperties(player->getPlayerId(), player->getPlayerName(), player->getSpectator(), player->getConceded(), player->getReadyStart(), player->getDeckId());
|
||||
result.append(new ServerInfo_Player(properties, player == playerWhosAsking ? player->getDeck() : 0, zoneList, counterList, arrowList));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void Server_Game::sendGameEvent(GameEvent *event, Server_Player *exclude)
|
||||
void Server_Game::sendGameEvent(GameEvent *event, GameEventContext *context, Server_Player *exclude)
|
||||
{
|
||||
sendGameEventContainer(new GameEventContainer(QList<GameEvent *>() << event), exclude);
|
||||
sendGameEventContainer(new GameEventContainer(QList<GameEvent *>() << event, -1, context), exclude);
|
||||
}
|
||||
|
||||
void Server_Game::sendGameEventContainer(GameEventContainer *cont, Server_Player *exclude)
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
void setActivePhase(int _activePhase);
|
||||
|
||||
QList<ServerInfo_Player *> getGameState(Server_Player *playerWhosAsking) const;
|
||||
void sendGameEvent(GameEvent *event, Server_Player *exclude = 0);
|
||||
void sendGameEvent(GameEvent *event, GameEventContext *context = 0, Server_Player *exclude = 0);
|
||||
void sendGameEventContainer(GameEventContainer *cont, Server_Player *exclude = 0);
|
||||
void sendGameEventToPlayer(Server_Player *player, GameEvent *event);
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "decklist.h"
|
||||
|
||||
Server_Player::Server_Player(Server_Game *_game, int _playerId, const QString &_playerName, bool _spectator, Server_ProtocolHandler *_handler)
|
||||
: game(_game), handler(_handler), deck(0), playerId(_playerId), playerName(_playerName), spectator(_spectator), nextCardId(0), readyStart(false), conceded(false)
|
||||
: game(_game), handler(_handler), deck(0), playerId(_playerId), playerName(_playerName), spectator(_spectator), nextCardId(0), readyStart(false), conceded(false), deckId(-2)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -124,10 +124,16 @@ void Server_Player::clearZones()
|
|||
arrows.clear();
|
||||
}
|
||||
|
||||
void Server_Player::setDeck(DeckList *_deck)
|
||||
ServerInfo_PlayerProperties *Server_Player::getProperties()
|
||||
{
|
||||
return new ServerInfo_PlayerProperties(playerId, playerName, spectator, conceded, readyStart, deckId);
|
||||
}
|
||||
|
||||
void Server_Player::setDeck(DeckList *_deck, int _deckId)
|
||||
{
|
||||
delete deck;
|
||||
deck = _deck;
|
||||
deckId = _deckId;
|
||||
}
|
||||
|
||||
void Server_Player::addZone(Server_CardZone *zone)
|
||||
|
|
|
@ -13,6 +13,7 @@ class Server_Counter;
|
|||
class Server_Arrow;
|
||||
class Server_ProtocolHandler;
|
||||
class ProtocolItem;
|
||||
class ServerInfo_PlayerProperties;
|
||||
|
||||
class Server_Player : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -31,6 +32,7 @@ private:
|
|||
void clearZones();
|
||||
bool readyStart;
|
||||
bool conceded;
|
||||
int deckId;
|
||||
public:
|
||||
Server_Player(Server_Game *_game, int _playerId, const QString &_playerName, bool _spectator, Server_ProtocolHandler *_handler);
|
||||
~Server_Player();
|
||||
|
@ -46,12 +48,15 @@ public:
|
|||
bool getSpectator() const { return spectator; }
|
||||
bool getConceded() const { return conceded; }
|
||||
void setConceded(bool _conceded) { conceded = _conceded; }
|
||||
int getDeckId() const { return deckId; }
|
||||
QString getPlayerName() const { return playerName; }
|
||||
void setDeck(DeckList *_deck);
|
||||
void setDeck(DeckList *_deck, int _deckId);
|
||||
DeckList *getDeck() const { return deck; }
|
||||
const QMap<QString, Server_CardZone *> &getZones() const { return zones; }
|
||||
const QMap<int, Server_Counter *> &getCounters() const { return counters; }
|
||||
const QMap<int, Server_Arrow *> &getArrows() const { return arrows; }
|
||||
|
||||
ServerInfo_PlayerProperties *getProperties();
|
||||
|
||||
int newCardId();
|
||||
int newCounterId() const;
|
||||
|
|
|
@ -343,10 +343,10 @@ ResponseCode Server_ProtocolHandler::cmdDeckSelect(Command_DeckSelect *cmd, Comm
|
|||
return r;
|
||||
}
|
||||
}
|
||||
player->setDeck(deck);
|
||||
|
||||
game->sendGameEvent(new Event_DeckSelect(player->getPlayerId(), cmd->getDeckId()));
|
||||
player->setDeck(deck, cmd->getDeckId());
|
||||
|
||||
game->sendGameEvent(new Event_PlayerPropertiesChanged(player->getProperties()), new Context_DeckSelect(cmd->getDeckId()));
|
||||
|
||||
cont->setResponse(new Response_DeckDownload(cont->getCmdId(), RespOk, new DeckList(deck)));
|
||||
return RespNothing;
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ ResponseCode Server_ProtocolHandler::cmdDeckSelect(Command_DeckSelect *cmd, Comm
|
|||
ResponseCode Server_ProtocolHandler::cmdConcede(Command_Concede * /*cmd*/, CommandContainer *cont, Server_Game *game, Server_Player *player)
|
||||
{
|
||||
player->setConceded(true);
|
||||
game->sendGameEvent(new Event_Concede(player->getPlayerId()));
|
||||
game->sendGameEvent(new Event_PlayerPropertiesChanged(player->getProperties()), new Context_Concede);
|
||||
game->stopGameIfFinished();
|
||||
return RespOk;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ ResponseCode Server_ProtocolHandler::cmdReadyStart(Command_ReadyStart * /*cmd*/,
|
|||
return RespContextError;
|
||||
|
||||
player->setReadyStart(true);
|
||||
game->sendGameEvent(new Event_ReadyStart(player->getPlayerId()));
|
||||
game->sendGameEvent(new Event_PlayerPropertiesChanged(player->getProperties()), new Context_ReadyStart);
|
||||
game->startGameIfReady();
|
||||
return RespOk;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue