mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 13:47:58 +03:00
Don't allocate the mark if the number of allocated polys is insufficient
There was a very rare occurrence where it would hang trying to find a free mark poly, when the number of specified polys was more than the number of allocated polys. This bug also occurs in the original game
This commit is contained in:
parent
5edee7d12e
commit
7bcb91bbb5
1 changed files with 8 additions and 0 deletions
|
@ -425,6 +425,8 @@ void CG_FreeMarkObj(markObj_t *pMark)
|
|||
markPoly_t *pPoly;
|
||||
markPoly_t *pNextPoly;
|
||||
|
||||
assert(pMark != &cg_activeMarkObjs);
|
||||
|
||||
for (pPoly = pMark->markPolys; pPoly; pPoly = pNextPoly) {
|
||||
pNextPoly = pPoly->nextPoly;
|
||||
CG_FreeMarkPoly(pPoly);
|
||||
|
@ -489,6 +491,12 @@ markObj_t *CG_AllocMark(int iNumPolys)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (iNumPolys > cg_iNumMarkPolys) {
|
||||
// Added in OPM
|
||||
// Make sure to not over allocate polys
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cg_iNumFreeMarkObjs <= cg_iMinFreeMarkObjs) {
|
||||
CG_FreeBestMarkObj(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue