From 9ef1017f3a33d2306d4deb70f4e82287414b048a Mon Sep 17 00:00:00 2001 From: drjaska Date: Tue, 20 Sep 2022 02:30:28 +0300 Subject: [PATCH] after renaming health in stack memory so it does't overlap with .health entity field the refactor to team entity .health fields works --- .../gamemodes/gamemode/clanarena/sv_clanarena.qc | 13 ++++++------- .../gamemodes/gamemode/clanarena/sv_clanarena.qh | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index a37089797..e8e9fb63e 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -112,19 +112,18 @@ print("checking health\n"); if (IS_DEAD(it)){ continue; } - float health = GetResource(it, RES_HEALTH); - float armor = GetResource(it, RES_ARMOR); + float healthValue = GetResource(it, RES_HEALTH); + float armorValue = GetResource(it, RES_ARMOR); for (int i = 1; i <= AvailableTeams(); i++) if (it.team == Team_IndexToTeam(i)) - (Team_GetTeamFromIndex(i)).health += health+armor; + (Team_GetTeamFromIndex(i)).health += healthValue+armorValue; }); print("amount of health in teams\n"); - // this could be removed with the side-effect that teams will have initially 1 health per survivor - //for (int i = 1; i <= AvailableTeams(); i++){ - // print(sprintf("%f", Team_GetTeamFromIndex(i).health), "\n"); - //} + for (int i = 1; i <= AvailableTeams(); i++){ + print(sprintf("%f", Team_GetTeamFromIndex(i).health), "\n"); + } highestHealthTeam = 0; secondHighestHealthTeam = 0; diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh index c7e147a21..fc2513e1c 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh @@ -14,6 +14,7 @@ int autocvar_g_ca_teams_override; float autocvar_g_ca_warmup; string autocvar_g_ca_weaponarena = "most"; +.float health; int ca_teams; bool allowed_to_spawn; -- 2.39.2