Minor cleanup for updatesectorbreadth()

git-svn-id: https://svn.eduke32.com/eduke32@7479 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-04-06 06:37:46 +00:00 committed by Christoph Oelckers
parent 631863ab67
commit 8c6ddcc137

View file

@ -11021,30 +11021,28 @@ void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum)
void updatesectorbreadth(int32_t const x, int32_t const y, int16_t * const sectnum) void updatesectorbreadth(int32_t const x, int32_t const y, int16_t * const sectnum)
{ {
if ((unsigned)*sectnum >= (unsigned)numsectors)
return;
static int16_t sectlist[MAXSECTORS]; static int16_t sectlist[MAXSECTORS];
static uint8_t sectbitmap[MAXSECTORS>>3]; static uint8_t sectbitmap[MAXSECTORS>>3];
int32_t nsecs, sectcnt, j; int32_t nsecs;
if ((unsigned)(*sectnum) >= (unsigned)numsectors)
return;
bfirst_search_init(sectlist, sectbitmap, &nsecs, numsectors, *sectnum); bfirst_search_init(sectlist, sectbitmap, &nsecs, numsectors, *sectnum);
for (sectcnt=0; sectcnt<nsecs; sectcnt++) for (int sectcnt=0; sectcnt<nsecs; sectcnt++)
{ {
if (inside_p(x, y, sectlist[sectcnt])) if (inside_p(x, y, sectlist[sectcnt]))
SET_AND_RETURN(*sectnum, sectlist[sectcnt]); SET_AND_RETURN(*sectnum, sectlist[sectcnt]);
{ auto const sec = &sector[sectlist[sectcnt]];
const sectortype *sec = &sector[sectlist[sectcnt]]; int const startwall = sec->wallptr;
int32_t startwall = sec->wallptr; int const endwall = sec->wallptr + sec->wallnum;
int32_t endwall = sec->wallptr + sec->wallnum;
for (j=startwall; j<endwall; j++) for (int j=startwall; j<endwall; j++)
if (wall[j].nextsector >= 0) if (wall[j].nextsector >= 0)
bfirst_search_try(sectlist, sectbitmap, &nsecs, wall[j].nextsector); bfirst_search_try(sectlist, sectbitmap, &nsecs, wall[j].nextsector);
} }
}
*sectnum = -1; *sectnum = -1;
} }