mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Unconcede (#3515)
This commit is contained in:
parent
0dcf97d29d
commit
7cd9b9c0c8
13 changed files with 82 additions and 7 deletions
|
|
@ -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()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue