hedgewars/uCaptions.pas
changeset 10634 35d059bd0932
parent 10124 aabd1b75d5a3
child 11046 47a8c19ecb60
--- a/hedgewars/uCaptions.pas	Sun Dec 07 14:36:28 2014 -0500
+++ b/hedgewars/uCaptions.pas	Mon Dec 08 09:35:14 2014 -0500
@@ -48,10 +48,7 @@
     if Length(s) = 0 then
         exit;
     if Captions[Group].Text <> s then
-        begin
-        FreeTexture(Captions[Group].Tex);
-        Captions[Group].Tex:= nil
-        end;
+        FreeAndNilTexture(Captions[Group].Tex);
 
     if Captions[Group].Tex = nil then
         begin
@@ -73,7 +70,7 @@
 begin
 for Group:= Low(TCapGroup) to High(TCapGroup) do
     if unload then
-        FreeTexture(Captions[Group].Tex)
+        FreeAndNilTexture(Captions[Group].Tex)
     else if length(Captions[Group].Text) > 0 then
         Captions[Group].Tex:= RenderStringTex(Captions[Group].Text, Captions[Group].Color, fntBig)
 end;
@@ -97,8 +94,7 @@
                 inc(offset, Tex^.h + 2);
                 if EndTime <= RealTicks then
                     begin
-                    FreeTexture(Tex);
-                    Tex:= nil;
+                    FreeAndNilTexture(Tex);
                     Text:= ansistring('');
                     EndTime:= 0
                     end;
@@ -114,10 +110,7 @@
 var group: TCapGroup;
 begin
     for group:= Low(TCapGroup) to High(TCapGroup) do
-        begin
-        FreeTexture(Captions[group].Tex);
-        Captions[group].Tex:= nil
-        end
+        FreeAndNilTexture(Captions[group].Tex);
 end;
 
 end.