translation fix; minor improvement

This commit is contained in:
Max-Wilhelm Bruker 2010-02-04 16:25:38 +01:00
parent 5efb92e2d6
commit 3d5ba34aaf
17 changed files with 107 additions and 52 deletions

View file

@ -7,12 +7,16 @@ class QMenu;
class Tab : public QWidget { class Tab : public QWidget {
Q_OBJECT Q_OBJECT
signals:
void userEvent();
protected: protected:
QMenu *tabMenu; QMenu *tabMenu;
public: public:
Tab(QWidget *parent = 0) Tab(QWidget *parent = 0)
: QWidget(parent), tabMenu(0) { } : QWidget(parent), tabMenu(0) { }
QMenu *getTabMenu() const { return tabMenu; } QMenu *getTabMenu() const { return tabMenu; }
virtual QString getTabText() const = 0;
virtual void retranslateUi() = 0;
}; };
#endif #endif

View file

@ -80,6 +80,7 @@ void TabChatChannel::processJoinChannelEvent(Event_ChatJoinChannel *event)
{ {
textEdit->append(tr("%1 has joined the channel.").arg(event->getPlayerName())); textEdit->append(tr("%1 has joined the channel.").arg(event->getPlayerName()));
playerList->addItem(event->getPlayerName()); playerList->addItem(event->getPlayerName());
emit userEvent();
} }
void TabChatChannel::processLeaveChannelEvent(Event_ChatLeaveChannel *event) void TabChatChannel::processLeaveChannelEvent(Event_ChatLeaveChannel *event)
@ -90,6 +91,7 @@ void TabChatChannel::processLeaveChannelEvent(Event_ChatLeaveChannel *event)
delete playerList->takeItem(i); delete playerList->takeItem(i);
break; break;
} }
emit userEvent();
} }
void TabChatChannel::processSayEvent(Event_ChatSay *event) void TabChatChannel::processSayEvent(Event_ChatSay *event)
@ -98,5 +100,5 @@ void TabChatChannel::processSayEvent(Event_ChatSay *event)
textEdit->append(QString("<font color=\"blue\">%1</font").arg(event->getMessage())); textEdit->append(QString("<font color=\"blue\">%1</font").arg(event->getMessage()));
else else
textEdit->append(QString("<font color=\"red\">%1:</font> %2").arg(event->getPlayerName()).arg(event->getMessage())); textEdit->append(QString("<font color=\"red\">%1:</font> %2").arg(event->getPlayerName()).arg(event->getMessage()));
QApplication::alert(this); emit userEvent();
} }

View file

@ -40,6 +40,7 @@ public:
void retranslateUi(); void retranslateUi();
void processChatEvent(ChatEvent *event); void processChatEvent(ChatEvent *event);
QString getChannelName() const { return channelName; } QString getChannelName() const { return channelName; }
QString getTabText() const { return channelName; }
}; };
#endif #endif

View file

@ -47,6 +47,7 @@ private slots:
public: public:
TabDeckStorage(Client *_client); TabDeckStorage(Client *_client);
void retranslateUi(); void retranslateUi();
QString getTabText() const { return tr("Deck storage"); }
}; };
#endif #endif

View file

