- Fixed: check for bad sidedefs was not taking into account unused ones.

# Conflicts:
#	src/p_setup.cpp
This commit is contained in:
drfrag 2020-06-12 17:06:33 +02:00
parent fded4b3fdc
commit 19183ba157

View file

@ -1715,6 +1715,7 @@ void P_LoadLineDefs (MapData * map)
auto mldf = map->Read(ML_LINEDEFS); auto mldf = map->Read(ML_LINEDEFS);
int numlines = mldf.Size() / sizeof(maplinedef_t); int numlines = mldf.Size() / sizeof(maplinedef_t);
int numsides = map->Size(ML_SIDEDEFS) / sizeof(mapsidedef_t);
linemap.Resize(numlines); linemap.Resize(numlines);
// [RH] Count the number of sidedef references. This is the number of // [RH] Count the number of sidedef references. This is the number of
@ -1783,7 +1784,7 @@ void P_LoadLineDefs (MapData * map)
// cph 2006/09/30 - fix sidedef errors right away. // cph 2006/09/30 - fix sidedef errors right away.
for (int j=0; j < 2; j++) for (int j=0; j < 2; j++)
{ {
if (LittleShort(mld->sidenum[j]) != NO_INDEX && mld->sidenum[j] >= level.sides.Size()) if (LittleShort(mld->sidenum[j]) != NO_INDEX && mld->sidenum[j] >= numsides)
{ {
mld->sidenum[j] = 0; // dummy sidedef mld->sidenum[j] = 0; // dummy sidedef
Printf("Linedef %d has a bad sidedef\n", i); Printf("Linedef %d has a bad sidedef\n", i);