Print debugging message if sector->linecount is zero

This commit is contained in:
Monster Iestyn 2016-06-11 16:14:08 +01:00
parent 742353d0ab
commit df92dc8d9e

View file

@ -1930,12 +1930,20 @@ static void P_GroupLines(void)
// allocate linebuffers for each sector // allocate linebuffers for each sector
for (i = 0, sector = sectors; i < numsectors; i++, sector++) for (i = 0, sector = sectors; i < numsectors; i++, sector++)
{
if (sector->linecount == 0) // no lines found?
{
sector->lines = NULL;
CONS_Debug(DBG_SETUP, "P_GroupLines: sector %d has no lines\n", i);
}
else
{ {
sector->lines = Z_Calloc(sector->linecount * sizeof(line_t*), PU_LEVEL, NULL); sector->lines = Z_Calloc(sector->linecount * sizeof(line_t*), PU_LEVEL, NULL);
// zero the count, since we'll later use this to track how many we've recorded // zero the count, since we'll later use this to track how many we've recorded
sector->linecount = 0; sector->linecount = 0;
} }
}
// iterate through lines, assigning them to sectors' linebuffers, // iterate through lines, assigning them to sectors' linebuffers,
// and recalculate the counts in the process // and recalculate the counts in the process
@ -1952,12 +1960,15 @@ static void P_GroupLines(void)
{ {
M_ClearBox(bbox); M_ClearBox(bbox);
if (sector->linecount != 0)
{
for (j = 0; j < sector->linecount; j++) for (j = 0; j < sector->linecount; j++)
{ {
li = sector->lines[j]; li = sector->lines[j];
M_AddToBox(bbox, li->v1->x, li->v1->y); M_AddToBox(bbox, li->v1->x, li->v1->y);
M_AddToBox(bbox, li->v2->x, li->v2->y); M_AddToBox(bbox, li->v2->x, li->v2->y);
} }
}
// set the degenmobj_t to the middle of the bounding box // set the degenmobj_t to the middle of the bounding box
sector->soundorg.x = (((bbox[BOXRIGHT]>>FRACBITS) + (bbox[BOXLEFT]>>FRACBITS))/2)<<FRACBITS; sector->soundorg.x = (((bbox[BOXRIGHT]>>FRACBITS) + (bbox[BOXLEFT]>>FRACBITS))/2)<<FRACBITS;