Fix health case/barrel health texture being sometimes not created
authorWuzzy <Wuzzy2@mail.ru>
Wed, 22 May 2019 10:45:35 +0200
changeset 15049 20c80919d97d
parent 15044 9a8c678df7d9
child 15050 09c63d4bcf53
Fix health case/barrel health texture being sometimes not created
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Tue May 21 16:45:16 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Wed May 22 10:45:35 2019 +0200
@@ -2401,7 +2401,7 @@
         doStepCase(Gear)
     else
         // health texture (FlightTime = health when the last texture was generated)
-        if Gear^.Health <> Gear^.FlightTime then
+        if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
             begin
             Gear^.FlightTime:= Gear^.Health;
             FreeAndNilTexture(Gear^.Tex);
@@ -2479,7 +2479,7 @@
         dec(Gear^.Health, Gear^.Damage);
         Gear^.Damage := 0;
         // health texture (FlightTime = health when the last texture was generated)
-        if Gear^.Health <> Gear^.FlightTime then
+        if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
             begin
             Gear^.FlightTime:= Gear^.Health;
             FreeAndNilTexture(Gear^.Tex);
@@ -2507,7 +2507,7 @@
                     i:= 1;
                 if i = 1 then
                     begin
-                    if Gear^.Health <> Gear^.FlightTime then
+                    if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
                         begin
                         Gear^.FlightTime:= Gear^.Health;
                         FreeAndNilTexture(Gear^.Tex);
@@ -2516,7 +2516,7 @@
                     end
                 else
                     begin
-                    if Gear^.FlightTime <> $ffffffff then
+                    if (Gear^.FlightTime <> $ffffffff) or (Gear^.Tex = nil) then
                         begin
                         Gear^.FlightTime:= $ffffffff;
                         FreeAndNilTexture(Gear^.Tex);