From: drjaska Date: Mon, 19 Sep 2022 23:30:28 +0000 (+0300) Subject: after renaming health in stack memory so it does't overlap with .health entity field... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9ef1017f3a33d2306d4deb70f4e82287414b048a;p=xonotic%2Fxonotic-data.pk3dir.git after renaming health in stack memory so it does't overlap with .health entity field the refactor to team entity .health fields works --- 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;