From 5e74b4d0bb8fdaa8a4f4e13fa5be637c63c5fcac Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 29 Nov 2019 21:03:54 -0700 Subject: [PATCH] qbsp: fix external maps with no worldspawn brushes Thanks to ZungryWare for the report --- include/qbsp/map.hh | 6 +++++- qbsp/map.cc | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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) {