mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 01:02:03 +00:00
- Don't crash when loading UDMF maps with invalid sidedef references.
SVN r3569 (trunk)
This commit is contained in:
parent
93694dadc1
commit
c1f3621a4c
1 changed files with 22 additions and 8 deletions
|
@ -1438,8 +1438,9 @@ public:
|
|||
numsides = sidecount;
|
||||
lines = new line_t[numlines];
|
||||
sides = new side_t[numsides];
|
||||
int line, side;
|
||||
|
||||
for(int line = 0, side = 0; line < numlines; line++)
|
||||
for(line = 0, side = 0; line < numlines; line++)
|
||||
{
|
||||
short tempalpha[2] = { SHRT_MIN, SHRT_MIN };
|
||||
|
||||
|
@ -1450,21 +1451,34 @@ public:
|
|||
if (lines[line].sidedef[sd] != NULL)
|
||||
{
|
||||
int mapside = int(intptr_t(lines[line].sidedef[sd]))-1;
|
||||
sides[side] = ParsedSides[mapside];
|
||||
sides[side].linedef = &lines[line];
|
||||
sides[side].sector = §ors[intptr_t(sides[side].sector)];
|
||||
lines[line].sidedef[sd] = &sides[side];
|
||||
if (mapside < sidecount)
|
||||
{
|
||||
sides[side] = ParsedSides[mapside];
|
||||
sides[side].linedef = &lines[line];
|
||||
sides[side].sector = §ors[intptr_t(sides[side].sector)];
|
||||
lines[line].sidedef[sd] = &sides[side];
|
||||
|
||||
P_ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside],
|
||||
lines[line].special, lines[line].args[0], &tempalpha[sd], missingTex);
|
||||
P_ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside],
|
||||
lines[line].special, lines[line].args[0], &tempalpha[sd], missingTex);
|
||||
|
||||
side++;
|
||||
side++;
|
||||
}
|
||||
else
|
||||
{
|
||||
lines[line].sidedef[sd] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
P_AdjustLine(&lines[line]);
|
||||
P_FinishLoadingLineDef(&lines[line], tempalpha[0]);
|
||||
}
|
||||
assert(side <= numsides);
|
||||
if (side < numsides)
|
||||
{
|
||||
Printf("Map had %d invalid side references\n", numsides - side);
|
||||
numsides = side;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
Loading…
Reference in a new issue