From: FruitieX <rasse@rasse-lappy.localdomain>
Date: Fri, 14 May 2010 15:47:51 +0000 (+0300)
Subject: use cvar_string() instead of storing hud_skin in a global so that changes take effect... 
X-Git-Tag: xonotic-v0.1.0preview~541^2~173
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b5a628602eca9e101f8438dcec6cddd3ac255e09;p=xonotic%2Fxonotic-data.pk3dir.git

use cvar_string() instead of storing hud_skin in a global so that changes take effect immediately
---

diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index 8c012c5d73..8c9bf8492b 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -77,7 +77,7 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
 
 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
 void drawpic_skin(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
-	drawpic(pos, strcat("gfx/hud/", hud_skin, "/", pic), sz, color, alpha, drawflag);
+	drawpic(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, color, alpha, drawflag);
 }
 
 // return HUD background color
@@ -564,7 +564,7 @@ string HUD_Panel_GetName(float id)
 void HUD_Panel_ExportCfg(string cfgname)
 {
 	float fh;
-	fh = fopen(strcat("hud_", hud_skin, "_", cfgname, ".cfg"), FILE_WRITE);
+	fh = fopen(strcat("hud_", cvar_string("hud_skin"), "_", cfgname, ".cfg"), FILE_WRITE);
 	if(fh >= 0)
 	{
 		float i;
@@ -580,7 +580,7 @@ void HUD_Panel_ExportCfg(string cfgname)
 			fputs(fh, "");
 		}
 
-		print("^2Successfully exported to hud_", hud_skin, "_", cfgname, ".cfg");
+		print("^2Successfully exported to hud_", cvar_string("hud_skin"), "_", cfgname, ".cfg! (Note: It's saved in data/data/)\n");
 	}
 	fclose(fh);
 }
@@ -692,7 +692,7 @@ void HUD_Panel_DrawBg(float id, vector pos, vector mySize)
 		if(hud_configure)
 			alpha = max(cvar("hud_configure_bg_minalpha"), alpha);
 
-		draw_BorderPicture(pos - '1 1 0' * border, strcat("gfx/hud/", hud_skin, "/", bg), mySize + '1 1 0' * 2 * border, color, alpha, '1 1 0' * (border/BORDER_MULTIPLIER));
+		draw_BorderPicture(pos - '1 1 0' * border, strcat("gfx/hud/", cvar_string("hud_skin"), "/", bg), mySize + '1 1 0' * 2 * border, color, alpha, '1 1 0' * (border/BORDER_MULTIPLIER));
 	}
 }
 
@@ -2863,7 +2863,6 @@ void HUD_Main (void)
 	hud_fontsize_spec = HUD_GetFontsize("hud_fontsize_spec");
 
 	hud_configure = cvar("_hud_configure");
-	hud_skin = cvar_string("hud_skin");
 
 	// Drawing stuff
 	if(cvar("hud_dock"))
diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh
index ca9198eec1..8686422312 100644
--- a/qcsrc/client/hud.qh
+++ b/qcsrc/client/hud.qh
@@ -27,5 +27,4 @@ float hud_accuracy_hud;
 float hud_border_thickness;
 float hud_accuracy_border_thickness;
 
-string hud_skin;
 float hud_configure;