From: terencehill Date: Sat, 27 Jul 2019 15:00:55 +0000 (+0200) Subject: Get rid of redundant Item_ItemsTime_Init functions. Reduce number of STATIC_INIT... X-Git-Tag: xonotic-v0.8.5~1442 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=64ddb444fbb5d5a1b4e8eb5442544a8a5ae0b084;p=xonotic%2Fxonotic-data.pk3dir.git Get rid of redundant Item_ItemsTime_Init functions. Reduce number of STATIC_INIT calls in main.qh --- diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index f0f8f1d4b..87951ff89 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -45,20 +45,24 @@ entity teamslots[17]; // 17 teams (including "spectator team") .bool ready; .bool eliminated; -.void(entity) draw; IntrusiveList g_drawables; -STATIC_INIT(g_drawables) { g_drawables = IL_NEW(); } -.void(entity) draw2d; IntrusiveList g_drawables_2d; -STATIC_INIT(g_drawables_2d) { g_drawables_2d = IL_NEW(); } +IntrusiveList g_radarlinks; +IntrusiveList g_radaricons; +STATIC_INIT(main) +{ + g_drawables = IL_NEW(); + g_drawables_2d = IL_NEW(); + g_radarlinks = IL_NEW(); + g_radaricons = IL_NEW(); +} + +.void(entity) draw; +.void(entity) draw2d; .void(entity) entremove; float drawframetime; vector view_origin, view_forward, view_right, view_up; -IntrusiveList g_radarlinks; -STATIC_INIT(g_radarlinks) { g_radarlinks = IL_NEW(); } -IntrusiveList g_radaricons; -STATIC_INIT(g_radaricons) { g_radaricons = IL_NEW(); } bool button_zoom; bool spectatorbutton_zoom; diff --git a/qcsrc/common/mutators/mutator/itemstime/itemstime.qc b/qcsrc/common/mutators/mutator/itemstime/itemstime.qc index 1379d586f..8d2bb318f 100644 --- a/qcsrc/common/mutators/mutator/itemstime/itemstime.qc +++ b/qcsrc/common/mutators/mutator/itemstime/itemstime.qc @@ -28,16 +28,12 @@ NET_HANDLE(itemstime, bool isNew) #endif #ifdef CSQC -void Item_ItemsTime_Init() -{ - FOREACH(Items, true, { - ItemsTime_time[it.m_id] = -1; - }); - ItemsTime_time[Items_MAX] = -1; -} STATIC_INIT(ItemsTime_Init) { - Item_ItemsTime_Init(); + FOREACH(Items, true, { + ItemsTime_time[it.m_id] = -1; + }); + ItemsTime_time[Items_MAX] = -1; } int autocvar_hud_panel_itemstime = 2; @@ -77,17 +73,11 @@ bool Item_ItemsTime_Allow(GameItem it) // reserve one more spot for superweapons time float it_times[Items_MAX + 1]; -void Item_ItemsTime_Init() -{ - FOREACH(Items, Item_ItemsTime_Allow(it), { - it_times[it.m_id] = -1; - }); - it_times[Items_MAX] = -1; -} - STATIC_INIT(ItemsTime_Init) { - // items time - Item_ItemsTime_Init(); + FOREACH(Items, Item_ItemsTime_Allow(it), { + it_times[it.m_id] = -1; + }); + it_times[Items_MAX] = -1; } void Item_ItemsTime_ResetTimes()