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
1 changed files with 18 additions and 7 deletions

View File

@ -1931,10 +1931,18 @@ 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++)
{ {
sector->lines = Z_Calloc(sector->linecount * sizeof(line_t*), PU_LEVEL, NULL); 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);
// 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,
@ -1952,11 +1960,14 @@ static void P_GroupLines(void)
{ {
M_ClearBox(bbox); M_ClearBox(bbox);
for (j = 0; j < sector->linecount; j++) if (sector->linecount != 0)
{ {
li = sector->lines[j]; for (j = 0; j < sector->linecount; j++)
M_AddToBox(bbox, li->v1->x, li->v1->y); {
M_AddToBox(bbox, li->v2->x, li->v2->y); li = sector->lines[j];
M_AddToBox(bbox, li->v1->x, li->v1->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