]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/base.qh
client: remove _all
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / base.qh
index 92e6323b3253e868bff39854337279af96dc4bac..2b932b275fd61a068ae2b42d618533632ef68b66 100644 (file)
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifdef CSQC
+#include <client/main.qh>
+#endif
+
 const int CBC_ORDER_FIRST = 1;
 const int CBC_ORDER_LAST = 2;
 const int CBC_ORDER_EXCLUSIVE = 3;
@@ -185,9 +189,9 @@ bool Mutator_SendEntity(entity this, entity to, int sf)
 void NET_Mutator_Remove(entity this)
 {
     string s = this.netname;
-    WITH(bool, mutator_log, true, LAMBDA(
+    WITH(bool, mutator_log, true, {
         FOREACH(Mutators, it.registered_id == s, Mutator_Remove(it));
-    ));
+    });
 }
 NET_HANDLE(Mutator, bool isNew)
 {
@@ -199,9 +203,9 @@ NET_HANDLE(Mutator, bool isNew)
         make_pure(this);
         this.entremove = NET_Mutator_Remove;
         int added = 0;
-        WITH(bool, mutator_log, true, LAMBDA(
+        WITH(bool, mutator_log, true, {
             FOREACH(Mutators, it.registered_id == s, { Mutator_Add(it); ++added; });
-        ));
+        });
         if (added > 1) LOG_WARNF("Added more than one mutator for %s", s);
     }
 }
@@ -234,6 +238,12 @@ bool Mutator_Add(Mutator mut)
 
 void Mutator_Remove(Mutator mut)
 {
+    if(!mut.m_added)
+    {
+        backtrace("WARNING: removing not-added mutator\n");
+        return;
+    }
+
     mut.m_added = false;
     mutatorfunc_t func = mut.mutatorfunc;
     if (func(MUTATOR_REMOVING)) {