]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Free unused strings from memory
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 30 Jan 2012 15:15:37 +0000 (17:15 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 30 Jan 2012 15:15:37 +0000 (17:15 +0200)
data/qcsrc/client/hud.qc

index ea52cda39bde653e9989428d84eb031fd283bba0..c0983860157696377c5139d158a76e552d8e9b25 100644 (file)
@@ -1708,10 +1708,26 @@ void Sbar_Portrait()
                return;\r
 \r
        if(portrait_time + cvar("sbar_portrait_time") >= time)\r
-       if(portrait_image && portrait_name) // prevent using bad strings\r
        {\r
-               drawpic(left - '120 80 0' - fade_pos, portrait_image, '120 160 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-               drawcolorcodedstring(left - '120 -80 0' - fade_pos, textShortenToWidth(portrait_name, 120, '12 12 0', stringwidth_colors), '12 12 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               if(portrait_image && portrait_name) // prevent using bad strings\r
+               {\r
+                       drawpic(left - '120 80 0' - fade_pos, portrait_image, '120 160 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       drawcolorcodedstring(left - '120 -80 0' - fade_pos, textShortenToWidth(portrait_name, 120, '12 12 0', stringwidth_colors), '12 12 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               }\r
+       }\r
+       else\r
+       {\r
+               // free unused strings from memory\r
+               if(portrait_image)\r
+               {\r
+                       strunzone(portrait_image);\r
+                       portrait_image = string_null;\r
+               }\r
+               if(portrait_name)\r
+               {\r
+                       strunzone(portrait_name);\r
+                       portrait_name = string_null;\r
+               }\r
        }\r
 }\r
 \r