From: Mario Date: Fri, 1 Jul 2022 05:16:30 +0000 (+1000) Subject: Fix compilation unit test X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=80b2b3eab9c41d7ed4f3bacccbdf9c0cb2892ebd;p=xonotic%2Fxonotic-data.pk3dir.git Fix compilation unit test --- diff --git a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc index a09b655b3a..6054df7f4b 100644 --- a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc +++ b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc @@ -563,3 +563,18 @@ MUTATOR_HOOKFUNCTION(tka, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE) M_ARGV(0, float) = tka_teams; return true; } + +void tka_Initialize() +{ + tka_teams = autocvar_g_tka_teams_override; + if(tka_teams < 2) + tka_teams = cvar("g_tka_teams"); // read the cvar directly as it gets written earlier in the same frame + tka_teams = BITS(bound(2, tka_teams, 4)); + GameRules_scoring(tka_teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, { + field(SP_TKA_PICKUPS, "pickups", 0); + field(SP_TKA_CARRIERKILLS, "bckills", 0); + field(SP_TKA_BCTIME, "bctime", SFL_SORT_PRIO_SECONDARY); + }); + + InitializeEntity(NULL, tka_DelayedInit, INITPRIO_GAMETYPE); +} diff --git a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh index a24b5c5ca3..61ec7a942e 100644 --- a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh +++ b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh @@ -4,7 +4,7 @@ int autocvar_g_tka_point_limit; int autocvar_g_tka_point_leadlimit; bool autocvar_g_tka_team_spawns; -void tka_DelayedInit(entity this); +void tka_Initialize(); int tka_teams; //int autocvar_g_tka_teams; @@ -21,17 +21,7 @@ REGISTER_MUTATOR(tka, false) GameRules_limit_score(autocvar_g_tka_point_limit); GameRules_limit_lead(autocvar_g_tka_point_leadlimit); - tka_teams = autocvar_g_tka_teams_override; - if(tka_teams < 2) - tka_teams = cvar("g_tka_teams"); // read the cvar directly as it gets written earlier in the same frame - tka_teams = BITS(bound(2, tka_teams, 4)); - GameRules_scoring(tka_teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, { - field(SP_TKA_PICKUPS, "pickups", 0); - field(SP_TKA_CARRIERKILLS, "bckills", 0); - field(SP_TKA_BCTIME, "bctime", SFL_SORT_PRIO_SECONDARY); - }); - - InitializeEntity(NULL, tka_DelayedInit, INITPRIO_GAMETYPE); + tka_Initialize(); } return false; }