Merge branch 'fix-searchblockmap' into 'next'

Fix Lua 'searchBlockmap' (resolves #1191)

Closes #1191

See merge request STJr/SRB2!2309
This commit is contained in:
sphere 2024-02-13 15:32:41 +00:00
commit eaab39bbaf
2 changed files with 5 additions and 12 deletions

View file

@ -312,17 +312,12 @@ static int lib_searchBlockmap(lua_State *L)
continue; // our thing just found itself, so move on
funcret = lib_searchBlockmap_Objects(L, mobj, itmobj);
if (funcret == 2) {
lua_pushboolean(L, false);
return 1;
}
else if (funcret == 1)
retval = false;
if (P_MobjWasRemoved(mobj)) {
if (funcret == 2 || P_MobjWasRemoved(mobj)) {
retval = false;
break;
}
else if (funcret == 1)
retval = false;
}
}
while (itmobj != NULL);

View file

@ -1095,8 +1095,6 @@ bthingit_t *P_NewBlockThingsIterator(int x1, int y1, int x2, int y2)
return NULL;
block = GetBlockmapBlock(x1, y1);
if (!block)
return NULL;
if (freeiters != NULL)
{
@ -1188,12 +1186,12 @@ mobj_t *P_BlockThingsIteratorNext(bthingit_t *it, boolean centeronly)
if (!it->dynhash)
{
it->dynhashcapacity = 50;
Z_Calloc(it->dynhashcapacity * sizeof(it->dynhashcapacity), PU_LEVEL, &it->dynhash);
Z_Calloc(it->dynhashcapacity * sizeof(*it->dynhash), PU_LEVEL, &it->dynhash);
}
if (it->dynhashcount == it->dynhashcapacity)
{
it->dynhashcapacity *= 2;
it->dynhash = Z_Realloc(it->dynhash, it->dynhashcapacity * sizeof(it->dynhashcapacity), PU_LEVEL, &it->dynhash);
it->dynhash = Z_Realloc(it->dynhash, it->dynhashcapacity * sizeof(*it->dynhash), PU_LEVEL, &it->dynhash);
}
i = (int)it->dynhashcount;
it->dynhashcount++;