--- a/hedgewars/uStore.pas Sun Dec 07 14:36:28 2014 -0500
+++ b/hedgewars/uStore.pas Mon Dec 08 09:35:14 2014 -0500
@@ -50,7 +50,6 @@
function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
procedure RenderWeaponTooltip(atype: TAmmoType);
procedure ShowWeaponTooltip(x, y: LongInt);
-procedure FreeWeaponTooltip;
procedure MakeCrossHairs;
{$IFDEF USE_VIDEO_RECORDING}
procedure InitOffscreenOpenGL;
@@ -474,7 +473,7 @@
tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, PChar(trAmmo[NameId]), cWhiteColorChannels);
TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
tmpsurf:= doSurfaceConversion(tmpsurf);
- FreeTexture(NameTex);
+ FreeAndNilTexture(NameTex);
NameTex:= Surface2Tex(tmpsurf, false);
SDL_FreeSurface(tmpsurf)
end;
@@ -484,7 +483,7 @@
begin
tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels);
tmpsurf:= doSurfaceConversion(tmpsurf);
- FreeTexture(CountTexz[i]);
+ FreeAndNilTexture(CountTexz[i]);
CountTexz[i]:= Surface2Tex(tmpsurf, false);
SDL_FreeSurface(tmpsurf)
end;
@@ -579,7 +578,7 @@
var s: shortstring;
begin
str(Hedgehog.Gear^.Health, s);
-FreeTexture(Hedgehog.HealthTagTex);
+FreeAndNilTexture(Hedgehog.HealthTagTex);
Hedgehog.HealthTagTex:= RenderStringTex(ansistring(s), Hedgehog.Team^.Clan^.Color, fnt16)
end;
@@ -696,10 +695,7 @@
begin
// free the mem of any previously assigned texture. This was previously only if the new one could be loaded, but, NoHat is usually a better choice
if HH.HatTex <> nil then
- begin
- FreeTexture(HH.HatTex);
- HH.HatTex:= nil
- end;
+ FreeAndNilTexture(HH.HatTex);
// load new hat surface if this hat is different than the one already loaded
if newHat <> prevHat then
@@ -842,8 +838,7 @@
GameLoaded();
{$ENDIF}
WriteLnToConsole('Freeing progress surface... ');
- FreeTexture(ProgrTex);
- ProgrTex:= nil;
+ FreeAndNilTexture(ProgrTex);
Step:= 0
end;
@@ -981,7 +976,7 @@
end;
// free old texture
-FreeWeaponTooltip;
+FreeAndNilTexture(WeaponTooltipTex);
// image region
i:= LongInt(atype) - 1;
@@ -1021,13 +1016,6 @@
DrawTexture(x, y, WeaponTooltipTex)
end;
-procedure FreeWeaponTooltip;
-begin
-// free the existing texture (if there is any)
-FreeTexture(WeaponTooltipTex);
-WeaponTooltipTex:= nil
-end;
-
{$IFDEF USE_VIDEO_RECORDING}
{$IFDEF SDL2}
procedure InitOffscreenOpenGL;