Skip to content

Commit

Permalink
Fixed|World|Client: Uncaught exception (Doom 2 MAP14)
Browse files Browse the repository at this point in the history
Never attempt to fix missing materials on the back of lines belonging
to "one-way window" effects/mapping-errors (there are no Surfaces in
such a case).

Fixes #2174
  • Loading branch information
danij-deng committed Aug 24, 2016
1 parent fb9e0b7 commit 020c605
Showing 1 changed file with 27 additions and 31 deletions.
58 changes: 27 additions & 31 deletions doomsday/apps/client/src/client/cledgeloop.cpp
Expand Up @@ -255,46 +255,42 @@ void ClEdgeLoop::fixSurfacesMissingMaterials()
{
if (it->hasMapElement()) // BSP errors may fool the circulator wrt interior edges -ds
{
if (hasBackSubsector())
LineSide &lineSide = it->mapElementAs<LineSideSegment>().lineSide();
if (lineSide.hasSections()) // Not a "one-way window" -ds
{
auto const &backSubsec = backSubsector().as<ClientSubsector>();

// A potential bottom section fix?
if (!d->owner.hasSkyFloor() && !backSubsec.hasSkyFloor())
if (hasBackSubsector())
{
if (d->owner.visFloor().height() < backSubsec.visFloor().height())
{
d->fixMissingMaterial(*it, LineSide::Bottom);
}
else
{
Surface &surface = it->mapElementAs<LineSideSegment>().lineSide().bottom();
if (surface.hasFixMaterial())
surface.setMaterial(nullptr);
}
}
auto const &backSubsec = backSubsector().as<ClientSubsector>();

// A potential top section fix?
if (!d->owner.hasSkyCeiling() && !backSubsec.hasSkyCeiling())
{
if (d->owner.visCeiling().height() > backSubsec.visCeiling().height())
// Potential bottom section fix?
if (!d->owner.hasSkyFloor() && !backSubsec.hasSkyFloor())
{
d->fixMissingMaterial(*it, LineSide::Top);
if (d->owner.visFloor().height() < backSubsec.visFloor().height())
{
d->fixMissingMaterial(*it, LineSide::Bottom);
}
else if (lineSide.bottom().hasFixMaterial())
{
lineSide.bottom().setMaterial(nullptr);
}
}
else

// Potential top section fix?
if (!d->owner.hasSkyCeiling() && !backSubsec.hasSkyCeiling())
{
Surface &surface = it->mapElementAs<LineSideSegment>().lineSide().top();
if (surface.hasFixMaterial())
surface.setMaterial(nullptr);
if (d->owner.visCeiling().height() > backSubsec.visCeiling().height())
{
d->fixMissingMaterial(*it, LineSide::Top);
}
else if (lineSide.top().hasFixMaterial())
{
lineSide.top().setMaterial(nullptr);
}
}
}
}
else
{
LineSide &side = it->mapElementAs<LineSideSegment>().lineSide();
if (!side.back().hasSector())
// Potential middle section fix?
else if (!lineSide.back().hasSector())
{
// A potential middle section fix.
d->fixMissingMaterial(*it, LineSide::Middle);
}
}
Expand Down

0 comments on commit 020c605

Please sign in to comment.