@ -20,8 +20,8 @@
#include "arrowitem.h" #include "arrowitem.h"
#include "main.h" #include "main.h"
TabGame::TabGame(Client *_client, int _gameId, int _localPlayerId, bool _spectator, bool _resuming) TabGame::TabGame(Client *_client, int _gameId, const QString &_gameDescription, int _localPlayerId, bool _spectator, bool _resuming)
: Tab(), client(_client), gameId(_gameId), localPlayerId(_localPlayerId), spectator(_spectator), started(false), resuming(_resuming), currentPhase(-1) : Tab(), client(_client), gameId(_gameId), gameDescription(_gameDescription), localPlayerId(_localPlayerId), spectator(_spectator), started(false), resuming(_resuming), currentPhase(-1)
{ {
zoneLayout = new ZoneViewLayout; zoneLayout = new ZoneViewLayout;
scene = new GameScene(zoneLayout, this); scene = new GameScene(zoneLayout, this);
@ -244,6 +244,7 @@ void TabGame::processGameEvent(GameEvent *event)
break; break;
} }
player->processGameEvent(event); player->processGameEvent(event);
emit userEvent();
} }
} }
} }
@ -307,6 +308,7 @@ void TabGame::eventGameStateChanged(Event_GameStateChanged *event)
stopGame(); stopGame();
zoneLayout->clear(); zoneLayout->clear();
} }
emit userEvent();
} }
void TabGame::eventJoin(Event_Join *event) void TabGame::eventJoin(Event_Join *event)
@ -321,6 +323,7 @@ void TabGame::eventJoin(Event_Join *event)
messageLog->logJoin(newPlayer); messageLog->logJoin(newPlayer);
playerListWidget->addPlayer(playerInfo); playerListWidget->addPlayer(playerInfo);
} }
emit userEvent();
} }
void TabGame::eventLeave(Event_Leave *event) void TabGame::eventLeave(Event_Leave *event)
@ -338,12 +341,14 @@ void TabGame::eventLeave(Event_Leave *event)
playerListWidget->removePlayer(playerId); playerListWidget->removePlayer(playerId);
spectators.remove(playerId); spectators.remove(playerId);
} }
emit userEvent();
} }
void TabGame::eventGameClosed(Event_GameClosed * /*event*/) void TabGame::eventGameClosed(Event_GameClosed * /*event*/)
{ {
started = false; started = false;
messageLog->logGameClosed(); messageLog->logGameClosed();
emit userEvent();
} }
Player *TabGame::setActivePlayer(int id) Player *TabGame::setActivePlayer(int id)
@ -358,6 +363,7 @@ Player *TabGame::setActivePlayer(int id)
i.value()->setActive(i.value() == player); i.value()->setActive(i.value() == player);
} }
currentPhase = -1; currentPhase = -1;
emit userEvent();
return player; return player;
} }
@ -367,6 +373,7 @@ void TabGame::eventSetActivePlayer(Event_SetActivePlayer *event)
if (!player) if (!player)
return; return;
messageLog->logSetActivePlayer(player); messageLog->logSetActivePlayer(player);
emit userEvent();
} }
void TabGame::setActivePhase(int phase) void TabGame::setActivePhase(int phase)
@ -383,6 +390,7 @@ void TabGame::eventSetActivePhase(Event_SetActivePhase *event)
if (currentPhase != phase) if (currentPhase != phase)
messageLog->logSetActivePhase(phase); messageLog->logSetActivePhase(phase);
setActivePhase(phase); setActivePhase(phase);
emit userEvent();
} }
void TabGame::eventPing(Event_Ping *event) void TabGame::eventPing(Event_Ping *event)

View file

@ -40,6 +40,7 @@ class TabGame : public Tab {
private: private:
Client *client; Client *client;
int gameId; int gameId;
QString gameDescription;
int localPlayerId; int localPlayerId;
bool spectator; bool spectator;
QMap<int, Player *> players; QMap<int, Player *> players;
@ -95,11 +96,12 @@ private slots:
void actNextPhase(); void actNextPhase();
void actNextTurn(); void actNextTurn();
public: public:
TabGame(Client *_client, int _gameId, int _localPlayerId, bool _spectator, bool _resuming); TabGame(Client *_client, int _gameId, const QString &_gameDescription, int _localPlayerId, bool _spectator, bool _resuming);
~TabGame(); ~TabGame();
void retranslateUi(); void retranslateUi();
const QMap<int, Player *> &getPlayers() const { return players; } const QMap<int, Player *> &getPlayers() const { return players; }
int getGameId() const { return gameId; } int getGameId() const { return gameId; }
QString getTabText() const { return tr("Game %1: %2").arg(gameId).arg(gameDescription); }
void processGameEvent(GameEvent *event); void processGameEvent(GameEvent *event);
public slots: public slots:

View file

@ -85,6 +85,7 @@ private:
public: public:
TabServer(Client *_client, QWidget *parent = 0); TabServer(Client *_client, QWidget *parent = 0);
void retranslateUi(); void retranslateUi();
QString getTabText() const { return tr("Server"); }
}; };
#endif #endif

