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();
|
c = i.next();
|
||||||
if (c->getMsgId() == msgid) {
|
if (c->getMsgId() == msgid) {
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
QString cmd = c->getCmd();
|
|
||||||
if (cmd.startsWith("submit_deck"))
|
|
||||||
readyStart();
|
|
||||||
|
|
||||||
break;
|
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));
|
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);
|
QStringListIterator i(deck);
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
msg(i.next());
|
msg(i.next());
|
||||||
msg(".");
|
msg(".");
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Client::readyStart()
|
int Client::readyStart()
|
||||||
|
|
|
@ -73,7 +73,6 @@ public:
|
||||||
int moveCard(int cardid, const QString &startzone, const QString &targetzone, int x, int y = 0);
|
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 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 setCardAttr(const QString &zone, int cardid, const QString &aname, const QString &avalue);
|
||||||
int submitDeck(const QStringList &deck);
|
|
||||||
int readyStart();
|
int readyStart();
|
||||||
int incCounter(const QString &counter, int delta);
|
int incCounter(const QString &counter, int delta);
|
||||||
int setCounter(const QString &counter, int value);
|
int setCounter(const QString &counter, int value);
|
||||||
|
@ -81,6 +80,8 @@ public:
|
||||||
int setActivePlayer(int player);
|
int setActivePlayer(int player);
|
||||||
int setActivePhase(int phase);
|
int setActivePhase(int phase);
|
||||||
int dumpZone(int player, const QString &zone, int numberCards);
|
int dumpZone(int player, const QString &zone, int numberCards);
|
||||||
|
public slots:
|
||||||
|
void submitDeck(const QStringList &deck);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,6 +49,8 @@ void DlgStartGame::actLoad()
|
||||||
}
|
}
|
||||||
card->getPixmap();
|
card->getPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit newDeckLoaded(getDeckList());
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList DlgStartGame::getDeckList() const
|
QStringList DlgStartGame::getDeckList() const
|
||||||
|
|
|
@ -13,6 +13,8 @@ class DlgStartGame: public QDialog {
|
||||||
public:
|
public:
|
||||||
DlgStartGame(CardDatabase *_db, QWidget *parent = 0);
|
DlgStartGame(CardDatabase *_db, QWidget *parent = 0);
|
||||||
QStringList getDeckList() const;
|
QStringList getDeckList() const;
|
||||||
|
signals:
|
||||||
|
void newDeckLoaded(const QStringList &cards);
|
||||||
private slots:
|
private slots:
|
||||||
void actLoad();
|
void actLoad();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -84,6 +84,8 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
||||||
cardMenu->addAction(aRearrange);
|
cardMenu->addAction(aRearrange);
|
||||||
|
|
||||||
dlgStartGame = new DlgStartGame(db);
|
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()
|
Game::~Game()
|
||||||
|
@ -139,10 +141,16 @@ void Game::playerListReceived(QList<ServerPlayer *> playerList)
|
||||||
restartGameDialog();
|
restartGameDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::readyStart(int foo)
|
||||||
|
{
|
||||||
|
Q_UNUSED(foo);
|
||||||
|
|
||||||
|
client->readyStart();
|
||||||
|
}
|
||||||
|
|
||||||
void Game::restartGameDialog()
|
void Game::restartGameDialog()
|
||||||
{
|
{
|
||||||
dlgStartGame->exec();
|
dlgStartGame->show();
|
||||||
client->submitDeck(dlgStartGame->getDeckList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::gameEvent(ServerEventData *msg)
|
void Game::gameEvent(ServerEventData *msg)
|
||||||
|
|
|
@ -47,6 +47,7 @@ private slots:
|
||||||
|
|
||||||
void gameEvent(ServerEventData *msg);
|
void gameEvent(ServerEventData *msg);
|
||||||
void playerListReceived(QList<ServerPlayer *> playerList);
|
void playerListReceived(QList<ServerPlayer *> playerList);
|
||||||
|
void readyStart(int foo);
|
||||||
signals:
|
signals:
|
||||||
void submitDecklist();
|
void submitDecklist();
|
||||||
void hoverCard(QString name);
|
void hoverCard(QString name);
|
||||||
|
|
|
@ -38,7 +38,7 @@ void myMessageOutput(QtMsgType type, const char *msg)
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
qInstallMsgHandler(myMessageOutput);
|
// qInstallMsgHandler(myMessageOutput);
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
app.addLibraryPath("plugins");
|
app.addLibraryPath("plugins");
|
||||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||||
|
|
|
@ -130,7 +130,6 @@ void MainWindow::buttonSay()
|
||||||
void MainWindow::playerIdReceived(int id, QString name)
|
void MainWindow::playerIdReceived(int id, QString name)
|
||||||
{
|
{
|
||||||
game = new Game(db, client, scene, actionsMenu, cardMenu, id, 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(hoverCard(QString)), this, SLOT(hoverCard(QString)));
|
||||||
connect(game, SIGNAL(playerAdded(Player *)), this, SLOT(playerAdded(Player *)));
|
connect(game, SIGNAL(playerAdded(Player *)), this, SLOT(playerAdded(Player *)));
|
||||||
connect(game, SIGNAL(playerRemoved(Player *)), this, SLOT(playerRemoved(Player *)));
|
connect(game, SIGNAL(playerRemoved(Player *)), this, SLOT(playerRemoved(Player *)));
|
||||||
|
|
|
@ -97,8 +97,10 @@ void TestServerGame::startGameIfReady()
|
||||||
if (players.at(i)->getStatus() != StatusReadyStart)
|
if (players.at(i)->getStatus() != StatusReadyStart)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!rnd) {
|
||||||
rnd = new TestRandom(this);
|
rnd = new TestRandom(this);
|
||||||
rnd->init();
|
rnd->init();
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < players.size(); i++)
|
for (int i = 0; i < players.size(); i++)
|
||||||
players.at(i)->setupZones();
|
players.at(i)->setupZones();
|
||||||
|
|
Loading…
Reference in a new issue