Explain a bug. Fix should be kinda trivial, but I have no time now to fix and test.
authorunc0rr
Thu, 06 May 2010 18:01:04 +0000
changeset 3437 858105ae769c
parent 3436 288fcbdb77b6
child 3438 670324167e42
Explain a bug. Fix should be kinda trivial, but I have no time now to fix and test.
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Thu May 06 17:53:37 2010 +0000
+++ b/hedgewars/uGears.pas	Thu May 06 18:01:04 2010 +0000
@@ -192,9 +192,9 @@
 procedure InsertGearToList(Gear: PGear);
 var tmp, ptmp: PGear;
 begin
-if GearsList = nil then
-    GearsList:= Gear
-    else begin
+// this thing is broken, and the bug explains why you sometimes see grenade stuck in hog not behind hedgehog sprite
+// when there's only one gear in list, the next one is inserted right after it disregarding its Z value
+// TODO: fix the bug
     tmp:= GearsList;
     ptmp:= GearsList;
     while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do
@@ -210,8 +210,8 @@
         if ptmp^.NextGear <> nil then ptmp^.NextGear^.PrevGear:= Gear;
         ptmp^.NextGear:= Gear
         end
-    else GearsList:= Gear
-    end
+    else 
+        GearsList:= Gear
 end;
 
 procedure RemoveGearFromList(Gear: PGear);