From: Rudolf Polzer Date: Mon, 1 Nov 2010 06:43:42 +0000 (+0100) Subject: apparently calling FindOrInsertWorldspawn during tree traversing is bad, so let's... X-Git-Tag: xonotic-v0.5.0~157 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=288318d040823dd80b848e089856c3b58f2f9d73;p=xonotic%2Fnetradiant.git apparently calling FindOrInsertWorldspawn during tree traversing is bad, so let's not do that --- diff --git a/radiant/entity.cpp b/radiant/entity.cpp index 055de636..9478bda2 100644 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@ -184,11 +184,11 @@ public: class EntityGroupSelected : public scene::Graph::Walker { - NodeSmartReference group; + NodeSmartReference group, worldspawn; //typedef std::pair DeletionPair; //Stack deleteme; public: - EntityGroupSelected(const scene::Path &p): group(p.top().get()) + EntityGroupSelected(const scene::Path &p): group(p.top().get()), worldspawn(Map_FindOrInsertWorldspawn(g_map)) { } bool pre(const scene::Path& path, scene::Instance& instance) const @@ -206,7 +206,7 @@ class EntityGroupSelected : public scene::Graph::Walker NodeSmartReference child(path.top().get()); NodeSmartReference parent(path.parent().get()); - if(path.size() >= 3 && parent != Map_FindOrInsertWorldspawn(g_map)) + if(path.size() >= 3 && parent != worldspawn) { NodeSmartReference parentparent(path[path.size() - 3].get()); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 7f7eb061..ea4edf31 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1189,8 +1189,11 @@ void SelectFaceMode() class CloneSelected : public scene::Graph::Walker { bool doMakeUnique; + NodeSmartReference worldspawn; public: - CloneSelected(bool d): doMakeUnique(d) { } + CloneSelected(bool d): doMakeUnique(d), worldspawn(Map_FindOrInsertWorldspawn(g_map)) + { + } bool pre(const scene::Path& path, scene::Instance& instance) const { if(path.size() == 1) @@ -1198,7 +1201,7 @@ public: // ignore worldspawn, but keep checking children NodeSmartReference me(path.top().get()); - if(me == Map_FindOrInsertWorldspawn(g_map)) + if(me == worldspawn) return true; if(!path.top().get().isRoot()) @@ -1220,7 +1223,7 @@ public: // ignore worldspawn, but keep checking children NodeSmartReference me(path.top().get()); - if(me == Map_FindOrInsertWorldspawn(g_map)) + if(me == worldspawn) return; if(!path.top().get().isRoot()) diff --git a/radiant/select.cpp b/radiant/select.cpp index 79721e9b..5889fd5a 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -340,8 +340,9 @@ void Select_Invert() class ExpandSelectionToEntitiesWalker : public scene::Graph::Walker { mutable std::size_t m_depth; + NodeSmartReference worldspawn; public: - ExpandSelectionToEntitiesWalker() : m_depth(0) + ExpandSelectionToEntitiesWalker() : m_depth(0), worldspawn(Map_FindOrInsertWorldspawn(g_map)) { } bool pre(const scene::Path& path, scene::Instance& instance) const @@ -350,7 +351,7 @@ public: // ignore worldspawn NodeSmartReference me(path.top().get()); - if(me == Map_FindOrInsertWorldspawn(g_map)) + if(me == worldspawn) return false; if(m_depth == 2) // entity depth