Remove a redundant var
Reusing a var instead of making 2 vars
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 10.0.1, 2023-06-12T17:27:48. -->
|
||||
<!-- Written by QtCreator 10.0.1, 2023-06-15T15:25:40. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -94,7 +94,6 @@ playWindow::playWindow(QWidget *parent) : QMainWindow(parent),
|
||||
connect(ui->playagainButton, &QPushButton::clicked, this, [=]{reset();});
|
||||
|
||||
turnCount = 0;
|
||||
computerTurnCount = 0;
|
||||
player_wins = 0;
|
||||
computer_wins = 0;
|
||||
}
|
||||
@@ -143,6 +142,7 @@ void playWindow::computerTurn(void)
|
||||
QPixmap lose(":/images/lose.png");
|
||||
QPixmap draw(":/images/draw.png");
|
||||
|
||||
turnCount = 0;
|
||||
while (dealer->getHandValue() < 16){
|
||||
dealer->addCard(deck->drawCard());
|
||||
QPixmap img = QPixmap(":/images/cards/" + cardToImg[dealer->getLastCard()] + ".png");
|
||||
@@ -150,9 +150,9 @@ void playWindow::computerTurn(void)
|
||||
|
||||
ui->computerScoreLabel->setText("Computer: " + QString::number(dealer->getHandValue()));
|
||||
|
||||
countToDealerLabel[computerTurnCount]->setPixmap(img);
|
||||
countToDealerLabel[turnCount]->setPixmap(img);
|
||||
|
||||
computerTurnCount++;
|
||||
turnCount++;
|
||||
}
|
||||
|
||||
//if computer is bust
|
||||
@@ -189,7 +189,6 @@ void playWindow::reset(void)
|
||||
|
||||
//Clear Labels and Variables
|
||||
turnCount = 0;
|
||||
computerTurnCount = 0;
|
||||
|
||||
ui->playertotalLabel->setText("Total: " + QString::number(0));
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ private:
|
||||
std::unique_ptr<Player> dealer;
|
||||
std::unique_ptr<Player> player;
|
||||
uint8_t turnCount;
|
||||
uint8_t computerTurnCount;
|
||||
int player_wins;
|
||||
int computer_wins;
|
||||
};
|
||||
|
||||
@@ -192,7 +192,7 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="palette">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
@@ -814,6 +814,9 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
@@ -851,6 +854,9 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
|
||||
Reference in New Issue
Block a user