From: otta8634 Date: Wed, 8 Jan 2025 16:18:36 +0000 (+0800) Subject: Remove mutators constructor X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=468fc5aa7ebf5f772bcc5f632935d8c50546314a;p=xonotic%2Fxonotic-data.pk3dir.git Remove mutators constructor 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. --- diff --git a/qcsrc/common/mutators/base.qh b/qcsrc/common/mutators/base.qh index def5e367ee..de637b0770 100644 --- a/qcsrc/common/mutators/base.qh +++ b/qcsrc/common/mutators/base.qh @@ -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__))