View file

@ -1,3 +1,4 @@
#include <QApplication>
#include "tab_supervisor.h" #include "tab_supervisor.h"
#include "client.h" #include "client.h"
#include "tab_server.h" #include "tab_server.h"
@ -16,22 +17,28 @@ TabSupervisor:: TabSupervisor(QWidget *parent)
void TabSupervisor::retranslateUi() void TabSupervisor::retranslateUi()
{ {
if (tabServer) { QList<Tab *> tabs;
setTabText(0, tr("Server")); if (tabServer)
tabServer->retranslateUi(); tabs.append(tabServer);
} if (tabDeckStorage)
if (tabDeckStorage) { tabs.append(tabDeckStorage);
setTabText(1, tr("Deck storage"));
tabDeckStorage->retranslateUi();
}
QMapIterator<QString, TabChatChannel *> chatChannelIterator(chatChannelTabs); QMapIterator<QString, TabChatChannel *> chatChannelIterator(chatChannelTabs);
while (chatChannelIterator.hasNext()) while (chatChannelIterator.hasNext())
chatChannelIterator.next().value()->retranslateUi(); tabs.append(chatChannelIterator.next().value());
QMapIterator<int, TabGame *> gameIterator(gameTabs); QMapIterator<int, TabGame *> gameIterator(gameTabs);
while (gameIterator.hasNext()) while (gameIterator.hasNext())
gameIterator.next().value()->retranslateUi(); tabs.append(gameIterator.next().value());
for (int i = 0; i < tabs.size(); ++i) {
setTabText(indexOf(tabs[i]), tabs[i]->getTabText());
tabs[i]->retranslateUi();
}
}
void TabSupervisor::myAddTab(Tab *tab)
{
connect(tab, SIGNAL(userEvent()), this, SLOT(tabUserEvent()));
addTab(tab, tab->getTabText());
} }
void TabSupervisor::start(Client *_client) void TabSupervisor::start(Client *_client)
@ -44,11 +51,11 @@ void TabSupervisor::start(Client *_client)
tabServer = new TabServer(client); tabServer = new TabServer(client);
connect(tabServer, SIGNAL(chatChannelJoined(const QString &)), this, SLOT(addChatChannelTab(const QString &))); connect(tabServer, SIGNAL(chatChannelJoined(const QString &)), this, SLOT(addChatChannelTab(const QString &)));
addTab(tabServer, QString()); myAddTab(tabServer);
updatePingTime(0, -1); updatePingTime(0, -1);
tabDeckStorage = new TabDeckStorage(client); tabDeckStorage = new TabDeckStorage(client);
addTab(tabDeckStorage, QString()); myAddTab(tabDeckStorage);
retranslateUi(); retranslateUi();
} }
@ -89,9 +96,9 @@ void TabSupervisor::updatePingTime(int value, int max)
void TabSupervisor::gameJoined(Event_GameJoined *event) void TabSupervisor::gameJoined(Event_GameJoined *event)
{ {
TabGame *tab = new TabGame(client, event->getGameId(), event->getPlayerId(), event->getSpectator(), event->getResuming()); TabGame *tab = new TabGame(client, event->getGameId(), event->getGameDescription(), event->getPlayerId(), event->getSpectator(), event->getResuming());
connect(tab, SIGNAL(gameClosing(TabGame *)), this, SLOT(gameLeft(TabGame *))); connect(tab, SIGNAL(gameClosing(TabGame *)), this, SLOT(gameLeft(TabGame *)));
addTab(tab, tr("Game %1").arg(event->getGameId())); myAddTab(tab);
gameTabs.insert(event->getGameId(), tab); gameTabs.insert(event->getGameId(), tab);
setCurrentWidget(tab); setCurrentWidget(tab);
} }
@ -108,7 +115,7 @@ void TabSupervisor::addChatChannelTab(const QString &channelName)
{ {
TabChatChannel *tab = new TabChatChannel(client, channelName); TabChatChannel *tab = new TabChatChannel(client, channelName);
connect(tab, SIGNAL(channelClosing(TabChatChannel *)), this, SLOT(chatChannelLeft(TabChatChannel *))); connect(tab, SIGNAL(channelClosing(TabChatChannel *)), this, SLOT(chatChannelLeft(TabChatChannel *)));
addTab(tab, channelName); myAddTab(tab);
chatChannelTabs.insert(channelName, tab); chatChannelTabs.insert(channelName, tab);
setCurrentWidget(tab); setCurrentWidget(tab);
} }
@ -121,6 +128,13 @@ void TabSupervisor::chatChannelLeft(TabChatChannel *tab)
removeTab(indexOf(tab)); removeTab(indexOf(tab));
} }
void TabSupervisor::tabUserEvent()
{
Tab *tab = static_cast<Tab *>(sender());
// XXX Mark tab as changed (exclamation mark icon?)
QApplication::alert(this);
}
void TabSupervisor::processChatEvent(ChatEvent *event) void TabSupervisor::processChatEvent(ChatEvent *event)
{ {
TabChatChannel *tab = chatChannelTabs.value(event->getChannel(), 0); TabChatChannel *tab = chatChannelTabs.value(event->getChannel(), 0);

View file

@ -6,6 +6,7 @@
class QMenu; class QMenu;
class Client; class Client;
class Tab;
class TabServer; class TabServer;
class TabChatChannel; class TabChatChannel;
class TabGame; class TabGame;
@ -22,6 +23,7 @@ private:
TabDeckStorage *tabDeckStorage; TabDeckStorage *tabDeckStorage;
QMap<QString, TabChatChannel *> chatChannelTabs; QMap<QString, TabChatChannel *> chatChannelTabs;
QMap<int, TabGame *> gameTabs; QMap<int, TabGame *> gameTabs;
void myAddTab(Tab *tab);
public: public:
TabSupervisor(QWidget *parent = 0); TabSupervisor(QWidget *parent = 0);
void retranslateUi(); void retranslateUi();
@ -36,6 +38,7 @@ private slots:
void gameLeft(TabGame *tab); void gameLeft(TabGame *tab);
void addChatChannelTab(const QString &channelName); void addChatChannelTab(const QString &channelName);
void chatChannelLeft(TabChatChannel *tab); void chatChannelLeft(TabChatChannel *tab);
void tabUserEvent();
void processChatEvent(ChatEvent *event); void processChatEvent(ChatEvent *event);
void processGameEvent(GameEvent *event); void processGameEvent(GameEvent *event);
}; };

