From f8dda0b31f50d7cc540577d0ee5e1ee6308401da Mon Sep 17 00:00:00 2001
From: terencehill <piuntn@gmail.com>
Date: Mon, 1 Nov 2010 22:52:16 +0100
Subject: [PATCH] Update main cvars of Powerups and Vote panels only when these
 panels gets really shown

---
 qcsrc/client/hud.qc | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index 116266532e..802907e34b 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -2034,21 +2034,17 @@ void HUD_Powerups(void) {
 	if(!autocvar_hud_panel_powerups && !autocvar__hud_configure)
 		return;
 
-	active_panel = HUD_PANEL_POWERUPS;
-	HUD_Panel_UpdateCvars(powerups);
-	float stat_items;
-	stat_items = getstati(STAT_ITEMS);
-
 	if(!autocvar__hud_configure)
 	{
-		if not(stat_items & IT_STRENGTH)
-			if not(stat_items & IT_INVINCIBLE)
-				return;
+		if not(getstati(STAT_ITEMS) & (IT_STRENGTH | IT_INVINCIBLE))
+			return;
 
 		if (getstati(STAT_HEALTH) <= 0)
 			return;
 	}
 
+	active_panel = HUD_PANEL_POWERUPS;
+	HUD_Panel_UpdateCvars(powerups);
 	vector pos, mySize;
 	pos = panel_pos;
 	mySize = panel_size;
@@ -3760,12 +3756,6 @@ void HUD_VoteWindow(void)
 	if(!autocvar_hud_panel_vote && !autocvar__hud_configure)
 		return;
 
-	active_panel = HUD_PANEL_VOTE;
-	HUD_Panel_UpdateCvars(vote);
-	vector pos, mySize;
-	pos = panel_pos;
-	mySize = panel_size;
-
 	if(!autocvar__hud_configure)
 	{
 		panel_fg_alpha = autocvar_hud_panel_fg_alpha;
@@ -3799,6 +3789,12 @@ void HUD_VoteWindow(void)
 	if(!vote_alpha)
 		return;
 
+	active_panel = HUD_PANEL_VOTE;
+	HUD_Panel_UpdateCvars(vote);
+	vector pos, mySize;
+	pos = panel_pos;
+	mySize = panel_size;
+
 	a = vote_alpha * bound(cvar("hud_panel_vote_alreadyvoted_alpha"), 1 - vote_highlighted, 1);
 	HUD_Panel_DrawBg(a);
 	a = panel_fg_alpha * a;
-- 
2.39.5