phases toolbar fix; face down fix

This commit is contained in:
Max-Wilhelm Bruker 2009-09-25 17:17:15 +02:00
parent 85319ecc28
commit 33ccbe3c00
5 changed files with 48 additions and 12 deletions

View file

@ -493,3 +493,34 @@ void Game::queryGameState()
connect(pc, SIGNAL(cardListReceived(QList<ServerZoneCard>)), this, SLOT(cardListReceived(QList<ServerZoneCard>)));
connect(pc, SIGNAL(counterListReceived(QList<ServerCounter>)), this, SLOT(counterListReceived(QList<ServerCounter>)));
}
void Game::activePlayerDrawCard()
{
Player *p = getActiveLocalPlayer();
if (p)
p->actDrawCard();
}
void Game::activePlayerUntapAll()
{
Player *p = getActiveLocalPlayer();
if (p)
p->actUntapAll();
}
Player *Game::getActiveLocalPlayer() const
{
int localPlayerCount = 0;
QMapIterator<int, Player *> i(players);
while (i.hasNext())
if (i.next().value()->getLocal())
++localPlayerCount;
i.toFront();
while (i.hasNext()) {
Player *p = i.next().value();
if (p->getLocal() && (p->getActive() || (localPlayerCount == 1)))
return p;
}
return 0;
}

View file

@ -38,7 +38,12 @@ private:
QMap<int, Player *> players;
bool started;
int currentPhase;
Player *getActiveLocalPlayer() const;
public slots:
void activePlayerDrawCard();
void activePlayerUntapAll();
void actNextPhase();
void actNextTurn();
private slots:

View file

@ -39,11 +39,6 @@ public slots:
void actUntapAll();
void actRollDie();
void actCreateToken();
void actSayMessage();
private slots:
void updateBoundingRect();
void actShuffle();
void actDrawCard();
void actDrawCards();
@ -53,6 +48,10 @@ private slots:
void actViewGraveyard();
void actViewRfg();
void actViewSideboard();
void actSayMessage();
private slots:
void updateBoundingRect();
private:
QMenu *playerMenu, *handMenu, *graveMenu, *rfgMenu, *libraryMenu, *sbMenu, *countersMenu, *sayMenu;
QAction *aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToRfg,

View file

@ -93,6 +93,8 @@ void MainWindow::statusChanged(ProtocolStatus _status)
connect(game, SIGNAL(playerAdded(Player *)), this, SLOT(playerAdded(Player *)));
connect(game, SIGNAL(playerRemoved(Player *)), scene, SLOT(removePlayer(Player *)));
connect(game, SIGNAL(setActivePhase(int)), phasesToolbar, SLOT(setActivePhase(int)));
connect(phasesToolbar, SIGNAL(signalDrawCard()), game, SLOT(activePlayerDrawCard()));
connect(phasesToolbar, SIGNAL(signalUntapAll()), game, SLOT(activePlayerUntapAll()));
messageLog->connectToGame(game);
aRestartGame->setEnabled(true);
aLeaveGame->setEnabled(true);
@ -312,7 +314,6 @@ MainWindow::MainWindow(QTranslator *_translator, QWidget *parent)
connect(client, SIGNAL(protocolError()), messageLog, SLOT(logProtocolError()));
connect(phasesToolbar, SIGNAL(signalSetPhase(int)), client, SLOT(setActivePhase(int)));
connect(phasesToolbar, SIGNAL(signalNextTurn()), client, SLOT(nextTurn()));
connect(phasesToolbar, SIGNAL(signalDrawCard()), client, SLOT(drawCard()));
createActions();
createMenus();

View file

@ -691,16 +691,16 @@ ReturnMessage::ReturnCode ServerSocket::cmdListZones(const QList<QVariant> &para
QStringList ServerSocket::dumpZoneHelper(ServerSocket *player, PlayerZone *zone, int number_cards)
{
QListIterator<Card *> card_iterator(zone->cards);
QStringList result;
for (int i = 0; card_iterator.hasNext() && (i < number_cards || number_cards == -1); i++) {
Card *tmp = card_iterator.next();
// XXX Face down cards
for (int i = 0; (i < zone->cards.size()) && (i < number_cards || number_cards == -1); i++) {
Card *tmp = zone->cards[i];
QString displayedName = tmp->getFaceDown() ? QString() : tmp->getName();
if (zone->getType() != PlayerZone::HiddenZone)
result << QString("%1|%2|%3|%4|%5|%6|%7|%8|%9|%10").arg(player->getPlayerId())
.arg(zone->getName())
.arg(tmp->getId())
.arg(tmp->getName())
.arg(displayedName)
.arg(tmp->getX())
.arg(tmp->getY())
.arg(tmp->getCounters())
@ -709,7 +709,7 @@ QStringList ServerSocket::dumpZoneHelper(ServerSocket *player, PlayerZone *zone,
.arg(tmp->getAnnotation());
else {
zone->setCardsBeingLookedAt(number_cards);
result << QString("%1|%2|%3|%4||||||").arg(player->getPlayerId()).arg(zone->getName()).arg(i).arg(tmp->getName());
result << QString("%1|%2|%3|%4||||||").arg(player->getPlayerId()).arg(zone->getName()).arg(i).arg(displayedName);
}
}
return result;