View file

@ -145,6 +145,8 @@ void MainWindow::retranslateUi()
aExit->setText(tr("&Exit")); aExit->setText(tr("&Exit"));
cockatriceMenu->setTitle(tr("&Cockatrice")); cockatriceMenu->setTitle(tr("&Cockatrice"));
tabSupervisor->retranslateUi();
} }
void MainWindow::createActions() void MainWindow::createActions()

View file

@ -2149,12 +2149,12 @@
</message> </message>
<message> <message>
<location filename="../src/player.cpp" line="416"/> <location filename="../src/player.cpp" line="416"/>
<location filename="../src/player.cpp" line="963"/> <location filename="../src/player.cpp" line="964"/>
<source>Number:</source> <source>Number:</source>
<translation>Anzahl:</translation> <translation>Anzahl:</translation>
</message> </message>
<message> <message>
<location filename="../src/player.cpp" line="963"/> <location filename="../src/player.cpp" line="964"/>
<source>Set counters</source> <source>Set counters</source>
<translation>Setze Zählmarken</translation> <translation>Setze Zählmarken</translation>
</message> </message>
@ -2295,7 +2295,7 @@
<translation>%1 hat den Raum betreten.</translation> <translation>%1 hat den Raum betreten.</translation>
</message> </message>
<message> <message>
<location filename="../src/tab_chatchannel.cpp" line="87"/> <location filename="../src/tab_chatchannel.cpp" line="88"/>
<source>%1 has left the channel.</source> <source>%1 has left the channel.</source>
<translation>%1 hat den Raum verlassen.</translation> <translation>%1 hat den Raum verlassen.</translation>
</message> </message>
@ -2362,6 +2362,11 @@ Bitte geben Sie einen Namen ein:</translation>
<source>Name of new folder:</source> <source>Name of new folder:</source>
<translation>Name für den neuen Ordner:</translation> <translation>Name für den neuen Ordner:</translation>
</message> </message>
<message>
<location filename="../src/tab_deck_storage.h" line="50"/>
<source>Deck storage</source>
<translation>Deckspeicherplatz</translation>
</message>
</context> </context>
<context> <context>
<name>TabGame</name> <name>TabGame</name>
@ -2475,23 +2480,33 @@ Bitte geben Sie einen Namen ein:</translation>
<source>Load deck</source> <source>Load deck</source>
<translation>Deck laden</translation> <translation>Deck laden</translation>
</message> </message>
<message>
<location filename="../src/tab_game.h" line="104"/>
<source>Game %1: %2</source>
<translation>Spiel %1: %2</translation>
</message>
</context>
<context>
<name>TabServer</name>
<message>
<location filename="../src/tab_server.h" line="88"/>
<source>Server</source>
<translation>Server</translation>
</message>
</context> </context>
<context> <context>
<name>TabSupervisor</name> <name>TabSupervisor</name>
<message> <message>
<location filename="../src/tab_supervisor.cpp" line="20"/>
<source>Server</source> <source>Server</source>
<translation>Server</translation> <translation type="obsolete">Server</translation>
</message> </message>
<message> <message>
<location filename="../src/tab_supervisor.cpp" line="24"/>
<source>Deck storage</source> <source>Deck storage</source>
<translation>Deckspeicherplatz</translation> <translation type="obsolete">Deckspeicherplatz</translation>
</message> </message>
<message> <message>
<location filename="../src/tab_supervisor.cpp" line="94"/>
<source>Game %1</source> <source>Game %1</source>
<translation>Spiel %1</translation> <translation type="obsolete">Spiel %1</translation>
</message> </message>
</context> </context>
<context> <context>

