diff --git a/include/qbsp/map.hh b/include/qbsp/map.hh index dcf7ccdd..88323e1b 100644 --- a/include/qbsp/map.hh +++ b/include/qbsp/map.hh @@ -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; } ; diff --git a/qbsp/map.cc b/qbsp/map.cc index bd996526..7d95793a 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -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) {