X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fbase.qh;h=4f940c42b3c016f3e9131e0c6d3b213bc4d5497a;hb=ccbcb3106b45ccc788ed1c5062a873693d499a43;hp=4e7676c15ac33ab335035ce80df3ef2b766d06c7;hpb=3018b03b7ad0decee85f2a659783d0b5309fe5a3;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/base.qh b/qcsrc/common/mutators/base.qh index 4e7676c15..4f940c42b 100644 --- a/qcsrc/common/mutators/base.qh +++ b/qcsrc/common/mutators/base.qh @@ -1,5 +1,9 @@ #pragma once +#ifdef CSQC +#include +#endif + const int CBC_ORDER_FIRST = 1; const int CBC_ORDER_LAST = 2; const int CBC_ORDER_EXCLUSIVE = 3; @@ -276,6 +280,20 @@ STATIC_INIT_LATE(Mutators) { #define MUTATOR_ONADD if (mode == MUTATOR_ADDING) #define MUTATOR_ONREMOVE if (mode == MUTATOR_REMOVING) #define MUTATOR_ONROLLBACK_OR_REMOVE if (mode == MUTATOR_REMOVING || mode == MUTATOR_ROLLING_BACK) + +#define MUTATOR_STATIC() MACRO_BEGIN { \ + MUTATOR_ONADD { \ + /* game loads at time 1 */ \ + if (time > 1) { \ + error("This is a game type and it cannot be added at runtime."); \ + } \ + } \ + MUTATOR_ONREMOVE { \ + LOG_INFO("This is a game type and it cannot be removed at runtime."); \ + return -1; \ + } \ +} MACRO_END + #define MUTATOR_ADD(name) Mutator_Add(MUTATOR_##name) #define MUTATOR_REMOVE(name) Mutator_Remove(MUTATOR_##name) #define MUTATOR_RETURNVALUE CallbackChain_ReturnValue @@ -301,7 +319,7 @@ STATIC_INIT_LATE(Mutators) { #define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN { \ MUTATOR_ONADD { \ if (!CallbackChain_Add(HOOK_##cb, CALLBACK_##func, order)) { \ - LOG_INFO("HOOK FAILED: ", #cb, ":", #func, "\n"); \ + LOG_INFO("HOOK FAILED: ", #cb, ":", #func); \ return true; \ } \ } \