View file

@ -1440,7 +1440,7 @@
</message> </message>
<message> <message>
<location filename="../src/player.cpp" line="416"/> <location filename="../src/player.cpp" line="416"/>
<location filename="../src/player.cpp" line="963"/> <location filename="../src/player.cpp" line="964"/>
<source>Number:</source> <source>Number:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1465,7 +1465,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/player.cpp" line="963"/> <location filename="../src/player.cpp" line="964"/>
<source>Set counters</source> <source>Set counters</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1578,7 +1578,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/tab_chatchannel.cpp" line="87"/> <location filename="../src/tab_chatchannel.cpp" line="88"/>
<source>%1 has left the channel.</source> <source>%1 has left the channel.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1644,6 +1644,11 @@ Please enter a name:</source>
<source>Name of new folder:</source> <source>Name of new folder:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../src/tab_deck_storage.h" line="50"/>
<source>Deck storage</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>TabGame</name> <name>TabGame</name>
@ -1757,24 +1762,19 @@ Please enter a name:</source>
<source>Load deck</source> <source>Load deck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../src/tab_game.h" line="104"/>
<source>Game %1: %2</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>TabSupervisor</name> <name>TabServer</name>
<message> <message>
<location filename="../src/tab_supervisor.cpp" line="20"/> <location filename="../src/tab_server.h" line="88"/>
<source>Server</source> <source>Server</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../src/tab_supervisor.cpp" line="24"/>
<source>Deck storage</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_supervisor.cpp" line="94"/>
<source>Game %1</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>WndDeckEditor</name> <name>WndDeckEditor</name>

