From: TimePath Date: Wed, 14 Oct 2015 11:43:10 +0000 (+1100) Subject: Static init: static_init_late() X-Git-Tag: xonotic-v0.8.2~1801^2~36 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=cd9de89a025e1e8cd8b1c38de005d5fafe7de70a;p=xonotic%2Fxonotic-data.pk3dir.git Static init: static_init_late() --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index c641bf61e..47bf7044e 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -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 diff --git a/qcsrc/lib/static.qh b/qcsrc/lib/static.qh index d51a87175..f7bcdcc29 100644 --- a/qcsrc/lib/static.qh +++ b/qcsrc/lib/static.qh @@ -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 diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index fde2c3c1e..06722c7a3 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -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(); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index fc3eed452..8dc68f696 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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));