mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +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 *pPoly;
|
||||||
markPoly_t *pNextPoly;
|
markPoly_t *pNextPoly;
|
||||||
|
|
||||||
|
assert(pMark != &cg_activeMarkObjs);
|
||||||
|
|
||||||
for (pPoly = pMark->markPolys; pPoly; pPoly = pNextPoly) {
|
for (pPoly = pMark->markPolys; pPoly; pPoly = pNextPoly) {
|
||||||
pNextPoly = pPoly->nextPoly;
|
pNextPoly = pPoly->nextPoly;
|
||||||
CG_FreeMarkPoly(pPoly);
|
CG_FreeMarkPoly(pPoly);
|
||||||
|
@ -489,6 +491,12 @@ markObj_t *CG_AllocMark(int iNumPolys)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iNumPolys > cg_iNumMarkPolys) {
|
||||||
|
// Added in OPM
|
||||||
|
// Make sure to not over allocate polys
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (cg_iNumFreeMarkObjs <= cg_iMinFreeMarkObjs) {
|
if (cg_iNumFreeMarkObjs <= cg_iMinFreeMarkObjs) {
|
||||||
CG_FreeBestMarkObj(1);
|
CG_FreeBestMarkObj(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue