# HG changeset patch
# User unC0Rr
# Date 1603363824 -7200
# Node ID 72f735c03feca4783a3f6b1802a64e4b497f4ec7
# Parent  f09db263bc2aa9cc522dda0134650b8201b3ef4a
Fix some problems caught by C compiler

diff -r f09db263bc2a -r 72f735c03fec hedgewars/uAIMisc.pas
--- a/hedgewars/uAIMisc.pas	Thu Oct 22 12:33:35 2020 +0200
+++ b/hedgewars/uAIMisc.pas	Thu Oct 22 12:50:24 2020 +0200
@@ -891,6 +891,7 @@
 meX:= Me^.X;
 meY:= Me^.Y;
 rate:= 0;
+hadSkips:= false;
 for i:= 0 to Targets.Count do
     if not Targets.ar[i].dead then
         with Targets.ar[i] do
@@ -975,6 +976,7 @@
 meX:= Me^.X;
 meY:= Me^.Y;
 rate:= 0;
+hadSkips:= false;
 for i:= 0 to Targets.Count do
     if (Targets.ar[i].Kind = gtGrave) and (not Targets.ar[i].dead) then
         with Targets.ar[i] do
diff -r f09db263bc2a -r 72f735c03fec hedgewars/uFloat.pas
--- a/hedgewars/uFloat.pas	Thu Oct 22 12:33:35 2020 +0200
+++ b/hedgewars/uFloat.pas	Thu Oct 22 12:50:24 2020 +0200
@@ -371,8 +371,8 @@
 
 function hwSqrt1(const t: hwFloat): hwFloat;
 const pwr = 8; // even value, feel free to adjust
-      rThreshold: QWord = 1 shl (pwr + 32);
-      lThreshold: QWord = 1 shl (pwr div 2 + 32);
+      rThreshold: QWord = QWord(1) shl (pwr + 32);
+      lThreshold: QWord = QWord(1) shl (pwr div 2 + 32);
 var l, r: QWord;
     c: hwFloat;
 begin
diff -r f09db263bc2a -r 72f735c03fec hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Thu Oct 22 12:33:35 2020 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Oct 22 12:50:24 2020 +0200
@@ -3233,6 +3233,8 @@
 begin
     AllInactive := false;
 
+    HHGear:= nil;
+
     if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then
         HHGear:= Gear^.Hedgehog^.Gear;
 
diff -r f09db263bc2a -r 72f735c03fec hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsUtils.pas	Thu Oct 22 12:33:35 2020 +0200
+++ b/hedgewars/uGearsUtils.pas	Thu Oct 22 12:50:24 2020 +0200
@@ -1903,9 +1903,10 @@
 function HomingWrap(var Gear: PGear): boolean;
 var dist_center, dist_right, dist_left: hwFloat;
 begin
+    HomingWrap:= false;
+
     if WorldEdge = weWrap then
         begin
-        HomingWrap:= false;
         // We just check the same target 3 times:
         // 1) in current section (no change)
         // 2) clone in the right section
diff -r f09db263bc2a -r 72f735c03fec hedgewars/uRenderUtils.pas
--- a/hedgewars/uRenderUtils.pas	Thu Oct 22 12:33:35 2020 +0200
+++ b/hedgewars/uRenderUtils.pas	Thu Oct 22 12:50:24 2020 +0200
@@ -115,7 +115,7 @@
     finalRect.x:= X + cFontBorder + cFontPadding;
     finalRect.y:= Y + cFontBorder;
     if SDLCheck(tmpsurf <> nil, 'TTF_RenderUTF8_Blended', true) then
-        exit;
+        exit(finalRect);
     SDL_UpperBlit(tmpsurf, @textRect, Surface, @finalRect);
     SDL_FreeSurface(tmpsurf);
     finalRect.x:= X;
diff -r f09db263bc2a -r 72f735c03fec hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Thu Oct 22 12:33:35 2020 +0200
+++ b/hedgewars/uStore.pas	Thu Oct 22 12:50:24 2020 +0200
@@ -116,7 +116,7 @@
 clr.b:= Color and $FF;
 clr.a:= $FF;
 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, s, clr);
-if tmpsurf = nil then exit;
+if tmpsurf = nil then exit(finalRect);
 tmpsurf:= doSurfaceConversion(tmpsurf);
 
 if tmpsurf <> nil then