This commit is contained in:
Rob Blanckaert 2019-01-27 09:50:41 -08:00 committed by Zach H
parent 0dcf97d29d
commit 7cd9b9c0c8
13 changed files with 82 additions and 7 deletions

View file

@ -620,11 +620,23 @@ void TabGame::actGameInfo()
void TabGame::actConcede()
{
if (QMessageBox::question(this, tr("Concede"), tr("Are you sure you want to concede this game?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
Player *player = players.value(localPlayerId, nullptr);
if (player == nullptr)
return;
if (!player->getConceded()) {
if (QMessageBox::question(this, tr("Concede"), tr("Are you sure you want to concede this game?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
return;
sendGameCommand(Command_Concede());
sendGameCommand(Command_Concede());
} else {
if (QMessageBox::question(this, tr("Unconcede"),
tr("You have already conceded. Do you want to return to this game?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
return;
sendGameCommand(Command_Unconcede());
}
}
void TabGame::actLeaveGame()
@ -1051,6 +1063,16 @@ void TabGame::eventPlayerPropertiesChanged(const Event_PlayerPropertiesChanged &
break;
}
case GameEventContext::UNCONCEDE: {
messageLog->logUnconcede(player);
player->setConceded(false);
QMapIterator<int, Player *> playerIterator(players);
while (playerIterator.hasNext())
playerIterator.next().value()->updateZones();
break;
}
case GameEventContext::DECK_SELECT: {
Context_DeckSelect deckSelect = context.GetExtension(Context_DeckSelect::ext);
messageLog->logDeckSelect(player, QString::fromStdString(deckSelect.deck_hash()),