Blood: fix OOB issue in aiPatrolSetMarker

This commit is contained in:
nukeykt 2021-07-26 14:31:36 +09:00 committed by Mitchell Richters
parent 1fde9f2173
commit 39547e2df5

View file

@ -6686,8 +6686,13 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
// another marker which belongs that node?
int breakChance = 0;
pCur = &sprite[pXSprite->target]; pPrev = &sprite[pXSprite->targetX];
pXCur = &xsprite[pCur->extra]; pXPrev = &xsprite[pPrev->extra];
pCur = &sprite[pXSprite->target];
pXCur = &xsprite[pCur->extra];
if (pXSprite->targetX >= 0)
{
pPrev = &sprite[pXSprite->targetX];
pXPrev = &xsprite[pPrev->extra];
}
prev = pCur->index;
bool node = markerIsNode(pXCur, false);
@ -6699,7 +6704,7 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
for (i = headspritestat[kStatPathMarker]; i != -1; i = nextspritestat[i]) {
if (sprite[i].index == pXSprite->target || !xspriRangeIsFine(sprite[i].extra)) continue;
else if (sprite[i].index == pPrev->index && node) {
else if (pXSprite->targetX >= 0 && sprite[i].index == pPrev->index && node) {
if (pXCur->data2 == pXPrev->data1)
continue;
}