[Scummvm-git-logs] scummvm master -> c5e29570d2b22bcea8ecfb2a5d6622ea869ae901

dreammaster noreply at scummvm.org
Wed Oct 1 10:48:56 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:
c5e29570d2 BAGEL: MINIGAMES: Fix Mankala Coverity warnings


Commit: c5e29570d2b22bcea8ecfb2a5d6622ea869ae901
    https://github.com/scummvm/scummvm/commit/c5e29570d2b22bcea8ecfb2a5d6622ea869ae901
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-01T03:48:50-07:00

Commit Message:
BAGEL: MINIGAMES: Fix Mankala Coverity warnings

Changed paths:
    engines/bagel/hodjnpodj/mankala/mnklog.cpp
    engines/bagel/hodjnpodj/mankala/mnkopt.h


diff --git a/engines/bagel/hodjnpodj/mankala/mnklog.cpp b/engines/bagel/hodjnpodj/mankala/mnklog.cpp
index abc4f295b71..22955a599d2 100644
--- a/engines/bagel/hodjnpodj/mankala/mnklog.cpp
+++ b/engines/bagel/hodjnpodj/mankala/mnklog.cpp
@@ -485,12 +485,12 @@ bool CMnk::WriteTableFile() {
 	if (ws) {
 		Common::Serializer s(nullptr, ws);
 		m_lpCMnkData->m_cFileHeader.sync(s);
+		ws->finalize();
 	} else {
 		// Can't create file
 		iError = 100;
 	}
 
-	ws->finalize();
 	delete ws;
 
 	JXELEAVE(CMnk::WriteTableFile) ;
@@ -865,12 +865,8 @@ bool CMnk::Minimax(CMove * xpcMove, int iDepth)
 					iValue += (cMove.m_iNumStones[cMove.m_iPlayer][iP + 2]
 					           - cMove.m_iNumStones
 					           [OTHERPLAYER(cMove.m_iPlayer)][iP + 2]) / 2 ;
-				bDone = true ;
 			}
 
-//      if (!bDone)
-//      StaticEvaluation(&cMove) ;  // do static analysis
-
 			iValue += cMove.m_iNumStones[cMove.m_iPlayer][HOMEINDEX + 2]
 			          - cMove.m_iNumStones[OTHERPLAYER(cMove.m_iPlayer)]
 			          [HOMEINDEX + 2] ;
@@ -1575,8 +1571,9 @@ int CMnk::ExtendedStaticEvaluation(MOVE *pMove, MOVE *pParentMove,  signed char
 
 			for (j = iStopPit; j < iPit; j++, pMove->iNumRocks[j]++);        //executed only if StopPit<jPit i.e. if NoWrapAround.
 
-			if (bWrapsAroundBehind) for (j = iStopPit; j < NUMPITS; j++, pMove->iNumRocks[j]++) ;
-
+			if (bWrapsAroundBehind)
+				for (j = iStopPit; j < NUMPITS; j++, pMove->iNumRocks[j]++) {
+				}
 
 			iNextID = ((iPit == (NUMPITS - 1)) && !iFreeTurn) ? -1 : (pMove->cMoveID + 1);  //returns the Next ID.
 			if (iNextID == -1) return -1;
@@ -1590,64 +1587,6 @@ int CMnk::ExtendedStaticEvaluation(MOVE *pMove, MOVE *pParentMove,  signed char
 
 	RETURN(iError != 0) ;
 }
-/*
-
-#define FREE    (0x01<<4)
-#define CAPTURE (0x02<<4)
-#define THREAT  (0x03<<4)
-#define NEITHER (0x00<<4)
-#define F FREE
-#define C   CAPTURE
-#define T   THREAT
-#define N   NEITHER
-#define MAKEWORD(L, H)          ((L)||(H<<8))
-#define CreateMoveChainWord(Gain, Flag, Pit)    (MAKEWORD((Flag) ||(Pit), Gain))
-
-uint16 Type(byte pit, CONFIG* pStoneCfg){
-
-//returns F/C/T/N in the lowbyte    and the amount of gain/save in the high byte.
-}
-
-bool CMnk::LookAheadEvaluation(CONFIG* pStoneConfig, int iPlayer,   uint16* pwMoveChain){
-    static bool bLocked;
-    byte Pit;
-
-    for(Pit=0; Pit<NUMPITS; Pit++){
-        switch(LOBYTE(u=Type(iPit, pStoneConfig))){
-            case FREE:
-                _wordstrcat(pwMoveChain,CreateMoveChainWord(0x01,F, Pit));
-                LookAheadEvaluation(pStoneConfig, iPlayer, pwMoveChain);
-                break;
-            case CAPTURE:
-                _wordstrcat(pwMoveChain,CreateMoveChainWord(HIBYTE(u),C, Pit));
-                len= _wordstrlen(pwMoveChain);
-                bLocked[m_iChainID++]=true;
-                ptmpMoveChain=pwMoveChain;
-                pwMoveChain=m_pwMoveChainList[m_iChainID];
-                _wordstrcpy(pwMoveChain, StepBackwards(ptmpMoveChain));
-                LookAheadEvaluation(pStoneConfig,iPlayer, pwMoveChain);
-                break;
-            default:
-            case NEITHER:
-                break;
-        }
-    }
-}
-
-
-*/
-
-
-
-
-
-
-
-
-
-
-
-
 
 //* CMnk::CountStones -- count total stones in configuration
 bool CMnk::CountStones(CMove * xpcMove)
diff --git a/engines/bagel/hodjnpodj/mankala/mnkopt.h b/engines/bagel/hodjnpodj/mankala/mnkopt.h
index a9f49305181..9b0a3b27a64 100644
--- a/engines/bagel/hodjnpodj/mankala/mnkopt.h
+++ b/engines/bagel/hodjnpodj/mankala/mnkopt.h
@@ -86,16 +86,16 @@ public:
 	        CPalette *xpPalette = nullptr, unsigned int nID = IDD_MNK_USER) ;
 	~CMnkUsr();     // destructor
 
-	CPalette *m_xpGamePalette ;
+	CPalette *m_xpGamePalette = nullptr;
 
-	CScrollBar *m_xpUScrShell, *m_xpUScrStrength ;
+	CScrollBar *m_xpUScrShell = nullptr, *m_xpUScrStrength = nullptr;
 	void UpdateScrollbars();
 
 // Dialog Data
 	//{{AFX_DATA(CMnkUsr)
 	enum { IDD = IDD_MNK_USER };
-	int     m_iUShells;
-	int     m_iUStrength;
+	int     m_iUShells = 0;
+	int     m_iUStrength = 0;
 	CString mLevelTable [NUM_LEVELS];
 	//}}AFX_DATA
 




More information about the Scummvm-git-logs mailing list