]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove mutators constructor
authorotta8634 <k9wolf@pm.me>
Wed, 8 Jan 2025 16:18:36 +0000 (00:18 +0800)
committerotta8634 <k9wolf@pm.me>
Wed, 8 Jan 2025 16:18:36 +0000 (00:18 +0800)
This allows for classes to inherit Mutator without having to copy paste the CONSTRUCTOR, since CONSTRUCTOR inheritance doesn't work currently for some reason.
This can be reverted easily in future when CONSTRUCTOR inheritance is fixed.

qcsrc/common/mutators/base.qh

index def5e367ee2be9bc7ef92c029ada94927d7f309a..de637b0770f476e42098bd6ddc9d76d1dfc930b0 100644 (file)
@@ -167,11 +167,6 @@ CLASS(Mutator, Object)
     METHOD(Mutator, display, void(entity this, void(string name, string icon) returns)) {
         returns(this.m_name, this.m_icon);
     }
-    CONSTRUCTOR(Mutator, string _name, mutatorfunc_t func) {
-        CONSTRUCT(Mutator);
-        this.mutatorname = _name;
-        this.mutatorfunc = func;
-    }
 ENDCLASS(Mutator)
 
 REGISTRY(Mutators, BITS(7))
@@ -277,8 +272,12 @@ void Mutator_Remove(Mutator mut)
         bool ret = MUTATORFUNC_##id##_hooks(mode); if (ret) return ret; \
     } \
     bool MUTATOR_##id##_check() { return dependence; } \
-    REGISTER(Mutators, MUTATOR, id, m_id, NEW(cname, #id, MUTATORFUNC_##id)) \
-    { this.mutatorcheck = MUTATOR_##id##_check; } \
+    REGISTER(Mutators, MUTATOR, id, m_id, NEW(cname)) \
+    { \
+        this.mutatorname = #id; \
+        this.mutatorfunc = MUTATORFUNC_##id; \
+        this.mutatorcheck = MUTATOR_##id##_check; \
+    } \
     ACCUMULATE bool MUTATORFUNC_##id(int mode)
 
 #define REGISTER_MUTATOR(...) EVAL(OVERLOAD(REGISTER_MUTATOR, __VA_ARGS__))