From: terencehill Date: Sat, 27 Jul 2019 16:56:44 +0000 (+0200) Subject: Less STATIC_INIT calls in race code + small cleanup X-Git-Tag: xonotic-v0.8.5~1441 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5de503ab3a50bb9a57dfd205bf8fb0d208273c44;p=xonotic%2Fxonotic-data.pk3dir.git Less STATIC_INIT calls in race code + small cleanup --- diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh index 679dd8502..b1518bd4f 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh @@ -28,7 +28,8 @@ CLASS(Flag, Pickup) ATTRIB(Flag, m_mins, vector, (PL_MIN_CONST + '0 0 -13') * 1.4); // scaling be damned ATTRIB(Flag, m_maxs, vector, (PL_MAX_CONST + '0 0 -13') * 1.4); ENDCLASS(Flag) -Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); } +Flag CTF_FLAG; +STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); } void ctf_FlagTouch(entity this, entity toucher) { ITEM_HANDLE(Pickup, CTF_FLAG, this, toucher); } // flag constants // for most of these, there is just one question to be asked: WHYYYYY? diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 86e780e0a..efdd836d2 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -36,7 +36,8 @@ CLASS(OffhandMageTeleport, OffhandWeapon) player.OffhandMageTeleport_key_pressed = key_pressed; } ENDCLASS(OffhandMageTeleport) -OffhandMageTeleport OFFHAND_MAGE_TELEPORT; STATIC_INIT(OFFHAND_MAGE_TELEPORT) { OFFHAND_MAGE_TELEPORT = NEW(OffhandMageTeleport); } +OffhandMageTeleport OFFHAND_MAGE_TELEPORT; +STATIC_INIT(OFFHAND_MAGE_TELEPORT) { OFFHAND_MAGE_TELEPORT = NEW(OffhandMageTeleport); } float autocvar_g_monster_mage_health; float autocvar_g_monster_mage_damageforcescale = 0.5; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 00ec43523..c6a853d0e 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1250,7 +1250,8 @@ CLASS(NadeOffhand, OffhandWeapon) } } ENDCLASS(NadeOffhand) -NadeOffhand OFFHAND_NADE; STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOffhand); } +NadeOffhand OFFHAND_NADE; +STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOffhand); } MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST) { diff --git a/qcsrc/common/weapons/weapon/blaster.qh b/qcsrc/common/weapons/weapon/blaster.qh index c9825adf0..6297bdf37 100644 --- a/qcsrc/common/weapons/weapon/blaster.qh +++ b/qcsrc/common/weapons/weapon/blaster.qh @@ -50,7 +50,8 @@ SPAWNFUNC_WEAPON(weapon_laser, WEP_BLASTER) CLASS(OffhandBlaster, OffhandWeapon) ENDCLASS(OffhandBlaster) -OffhandBlaster OFFHAND_BLASTER; STATIC_INIT(OFFHAND_BLASTER) { OFFHAND_BLASTER = NEW(OffhandBlaster); } +OffhandBlaster OFFHAND_BLASTER; +STATIC_INIT(OFFHAND_BLASTER) { OFFHAND_BLASTER = NEW(OffhandBlaster); } #ifdef SVQC .float blaster_damage; diff --git a/qcsrc/common/weapons/weapon/hook.qh b/qcsrc/common/weapons/weapon/hook.qh index 53bb38291..bff975e00 100644 --- a/qcsrc/common/weapons/weapon/hook.qh +++ b/qcsrc/common/weapons/weapon/hook.qh @@ -62,7 +62,8 @@ CLASS(OffhandHook, OffhandWeapon) } #endif ENDCLASS(OffhandHook) -OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); } +OffhandHook OFFHAND_HOOK; +STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); } #ifdef SVQC diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index b3241838b..9a12a0486 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -23,7 +23,12 @@ #include "../common/mutators/mutator/waypoints/waypointsprites.qh" IntrusiveList g_race_targets; -STATIC_INIT(g_race_targets) { g_race_targets = IL_NEW(); } +IntrusiveList g_racecheckpoints; +STATIC_INIT(g_race) +{ + g_race_targets = IL_NEW(); + g_racecheckpoints = IL_NEW(); +} void race_InitSpectator() { diff --git a/qcsrc/server/race.qh b/qcsrc/server/race.qh index 4402e2256..4dafbcf63 100644 --- a/qcsrc/server/race.qh +++ b/qcsrc/server/race.qh @@ -31,9 +31,6 @@ float race_completing; .float race_respawn_checkpoint; .entity race_respawn_spotref; // try THIS spawn in case you respawn -IntrusiveList g_racecheckpoints; -STATIC_INIT(g_racecheckpoints) { g_racecheckpoints = IL_NEW(); } - // definitions for functions used outside race.qc float race_PreviousCheckpoint(float f); float race_NextCheckpoint(float f);