[Scummvm-git-logs] scummvm master -> 1fb65614e0f03fb6964f5937e432968dd4c8e3eb
dreammaster
noreply at scummvm.org
Fri Oct 3 10:23:19 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:
1fb65614e0 BAGEL: MINIGAMES: Fix Mankala Coverity warning
Commit: 1fb65614e0f03fb6964f5937e432968dd4c8e3eb
https://github.com/scummvm/scummvm/commit/1fb65614e0f03fb6964f5937e432968dd4c8e3eb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-03T03:22:53-07:00
Commit Message:
BAGEL: MINIGAMES: Fix Mankala Coverity warning
The ExtendedStaticEvaluation method had a truly bizzare code,
with a recursive call to itself passing a dereferenced pointer
to a function parameter + 4. Thankfully, it turns out the
entire method was unused, so it could be completely removed.
Changed paths:
engines/bagel/hodjnpodj/mankala/mnk.h
engines/bagel/hodjnpodj/mankala/mnklog.cpp
diff --git a/engines/bagel/hodjnpodj/mankala/mnk.h b/engines/bagel/hodjnpodj/mankala/mnk.h
index 14e71006682..7559bfe1062 100644
--- a/engines/bagel/hodjnpodj/mankala/mnk.h
+++ b/engines/bagel/hodjnpodj/mankala/mnk.h
@@ -322,7 +322,6 @@ private: bool SetBestWinCount(CMove * xpcMove) ;
bool DefensiveStaticEvaluation(CMove*);
bool TreeAlgo(CMove*);
- int ExtendedStaticEvaluation(MOVE*, MOVE*, signed char, int);
} ; // CMnk
diff --git a/engines/bagel/hodjnpodj/mankala/mnklog.cpp b/engines/bagel/hodjnpodj/mankala/mnklog.cpp
index 22955a599d2..cbb3a435689 100644
--- a/engines/bagel/hodjnpodj/mankala/mnklog.cpp
+++ b/engines/bagel/hodjnpodj/mankala/mnklog.cpp
@@ -1477,117 +1477,6 @@ bool CMnk::TreeAlgo(CMove *xpcMove) {
return true;
}
-
-int CMnk::ExtendedStaticEvaluation(MOVE *pMove, MOVE *pParentMove, signed char cID, int iPlayer) {
- bool bWrapsAroundOnTop,
- bWrapsAroundBehind;
-// bWrapsAroundAhead;
-
- int iError = 0, // error code
- iNumMoves = 0, // number of legal moves
- iNumStones, // number of stones in pit
- iPit; // loop variable
- //int iMaxValue = BESTWINUNDEF ; // computing maximum value
-
- int iFreeTurn = 0,
- iCapture,
- iNextID,
- j,
- iStopPit = 0;
-
-
- /*initialize*/
- pMove->iParentID = pParentMove->iMoveID;
- pMove->iMoveID = cID;
-
-
- for (iPit = 0 ; iPit < NUMPITS ; ++iPit) {
-
- if ((iNumStones = pMove->iNumRocks[iPit])) // if there are stones in current pit,
- ++iNumMoves; // ...(iNumStones being the #of stones in the current pit),
- // ... it's a legal move
-
- /* If this pit yields a free turn ...*/
- if ((iNumStones && (iNumStones % (2 * NUMPITS + 1) == (iPit + 1)))) {
- iFreeTurn = iNumStones;
- pMove->iFree[iPit][pMove->cRecursion] = iNumStones;
- pMove->iRocksInHomeBin = pParentMove->iRocksInHomeBin + 1;
- pMove->iPitSequence[pMove->cRecursion] = iPit;
- pMove->iNumRocks[iPit] = 0;
-
- for (j = 0; j < iPit; j++, pMove->iNumRocks[j]++);
-
- pMove->cRecursion++;
- ExtendedStaticEvaluation(*(&pMove + 4), pMove, cID, iPlayer);
- break;
- }
-
- //bWrapsAroundAhead = iNumStones > (2 * NUMPITS + 1);
- bWrapsAroundOnTop = iNumStones == (2 * NUMPITS + 1);
- bWrapsAroundBehind = (iNumStones < (2 * NUMPITS + 1)) && (iNumStones > (iPit + NUMPITS));
-
-
- /*
- if you have (2*NUMPITS+1)(=13) pebbles in a pit, 'a' of yours, you are definitely capturing a pebble
- on the pit 'b' EXACTLY opposite 'a';
- a and b are related by the expression
- a+b=(NUMPITS-1), in regular logic, OR by:
- a+b=(NUMPITS-1)+4, when a and b, (both) are INDEXES into the m_iNumStones array, as in the case below.
- */
- if (bWrapsAroundOnTop) {
- iCapture = pMove->iNumRocks[NUMPITS + 3 - iPit] ;
- } else {
- /*
- you have captured pebbles from the other player's
- pit# (NUMPITS+1-(iPit-iNumStones+2)),
- but REMEMBER to add 2 to this before indexing
- */
- if (iNumStones && (iNumStones <= iPit) && !(pMove->iNumRocks[iPit - iNumStones])) {
- iStopPit = iPit - iNumStones;
- iCapture = pMove->iNumRocksOpposite[iStopPit];
- } else {
- /*
- if you wrap around and end up with a vacant pit
- to the left of where you started from, you have hauled
- a capture of the number of stones in the other player's
- pit# (NUMPITS+1-(2*NUMPITS+3+iPit-iNumStones))
- */
- if (bWrapsAroundBehind && !(pMove->iNumRocks[2 * NUMPITS + 1 + iPit - iNumStones])) {
- iStopPit = 2 * NUMPITS + 1 + iPit - iNumStones;
- iCapture = pMove->iNumRocksOpposite[iNumStones - NUMPITS - iPit - 4];
- } else {
- iCapture = 0; //no capture otherwise.
- }
- }//end else, if (iNumStones && ...)
- } //end else, if (NumStones==...)
-
- if (iCapture) {
- pMove->iCapture[iPit][pMove->cRecursion] = iCapture;
- pMove->iRocksInHomeBin = pParentMove->iRocksInHomeBin + iCapture;
-
- memcpy(&(pMove->iPitSequence[0]), &(pParentMove->iPitSequence[0]), pMove->cRecursion * sizeof(int));
- pMove->iPitSequence[pMove->cRecursion] = iPit;
- pMove->iNumRocks[iPit] = 0;
-
- 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]++) {
- }
-
- iNextID = ((iPit == (NUMPITS - 1)) && !iFreeTurn) ? -1 : (pMove->cMoveID + 1); //returns the Next ID.
- if (iNextID == -1) return -1;
-
- }
-
-
- }//end -for (iPit)
-
- (void)iNumMoves;
-
- RETURN(iError != 0) ;
-}
-
//* CMnk::CountStones -- count total stones in configuration
bool CMnk::CountStones(CMove * xpcMove)
// xpcMove -- CMove object containing the configuration
More information about the Scummvm-git-logs
mailing list