hedgewars/uScript.pas
changeset 14755 ab7bf5036314
parent 14650 9e7092e5990a
child 14759 b39da9cf7616
--- a/hedgewars/uScript.pas	Sun Apr 07 18:21:14 2019 +0200
+++ b/hedgewars/uScript.pas	Sun Apr 07 19:26:16 2019 +0200
@@ -1907,7 +1907,12 @@
     if CheckLuaParamCount(L, 2, 'SetTimer', 'gearUid, timer') then
         begin
         gear:= GearByUID(Trunc(lua_tonumber(L, 1)));
-        if gear <> nil then gear^.Timer:= Trunc(lua_tonumber(L, 2))
+        if gear <> nil then
+            begin
+            gear^.Timer:= Trunc(lua_tonumber(L, 2));
+            if gear^.RenderTimer and (gear^.Tex <> nil) then
+                FreeAndNilTexture(gear^.Tex);
+            end;
         end;
     lc_settimer:= 0
 end;