Skip checkin on collision for frequently spammed gear types if collision gets huge instead of trying to delete mines.
authornemo
Tue, 25 Nov 2014 16:46:44 -0500
changeset 10551 4eefc711309e
parent 10550 825991c25319
child 10552 15d1e24a8c72
Skip checkin on collision for frequently spammed gear types if collision gets huge instead of trying to delete mines.
hedgewars/uCollisions.pas
--- a/hedgewars/uCollisions.pas	Tue Nov 25 15:20:06 2014 +0100
+++ b/hedgewars/uCollisions.pas	Tue Nov 25 16:46:44 2014 -0500
@@ -75,9 +75,9 @@
     ga: TGearArray;
 
 procedure AddCI(Gear: PGear);
-var t: PGear;
 begin
-if Gear^.CollisionIndex >= 0 then
+if (Gear^.CollisionIndex >= 0) or 
+    ((Count > MAXRECTSINDEX-200) and ((Gear^.Kind = gtMine) or (Gear^.Kind = gtSMine) or (Gear^.Kind = gtKnife))) then
     exit;
 TryDo(Count <= MAXRECTSINDEX, 'Collision rects array overflow', true);
 with cinfos[Count] do
@@ -90,15 +90,6 @@
     end;
 Gear^.CollisionIndex:= Count;
 inc(Count);
-// mines are the easiest way to overflow collision
-if (Count > (MAXRECTSINDEX-20)) then
-    begin
-    t:= GearsList;
-    while (t <> nil) and (t^.Kind <> gtMine) do
-        t:= t^.NextGear;
-    if (t <> nil) then
-        t^.State:= t^.State or gmDelete
-    end;
 end;
 
 procedure DeleteCI(Gear: PGear);