Skip to content

Commit 0fdca87

Browse files
committed
Cards are now shown face up after a deal
1 parent 61d7d21 commit 0fdca87

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

TODO

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
layout cachés
2-
afficher les mains après la donne
31
fenêtre quoi faire après la donne
42
fenêtre score
53
partir prochaine donne

src/gui/CardLayout.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void CardLayout::setGeometry(const QRect &r)
5858
Position playerPosition = player->getPosition();
5959
Contract contract = playWindow->getGame()->getContract();
6060
Position dummyPosition = contract.getIsSet() ? nextTeammate(contract.getDeclarer()) : North;
61-
bool showCardsFaceUp = player->getIsHuman() || (contract.getIsSet() && player->getPosition() == dummyPosition);
61+
bool showCardsFaceUp = player->getIsHuman() || (contract.getIsSet() && player->getPosition() == dummyPosition) || playWindow->getGame()->getPlayedCardsHistory().size() == 52;
6262
int i = 0;
6363
int suitOrder[4] = {-1, -1, -1, -1}; // Suit-1 for index, gives order for that suit, -1 = none added yet
6464
int cardCountX[4] = {-1, -1, -1, -1}; // which "level" of card are we at horizontally, -1 = none added yet
@@ -178,7 +178,7 @@ QSize CardLayout::minimumSize() const
178178
int w=0, h=0;
179179
Position playerPosition = player->getPosition();
180180
Position dummyPosition = nextTeammate(playWindow->getGame()->getContract().getDeclarer());
181-
bool showCardsFaceUp = player->getIsHuman() || player->getPosition() == dummyPosition;
181+
bool showCardsFaceUp = player->getIsHuman() || player->getPosition() == dummyPosition || playWindow->getGame()->getPlayedCardsHistory().size() == 52;
182182
if(n)
183183
{
184184
if(showCardsFaceUp) switch(playerPosition)

src/gui/PlayWindow.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ void PlayWindow::playingProcess()
245245

246246
if(numberOfPlayedCards == 52)
247247
{
248+
Player **players = game->getPlayers();
249+
destroyAllHandWidgets();
250+
for(int i=0; i<4; i++)
251+
{
252+
for(auto &card : recreateHand(Position(i), game->getPlayedCardsHistory(), game->getContract())) players[i]->addCardToHand(card);
253+
players[i]->sortHand(game->getContract().getSuit());
254+
}
255+
createAllHandWidgets();
248256
/////////###########################################################################################
249257
return;
250258
}

0 commit comments

Comments
 (0)