]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
apparently calling FindOrInsertWorldspawn during tree traversing is bad, so let's...
authorRudolf Polzer <divverent@alientrap.org>
Mon, 1 Nov 2010 06:43:42 +0000 (07:43 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 1 Nov 2010 06:43:42 +0000 (07:43 +0100)
radiant/entity.cpp
radiant/mainframe.cpp
radiant/select.cpp

index 055de6362f10b58b6204326a3f25cc6a08f7df30..9478bda27ea00fbc84f39cc281b95a6ab50b751e 100644 (file)
@@ -184,11 +184,11 @@ public:
 
 class EntityGroupSelected : public scene::Graph::Walker
 {
-       NodeSmartReference group;
+       NodeSmartReference group, worldspawn;
        //typedef std::pair<NodeSmartReference, NodeSmartReference> DeletionPair;
        //Stack<DeletionPair> 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());
 
index 7f7eb061f4b4be77ac2088b33c03dc19cff41fee..ea4edf31eee981c917760e8ca150573661df028d 100644 (file)
@@ -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())
index 79721e9b766915d3e4810b03b27895a3b9b76781..5889fd5a1c69fb9d3753f18eb2e86c68d43a7ff4 100644 (file)
@@ -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