hedgewars/uWorld.pas
changeset 3516 a8c673657b79
parent 3513 f589230fa21b
child 3523 6592fbb969da
--- a/hedgewars/uWorld.pas	Thu Jun 17 16:28:42 2010 +0200
+++ b/hedgewars/uWorld.pas	Fri Jun 18 14:45:05 2010 +0200
@@ -872,7 +872,10 @@
    if t < 10 then s:= '0' + s;
    s:= inttostr(i div 60) + ':' + s;
    
-   if timeTexture <> nil then FreeTexture(timeTexture);
+   if timeTexture <> nil then
+        FreeTexture(timeTexture);
+    timeTexture:= nil;
+    
    tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
    tmpSurface:= doSurfaceConversion(tmpSurface);
    timeTexture:= Surface2Tex(tmpSurface, false);
@@ -890,7 +893,9 @@
       Frames:= 0;
       CountTicks:= 0;
       s:= inttostr(FPS) + ' fps';
-      if fpsTexture <> nil then FreeTexture(fpsTexture);
+      if fpsTexture <> nil then
+        FreeTexture(fpsTexture);
+    fpsTexture:= nil;
       tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
       tmpSurface:= doSurfaceConversion(tmpSurface);
       fpsTexture:= Surface2Tex(tmpSurface, false);
@@ -981,14 +986,16 @@
 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
 begin
 //if Group in [capgrpGameState] then WriteLnToConsole(s);
-if Captions[Group].Tex <> nil then FreeTexture(Captions[Group].Tex);
-
-Captions[Group].Tex:= RenderStringTex(s, Color, fntBig);
+    if Captions[Group].Tex <> nil then 
+        FreeTexture(Captions[Group].Tex);
+    Captions[Group].Tex:= nil;
 
-case Group of
-    capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200
+    Captions[Group].Tex:= RenderStringTex(s, Color, fntBig);
+
+    case Group of
+        capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200
     else
-    Captions[Group].EndTime:= RealTicks + 1400 + LongWord(Captions[Group].Tex^.w) * 3;
+        Captions[Group].EndTime:= RealTicks + 1400 + LongWord(Captions[Group].Tex^.w) * 3;
     end;
 end;
 
@@ -1096,7 +1103,9 @@
 
 if time = 0 then time:= 5000;
 missionTimer:= time;
-if missionTex <> nil then FreeTexture(missionTex);
+if missionTex <> nil then 
+    FreeTexture(missionTex);
+missionTex:= nil;
 
 if icon > -1 then
     begin