hedgewars/uCollisions.pas
changeset 15678 c34cad72cd85
parent 15677 116307c752f6
child 15696 f5b127ee3196
--- a/hedgewars/uCollisions.pas	Tue Jun 30 00:58:24 2020 +0300
+++ b/hedgewars/uCollisions.pas	Tue Jun 30 02:18:54 2020 +0300
@@ -71,6 +71,7 @@
 function  CheckAllGearsLineCollision(SourceGear: PGear; oX, oY, tX, tY: hwFloat): PGearArray;
 
 function  UpdateHitOrder(Gear: PGear; Order: LongInt): boolean; inline;
+function  UpdateHitOrder(Gear: PGear; Order: LongInt; Global: boolean): boolean; inline;
 function  UpdateGlobalHitOrder(Gear: PGear; Order: LongInt): boolean; inline;
 procedure ClearHitOrderLeq(MinOrder: LongInt); inline;
 procedure ClearGlobalHitOrderLeq(MinOrder: LongInt); inline;
@@ -371,6 +372,14 @@
     UpdateHitOrder := UpdateHitOrderImpl(@ordera, Gear, Order);
 end;
 
+function UpdateHitOrder(Gear: PGear; Order: LongInt; Global: boolean): boolean; inline;
+begin
+    if Global then
+        UpdateHitOrder := UpdateHitOrderImpl(@ordera, Gear, Order)
+    else
+        UpdateHitOrder := UpdateHitOrderImpl(@globalordera, Gear, Order)
+end;
+
 function UpdateGlobalHitOrder(Gear: PGear; Order: LongInt): boolean; inline;
 begin
     UpdateGlobalHitOrder := UpdateHitOrderImpl(@globalordera, Gear, Order);
@@ -382,7 +391,7 @@
     freeIndex:= 0;
     i:= 0;
 
-    while i < ordera.Count do
+    while i < HitOrder^.Count do
     begin
         if HitOrder^.order[i] <= MinOrder then
             Dec(HitOrder^.Count)