Minor bugfixes
This commit is contained in:
parent
a11f93df4d
commit
e31cfd32b1
9 changed files with 26 additions and 17 deletions
|
@ -102,11 +102,6 @@ void Client::readLine()
|
|||
c = i.next();
|
||||
if (c->getMsgId() == msgid) {
|
||||
found = true;
|
||||
|
||||
QString cmd = c->getCmd();
|
||||
if (cmd.startsWith("submit_deck"))
|
||||
readyStart();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -276,14 +271,13 @@ int Client::setCardAttr(const QString &zone, int cardid, const QString &aname, c
|
|||
return cmd(QString("set_card_attr|%1|%2|%3|%4").arg(zone).arg(cardid).arg(aname).arg(avalue));
|
||||
}
|
||||
|
||||
int Client::submitDeck(const QStringList &deck)
|
||||
void Client::submitDeck(const QStringList &deck)
|
||||
{
|
||||
int retval = cmd("submit_deck");
|
||||
cmd("submit_deck");
|
||||
QStringListIterator i(deck);
|
||||
while (i.hasNext())
|
||||
msg(i.next());
|
||||
msg(".");
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Client::readyStart()
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
~Client();
|
||||
ProtocolStatus getStatus() { return status; }
|
||||
QString peerName() const { return socket->peerName(); }
|
||||
|
||||
|
||||
void connectToServer(const QString &hostname, unsigned int port, const QString &playername);
|
||||
void disconnectFromServer();
|
||||
int listGames();
|
||||
|
@ -73,7 +73,6 @@ public:
|
|||
int moveCard(int cardid, const QString &startzone, const QString &targetzone, int x, int y = 0);
|
||||
int createToken(const QString &zone, const QString &name, const QString &powtough, int x, int y);
|
||||
int setCardAttr(const QString &zone, int cardid, const QString &aname, const QString &avalue);
|
||||
int submitDeck(const QStringList &deck);
|
||||
int readyStart();
|
||||
int incCounter(const QString &counter, int delta);
|
||||
int setCounter(const QString &counter, int value);
|
||||
|
@ -81,6 +80,8 @@ public:
|
|||
int setActivePlayer(int player);
|
||||
int setActivePhase(int phase);
|
||||
int dumpZone(int player, const QString &zone, int numberCards);
|
||||
public slots:
|
||||
void submitDeck(const QStringList &deck);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -49,6 +49,8 @@ void DlgStartGame::actLoad()
|
|||
}
|
||||
card->getPixmap();
|
||||
}
|
||||
|
||||
emit newDeckLoaded(getDeckList());
|
||||
}
|
||||
|
||||
QStringList DlgStartGame::getDeckList() const
|
||||
|
|
|
@ -13,6 +13,8 @@ class DlgStartGame: public QDialog {
|
|||
public:
|
||||
DlgStartGame(CardDatabase *_db, QWidget *parent = 0);
|
||||
QStringList getDeckList() const;
|
||||
signals:
|
||||
void newDeckLoaded(const QStringList &cards);
|
||||
private slots:
|
||||
void actLoad();
|
||||
private:
|
||||
|
|
|
@ -84,6 +84,8 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
|||
cardMenu->addAction(aRearrange);
|
||||
|
||||
dlgStartGame = new DlgStartGame(db);
|
||||
connect(dlgStartGame, SIGNAL(newDeckLoaded(const QStringList &)), client, SLOT(submitDeck(const QStringList &)));
|
||||
connect(dlgStartGame, SIGNAL(finished(int)), this, SLOT(readyStart(int)));
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
|
@ -139,10 +141,16 @@ void Game::playerListReceived(QList<ServerPlayer *> playerList)
|
|||
restartGameDialog();
|
||||
}
|
||||
|
||||
void Game::readyStart(int foo)
|
||||
{
|
||||
Q_UNUSED(foo);
|
||||
|
||||
client->readyStart();
|
||||
}
|
||||
|
||||
void Game::restartGameDialog()
|
||||
{
|
||||
dlgStartGame->exec();
|
||||
client->submitDeck(dlgStartGame->getDeckList());
|
||||
dlgStartGame->show();
|
||||
}
|
||||
|
||||
void Game::gameEvent(ServerEventData *msg)
|
||||
|
|
|
@ -47,6 +47,7 @@ private slots:
|
|||
|
||||
void gameEvent(ServerEventData *msg);
|
||||
void playerListReceived(QList<ServerPlayer *> playerList);
|
||||
void readyStart(int foo);
|
||||
signals:
|
||||
void submitDecklist();
|
||||
void hoverCard(QString name);
|
||||
|
|
|
@ -38,7 +38,7 @@ void myMessageOutput(QtMsgType type, const char *msg)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
qInstallMsgHandler(myMessageOutput);
|
||||
// qInstallMsgHandler(myMessageOutput);
|
||||
QApplication app(argc, argv);
|
||||
app.addLibraryPath("plugins");
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
|
|
|
@ -130,7 +130,6 @@ void MainWindow::buttonSay()
|
|||
void MainWindow::playerIdReceived(int id, QString name)
|
||||
{
|
||||
game = new Game(db, client, scene, actionsMenu, cardMenu, id, name);
|
||||
connect(game, SIGNAL(submitDecklist()), this, SLOT(decklistDialog()));
|
||||
connect(game, SIGNAL(hoverCard(QString)), this, SLOT(hoverCard(QString)));
|
||||
connect(game, SIGNAL(playerAdded(Player *)), this, SLOT(playerAdded(Player *)));
|
||||
connect(game, SIGNAL(playerRemoved(Player *)), this, SLOT(playerRemoved(Player *)));
|
||||
|
|
|
@ -96,9 +96,11 @@ void TestServerGame::startGameIfReady()
|
|||
for (int i = 0; i < players.size(); i++)
|
||||
if (players.at(i)->getStatus() != StatusReadyStart)
|
||||
return;
|
||||
|
||||
rnd = new TestRandom(this);
|
||||
rnd->init();
|
||||
|
||||
if (!rnd) {
|
||||
rnd = new TestRandom(this);
|
||||
rnd->init();
|
||||
}
|
||||
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
players.at(i)->setupZones();
|
||||
|
|
Loading…
Reference in a new issue