[Scummvm-git-logs] scummvm master -> 1abc5ecfc81da675370f646a17f48119d146b9f7
dreammaster
noreply at scummvm.org
Wed Oct 1 11:35:40 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
1abc5ecfc8 BAGEL: MINIGAMES: Fix Poker Coverity warnings
Commit: 1abc5ecfc81da675370f646a17f48119d146b9f7
https://github.com/scummvm/scummvm/commit/1abc5ecfc81da675370f646a17f48119d146b9f7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-01T04:35:31-07:00
Commit Message:
BAGEL: MINIGAMES: Fix Poker Coverity warnings
Changed paths:
engines/bagel/hodjnpodj/poker/amtdlg.cpp
engines/bagel/hodjnpodj/poker/c1btndlg.h
engines/bagel/hodjnpodj/poker/poker.cpp
diff --git a/engines/bagel/hodjnpodj/poker/amtdlg.cpp b/engines/bagel/hodjnpodj/poker/amtdlg.cpp
index 14dfdaa1089..0796d183886 100644
--- a/engines/bagel/hodjnpodj/poker/amtdlg.cpp
+++ b/engines/bagel/hodjnpodj/poker/amtdlg.cpp
@@ -296,17 +296,11 @@ void CSetAmountDlg::OnPaint() {
break;
}
- pSetAmountSB = new CScrollBar;
pSetAmountSB = (CScrollBar *)GetDlgItem(IDC_SETAMT_BAR);
pSetAmountSB->SetScrollRange(AMOUNTMIN, AMOUNTMAX, true);
pSetAmountSB->SetScrollPos(nScrollPos, true);
- if (pSetAmountSB != nullptr) {
- pSetAmountSB = nullptr;
- }
-
ReleaseDC(pDC);
- return;
}
/*****************************************************************
diff --git a/engines/bagel/hodjnpodj/poker/c1btndlg.h b/engines/bagel/hodjnpodj/poker/c1btndlg.h
index 87bc9396f67..b3c62869ebe 100644
--- a/engines/bagel/hodjnpodj/poker/c1btndlg.h
+++ b/engines/bagel/hodjnpodj/poker/c1btndlg.h
@@ -64,14 +64,14 @@ protected:
DECLARE_MESSAGE_MAP()
private:
- CText *m_cTextMessage1;
- CText *m_cTextMessage2;
- CText *m_cTextMessage3;
- const char *m_pszMessage1;
- const char *m_pszMessage2;
- const char *m_pszMessage3;
- const char *m_pszButton1Text;
- CColorButton *m_pButton1;
+ CText *m_cTextMessage1 = nullptr;
+ CText *m_cTextMessage2 = nullptr;
+ CText *m_cTextMessage3 = nullptr;
+ const char *m_pszMessage1 = nullptr;
+ const char *m_pszMessage2 = nullptr;
+ const char *m_pszMessage3 = nullptr;
+ const char *m_pszButton1Text = nullptr;
+ CColorButton *m_pButton1 = nullptr;
};
} // namespace Poker
diff --git a/engines/bagel/hodjnpodj/poker/poker.cpp b/engines/bagel/hodjnpodj/poker/poker.cpp
index 8802cd5c1ab..89d63569b1a 100644
--- a/engines/bagel/hodjnpodj/poker/poker.cpp
+++ b/engines/bagel/hodjnpodj/poker/poker.cpp
@@ -1171,8 +1171,9 @@ void CMainPokerWindow::OnLButtonDown(unsigned int nFlags, CPoint point) {
Sleep(BOOM_SLEEP);
i++;
}
- if (pSprite != nullptr)
- delete pSprite;
+
+ delete pSprite;
+
} else if (rPencil.PtInRect(point) && m_lpGameStruct->bSoundEffectsEnabled) {
CSound::waitWaveSounds();
sndPlaySound(nullptr, 0);
@@ -1399,13 +1400,10 @@ void CMainPokerWindow::CheckWinningHand() {
//when looking for a pair, two pair, .. four of a kind
int nIndex, nLoop; // looping variables
int nCard = 0; // card in a pair, used to tell if a pair is Jacks or higher
- CRect *pPotRect; // a pointer to the rect of screen coordinates
+ CRect potRect; // a rect of screen coordinates
// that contain the pot and user amounts
CUserWonDlg dlgWon((CWnd *)this, pGamePalette);
-
- pPotRect = new CRect;
-
// find out what cards are currently shown
for (nLoop = 0; nLoop < 5; nLoop++) {
anShownCards[nLoop] = 0;
@@ -1448,9 +1446,8 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1472,9 +1469,8 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1512,9 +1508,8 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1534,9 +1529,8 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1556,13 +1550,14 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
- } else
+ } else {
m_lUserAmount += m_lUserBet * m_nPayOffThreeofaKind;
+ }
+
return;
}
if (nPairMatch == 2) {
@@ -1578,9 +1573,9 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
+
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1609,9 +1604,9 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
+
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1637,9 +1632,9 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
+
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1664,9 +1659,9 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
+
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1708,9 +1703,9 @@ void CMainPokerWindow::CheckWinningHand() {
// Check for overflow, if so then the user broken the bank, reset to zero
if (m_lUserAmount > m_lUserAmount + m_lUserBet * m_nPayOffRoyalFlush) {
m_lUserAmount = 2147483647;
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
+
MessageBox("Congratulations! You just broke the bank", "YOU WIN!", MB_OK);
m_lUserAmount = 0L;
} else
@@ -1724,7 +1719,7 @@ void CMainPokerWindow::CheckWinningHand() {
dlgWon.DoModal();
sndPlaySound(nullptr, 0);
- delete pPotRect;
+
return;
}
@@ -1755,11 +1750,9 @@ void CMainPokerWindow::CheckWinningHand() {
*
****************************************************************/
void CMainPokerWindow::SetBet(long lBet) {
- CRect *pPotRect; // a pointer to the rect of screen coordinates
+ CRect potRect; // a pointer to the rect of screen coordinates
// that contain the pot and user amounts
- pPotRect = new CRect;
-
// if lBet = 0, then reset the bet to zero
if (lBet == 0) {
m_lUserBet = 0;
@@ -1787,9 +1780,9 @@ void CMainPokerWindow::SetBet(long lBet) {
}
// redraw the pot and user amounts
- pPotRect->SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
- InvalidateRect(pPotRect, true);
- delete pPotRect;
+ potRect.SetRect(POT_AMOUNT_X, POT_AMOUNT_Y, POT_AMOUNT_X + 137, POT_AMOUNT_Y + 101);
+ InvalidateRect(&potRect, true);
+
// adjust the bet buttons
EnableBets();
@@ -2374,10 +2367,9 @@ void PlayEasterEgg(CDC *pDC, CWnd *pWnd, CPalette *pPalette,
(*pSprite).PaintSprite(pDC, nXLoc, nYLoc);
Sleep(nSleep);
}
- if (pSprite != nullptr)
- delete pSprite;
-} // end PlayEasterEgg
+ delete pSprite;
+}
} // namespace Poker
} // namespace HodjNPodj
More information about the Scummvm-git-logs
mailing list