Fix bhit/mbhit hitting destroyed objects

A monster zapped a wand of striking, hitting a burning potion
of oil, which destroyed items in the same square, and the ray was
checking destroyed item.  Similar thing with a ray done by hero.

The code currently stops checking the objects in the location
if a next object in the chain was destroyed - an improvement
would be to gather all the objects into an array and iterate
over that instead of relying on the nexthere pointer.
This commit is contained in:
Pasi Kallinen
2024-05-07 16:04:56 +03:00
parent f5cde4cfd6
commit a6c5d967d2
2 changed files with 29 additions and 14 deletions

View File

@@ -2426,6 +2426,8 @@ bhitpile(
continue;
}
}
if (otmp->where != OBJ_FLOOR || otmp->ox != tx || otmp->oy != ty)
continue;
hitanything += (*fhito)(otmp, obj);
}