qbsp: fix external maps with no worldspawn brushes

Thanks to ZungryWare for the report
This commit is contained in:
Eric Wasylishen 2019-11-29 21:03:54 -07:00
parent cefd20c8da
commit 5e74b4d0bb
2 changed files with 12 additions and 1 deletions

View File

@ -73,7 +73,11 @@ public:
brushformat_t format;
int contents;
mapbrush_t() : firstface(0), numfaces(0), format(brushformat_t::NORMAL) {}
mapbrush_t() :
firstface(0),
numfaces(0),
format(brushformat_t::NORMAL),
contents(0) {}
const mapface_t &face(int i) const;
} ;

View File

@ -1900,8 +1900,15 @@ mapentity_t LoadExternalMap(const char *filename)
while (ParseEntity(&parser, &dummy)) {
// this is kind of fragile, but move the brushes to the worldspawn.
if (dummy.nummapbrushes) {
// special case for when the external map's worldspawn has no brushes
if (!dest.firstmapbrush) {
dest.firstmapbrush = dummy.firstmapbrush;
}
dest.nummapbrushes += dummy.nummapbrushes;
}
// clear for the next loop iteration
dummy = mapentity_t();
}
if (!dest.nummapbrushes) {