]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Initialize mutators later with STATIC_INIT_LATE
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 31 Aug 2015 09:25:08 +0000 (19:25 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 31 Aug 2015 09:25:08 +0000 (19:25 +1000)
qcsrc/common/mutators/base.qh
qcsrc/lib/Registry.qh

index 4c39d6f7d5a4f32b46ef32e20fe90910a9b9eaee..d92bd5b57c90b43c60180a25c18a3af381a5c68b 100644 (file)
@@ -228,6 +228,9 @@ STATIC_INIT(Mutators) {
     RegisterHooks();
     RegisterCallbacks();
     RegisterMutators();
+}
+
+STATIC_INIT_LATE(Mutators) {
     FOREACH(MUTATORS, it.mutatorcheck(), LAMBDA(Mutator_Add(it)));
 }
 
index 8a93146d50911284925c19d4e2a40531be8e07a5..b9e2fd653b5622b61fce59be11fb5268eaf13818 100644 (file)
     ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id)         \
     REGISTER_INIT(ns, id)
 
-void __static_init() { }
+void __static_init_early() { }
+void __static_init() { CALL_ACCUMULATED_FUNCTION(__static_init_early); }
 #define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
-#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init, func)
+#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init_early, func)
 
-#define STATIC_INIT(func) \
+#define _STATIC_INIT(where, func) \
     void _static_##func(); \
-    ACCUMULATE_FUNCTION(__static_init, _static_##func) \
+    ACCUMULATE_FUNCTION(where, _static_##func) \
     void _static_##func()
 
+#define STATIC_INIT(func)       _STATIC_INIT(__static_init_early,   func##_early)
+#define STATIC_INIT_LATE(func)  _STATIC_INIT(__static_init,         func)
+
 #endif