--- a/hedgewars/GSHandlers.inc Tue May 04 00:44:32 2010 +0000
+++ b/hedgewars/GSHandlers.inc Tue May 04 02:34:23 2010 +0000
@@ -3052,11 +3052,12 @@
iterator:= GearsList;
while iterator <> nil do
begin
- if (iterator^.Kind <> gtPortal) then
+ if (iterator^.Kind <> gtPortal) and (iterator^.PortedCounter < 20) then
if (((iterator^.State and gstMoving) <> 0) or (Gear^.IntersectGear^.dY.isNegative and not Gear^.dY.isNegative))
and (hwRound(Distance(Gear^.X-iterator^.X,Gear^.Y-iterator^.Y)) < iterator^.Radius+Gear^.Radius) then // Let's check this one more closely
if (Gear^.dX*iterator^.dX + Gear^.dY*iterator^.dY).isNegative then // make sure object moves towards the portal
begin
+ inc(iterator^.PortedCounter);
s:= (_1+(Int2hwFloat(Gear^.Radius))) / Distance(Gear^.IntersectGear^.dX, Gear^.IntersectGear^.dY);
iterator^.X:= Gear^.IntersectGear^.X + s * Gear^.IntersectGear^.dX;
iterator^.Y:= Gear^.IntersectGear^.Y + s * Gear^.IntersectGear^.dY;
--- a/hedgewars/HHHandlers.inc Tue May 04 00:44:32 2010 +0000
+++ b/hedgewars/HHHandlers.inc Tue May 04 02:34:23 2010 +0000
@@ -163,6 +163,7 @@
portal:= nil;
while iterator <> nil do
begin
+ iterator^.PortedCounter:= 0;
if (iterator^.Kind = gtPortal) then
begin
newGear:= iterator;
--- a/hedgewars/uGears.pas Tue May 04 00:44:32 2010 +0000
+++ b/hedgewars/uGears.pas Tue May 04 02:34:23 2010 +0000
@@ -60,7 +60,8 @@
uid: Longword;
ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
nImpactSounds: Word; // count of ImpactSounds
- SoundChannel: LongInt
+ SoundChannel: LongInt;
+ PortedCounter: LongWord // TEMPORARY. To break portal loops pending handling it w/ something a bit saner.
end;
var AllInactive: boolean;
@@ -858,6 +859,7 @@
tmpGear:= nil;
while iterator <> nil do
begin
+ iterator^.PortedCounter:= 0;
if (iterator^.Kind = gtPortal) then
begin
tmpGear:= iterator;