ENDCLASS(Mutator)
REGISTRY(Mutators, BITS(7))
-#define Mutators_from(i) _Mutators_from(i, NULL)
+
+REGISTRY_DEFINE_GET(Mutators, NULL)
bool Mutator_Add(Mutator mut);
void Mutator_Remove(Mutator mut);
bool mutator_log = false;
.bool m_added;
-#define MUTATOR_IS_ENABLED(this) MUTATOR_##this.mutatorcheck()
+#define _MUTATOR_IS_ENABLED(this) this.mutatorcheck()
+#define MUTATOR_IS_ENABLED(this) _MUTATOR_IS_ENABLED(MUTATOR_##this)
#ifdef GAMEQC
/** server mutators activate corresponding client mutators for all clients */
}
STATIC_INIT_LATE(Mutators) {
- FOREACH(Mutators, it.mutatorcheck(), Mutator_Add(it));
+ FOREACH(Mutators, _MUTATOR_IS_ENABLED(it), Mutator_Add(it));
}
#define MUTATOR_ONADD if (mode == MUTATOR_ADDING)
bool mut##_##cb() { return = false; } \
ACCUMULATE bool mut##_##cb()
+void _mutPrintFail(string cb, string func)
+{
+ // this is inside a function to avoid expanding it on compilation everytime
+ LOG_INFO("HOOK FAILED: ", cb, ":", func);
+}
+
#define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN \
MUTATOR_ONADD { \
if (!CallbackChain_Add(HOOK_##cb, CB_##func, order)) { \
- LOG_INFO("HOOK FAILED: ", #cb, ":", #func); \
+ _mutPrintFail(#cb, #func); \
return true; \
} \
} \