hedgewars/uGearsHedgehog.pas
changeset 10577 5e075da5e0a4
parent 10443 42dadeb6e8ae
child 10579 2effda40c3b2
--- a/hedgewars/uGearsHedgehog.pas	Sat Nov 29 18:14:49 2014 +0100
+++ b/hedgewars/uGearsHedgehog.pas	Sat Nov 29 18:56:42 2014 +0100
@@ -863,6 +863,14 @@
 var isFalling, isUnderwater: boolean;
     land: Word;
 begin
+if Gear^.Hedgehog^.Unplaced then
+    begin
+    Gear^.dY:= _0;
+    Gear^.dX:= _0;
+    Gear^.State:= Gear^.State and (not gstMoving);
+    exit
+    end;
+
 land:= 0;
 isUnderwater:= CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + Gear^.Radius);
 if Gear^.dX.QWordValue > 8160437862 then
@@ -870,13 +878,6 @@
 if Gear^.dY.QWordValue > 8160437862 then
     Gear^.dY.QWordValue:= 8160437862;
 
-if Gear^.Hedgehog^.Unplaced then
-    begin
-    Gear^.dY:= _0;
-    Gear^.dX:= _0;
-    Gear^.State:= Gear^.State and (not gstMoving);
-    exit
-    end;
 isFalling:= (Gear^.dY.isNegative) or (TestCollisionYKick(Gear, 1) = 0);
 if isFalling then
     begin
@@ -1359,7 +1360,9 @@
 procedure doStepHedgehog(Gear: PGear);
 var tX: hwFloat;
 begin
-CheckGearDrowning(Gear);
+// it might make sense to skip more than just drowning check here
+if (not Gear^.Hedgehog^.Unplaced) then
+    CheckGearDrowning(Gear);
 if Gear = nil then exit;
 tX:= Gear^.X;
 if WorldWrap(Gear) then