View file

@ -309,10 +309,11 @@ Event_ServerMessage::Event_ServerMessage(const QString &_message)
{ {
insertItem(new SerializableItem_String("message", _message)); insertItem(new SerializableItem_String("message", _message));
} }
Event_GameJoined::Event_GameJoined(int _gameId, int _playerId, bool _spectator, bool _resuming) Event_GameJoined::Event_GameJoined(int _gameId, const QString &_gameDescription, int _playerId, bool _spectator, bool _resuming)
: GenericEvent("game_joined") : GenericEvent("game_joined")
{ {
insertItem(new SerializableItem_Int("game_id", _gameId)); insertItem(new SerializableItem_Int("game_id", _gameId));
insertItem(new SerializableItem_String("game_description", _gameDescription));
insertItem(new SerializableItem_Int("player_id", _playerId)); insertItem(new SerializableItem_Int("player_id", _playerId));
insertItem(new SerializableItem_Bool("spectator", _spectator)); insertItem(new SerializableItem_Bool("spectator", _spectator));
insertItem(new SerializableItem_Bool("resuming", _resuming)); insertItem(new SerializableItem_Bool("resuming", _resuming));

View file

@ -52,7 +52,7 @@
3:dump_zone:i,zone_owner_id:s,zone:i,number_cards 3:dump_zone:i,zone_owner_id:s,zone:i,number_cards
3:stop_dump_zone:i,zone_owner_id:s,zone 3:stop_dump_zone:i,zone_owner_id:s,zone
4:server_message:s,message 4:server_message:s,message
4:game_joined:i,game_id:i,player_id:b,spectator:b,resuming 4:game_joined:i,game_id:s,game_description:i,player_id:b,spectator:b,resuming
5:chat_join_channel:s,player_name 5:chat_join_channel:s,player_name
5:chat_leave_channel:s,player_name 5:chat_leave_channel:s,player_name
5:chat_say:s,player_name:s,message 5:chat_say:s,player_name:s,message

View file

@ -476,8 +476,9 @@ public:
class Event_GameJoined : public GenericEvent { class Event_GameJoined : public GenericEvent {
Q_OBJECT Q_OBJECT
public: public:
Event_GameJoined(int _gameId = -1, int _playerId = -1, bool _spectator = false, bool _resuming = false); Event_GameJoined(int _gameId = -1, const QString &_gameDescription = QString(), int _playerId = -1, bool _spectator = false, bool _resuming = false);
int getGameId() const { return static_cast<SerializableItem_Int *>(itemMap.value("game_id"))->getData(); }; int getGameId() const { return static_cast<SerializableItem_Int *>(itemMap.value("game_id"))->getData(); };
QString getGameDescription() const { return static_cast<SerializableItem_String *>(itemMap.value("game_description"))->getData(); };
int getPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("player_id"))->getData(); }; int getPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("player_id"))->getData(); };
bool getSpectator() const { return static_cast<SerializableItem_Bool *>(itemMap.value("spectator"))->getData(); }; bool getSpectator() const { return static_cast<SerializableItem_Bool *>(itemMap.value("spectator"))->getData(); };
bool getResuming() const { return static_cast<SerializableItem_Bool *>(itemMap.value("resuming"))->getData(); }; bool getResuming() const { return static_cast<SerializableItem_Bool *>(itemMap.value("resuming"))->getData(); };

View file

