]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Static init: static_init_late()
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 14 Oct 2015 11:43:10 +0000 (22:43 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 14 Oct 2015 11:43:10 +0000 (22:43 +1100)
qcsrc/client/main.qc
qcsrc/lib/static.qh
qcsrc/menu/menu.qc
qcsrc/server/g_world.qc

index c641bf61e0f5911d78310e943b9922e5a321b972..47bf7044ed72b398b8629661383c67e6abe32839 100644 (file)
@@ -130,6 +130,7 @@ void CSQC_Init(void)
 
        // needs to be done so early because of the constants they create
        static_init();
+       static_init_late();
 
        // precaches
 
index d51a8717532677a9e55b54d9119096fd4b90a1d2..f7bcdcc296688e5ac8303a424284544561147e16 100644 (file)
@@ -1,17 +1,19 @@
 #ifndef STATIC_H
 #define STATIC_H
 
-void __static_init_early() { }
-void __static_init() { CALL_ACCUMULATED_FUNCTION(__static_init_early); }
+void __static_init() { }
 #define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
-#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init_early, func)
+void __static_init_late() {  }
+#define static_init_late() CALL_ACCUMULATED_FUNCTION(__static_init_late)
+
+#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init, func)
 
 #define _STATIC_INIT(where, func) \
     void _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)
+#define STATIC_INIT(func)       _STATIC_INIT(__static_init,         func)
+#define STATIC_INIT_LATE(func)  _STATIC_INIT(__static_init_late,    func##_late)
 
 #endif
index fde2c3c1eb7594125c82cb2cac15eb99ae68284d..06722c7a3142978ef4457cc281784e563373fced 100644 (file)
@@ -82,6 +82,7 @@ void m_init()
 
        // needs to be done so early because of the constants they create
        static_init();
+       static_init_late();
 
        RegisterSLCategories();
 
index fc3eed45286cd110e4a697a050d40cbd0f3b63a3..8dc68f6961e7334885fd5a9f40532cfad898da2b 100644 (file)
@@ -557,6 +557,7 @@ spawnfunc(__init_dedicated_server)
 
        // needs to be done so early because of the constants they create
        static_init();
+       static_init_late();
 
        MapInfo_Enumerate();
        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
@@ -601,6 +602,7 @@ spawnfunc(worldspawn)
 
        // needs to be done so early because of the constants they create
        static_init();
+       static_init_late();
 
        ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid));