hedgewars/GSHandlers.inc
changeset 3480 c4c3f3512404
parent 3476 1ec68b8d3bd1
child 3483 54ff8cbabaa6
--- a/hedgewars/GSHandlers.inc	Sun May 23 22:05:59 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun May 23 23:51:54 2010 +0000
@@ -3201,7 +3201,7 @@
         // end of list
 
         // don't port portals or other gear that wouldn't make sense
-        if (iterator^.Kind = gtPortal) or (iterator^.Kind = gtRope) then
+        if (iterator^.Kind = gtPortal) or (iterator^.Kind = gtRope) or (iterator^.PortalCounter > 20) then
             continue;
 
         // don't port hogs on rope
@@ -3247,6 +3247,9 @@
         iterator^.State := iterator^.State or gstMoving;
         DeleteCI(iterator);
 
+        // Until loops are reliably broken
+        inc(iterator^.PortalCounter);
+
         // TODO: more accurate porting
         cdxy := Distance(conPortal^.dX, conPortal^.dY);
         s := (Int2hwFloat(Gear^.Radius)) / cdxy;
@@ -3407,6 +3410,7 @@
                             iterator^.Health := newPortal^.Health;
                         end;
                     end;
+                iterator^.PortalCounter:= 0;
                 iterator := iterator^.NextGear
             end;
         end;