@ -193,7 +193,7 @@ ResponseCode Server_ProtocolHandler::cmdLogin(Command_Login *cmd)
if (gamePlayers[j]->getPlayerName() == playerName) { if (gamePlayers[j]->getPlayerName() == playerName) {
gamePlayers[j]->setProtocolHandler(this); gamePlayers[j]->setProtocolHandler(this);
games.insert(serverGames[i]->getGameId(), QPair<Server_Game *, Server_Player *>(serverGames[i], gamePlayers[j])); games.insert(serverGames[i]->getGameId(), QPair<Server_Game *, Server_Player *>(serverGames[i], gamePlayers[j]));
enqueueProtocolItem(new Event_GameJoined(serverGames[i]->getGameId(), gamePlayers[j]->getPlayerId(), gamePlayers[j]->getSpectator(), true)); enqueueProtocolItem(new Event_GameJoined(serverGames[i]->getGameId(), serverGames[i]->getDescription(), gamePlayers[j]->getPlayerId(), gamePlayers[j]->getSpectator(), true));
enqueueProtocolItem(new Event_GameStateChanged(serverGames[i]->getGameId(), serverGames[i]->getGameStarted(), serverGames[i]->getActivePlayer(), serverGames[i]->getActivePhase(), serverGames[i]->getGameState(gamePlayers[j]))); enqueueProtocolItem(new Event_GameStateChanged(serverGames[i]->getGameId(), serverGames[i]->getGameStarted(), serverGames[i]->getActivePlayer(), serverGames[i]->getActivePhase(), serverGames[i]->getGameState(gamePlayers[j])));
} }
} }
@ -279,7 +279,7 @@ ResponseCode Server_ProtocolHandler::cmdCreateGame(Command_CreateGame *cmd)
Server_Player *creator = game->getCreator(); Server_Player *creator = game->getCreator();
games.insert(game->getGameId(), QPair<Server_Game *, Server_Player *>(game, creator)); games.insert(game->getGameId(), QPair<Server_Game *, Server_Player *>(game, creator));
enqueueProtocolItem(new Event_GameJoined(game->getGameId(), creator->getPlayerId(), false, false)); enqueueProtocolItem(new Event_GameJoined(game->getGameId(), game->getDescription(), creator->getPlayerId(), false, false));
enqueueProtocolItem(new Event_GameStateChanged(game->getGameId(), game->getGameStarted(), game->getActivePlayer(), game->getActivePhase(), game->getGameState(creator))); enqueueProtocolItem(new Event_GameStateChanged(game->getGameId(), game->getGameStarted(), game->getActivePlayer(), game->getActivePhase(), game->getGameState(creator)));
return RespOk; return RespOk;
} }
@ -297,7 +297,7 @@ ResponseCode Server_ProtocolHandler::cmdJoinGame(Command_JoinGame *cmd)
if (result == RespOk) { if (result == RespOk) {
Server_Player *player = g->addPlayer(this, cmd->getSpectator()); Server_Player *player = g->addPlayer(this, cmd->getSpectator());
games.insert(cmd->getGameId(), QPair<Server_Game *, Server_Player *>(g, player)); games.insert(cmd->getGameId(), QPair<Server_Game *, Server_Player *>(g, player));
enqueueProtocolItem(new Event_GameJoined(cmd->getGameId(), player->getPlayerId(), cmd->getSpectator(), false)); enqueueProtocolItem(new Event_GameJoined(cmd->getGameId(), g->getDescription(), player->getPlayerId(), cmd->getSpectator(), false));
enqueueProtocolItem(new Event_GameStateChanged(cmd->getGameId(), g->getGameStarted(), g->getActivePlayer(), g->getActivePhase(), g->getGameState(player))); enqueueProtocolItem(new Event_GameStateChanged(cmd->getGameId(), g->getGameStarted(), g->getActivePlayer(), g->getActivePhase(), g->getGameState(player)));
} }
return result; return result;

View file

@ -22,5 +22,5 @@ size=1
1\joinmessage="This is the general chat channel. This message is only here to show that channels can have a join message." 1\joinmessage="This is the general chat channel. This message is only here to show that channels can have a join message."
[game] [game]
max_game_inactivity_time=300 max_game_inactivity_time=120
max_player_inactivity_time=15 max_player_inactivity_time=15