* make portals delete each other only indirectly (by setting timer to 0)
authorsheepluva
Sun, 16 May 2010 23:43:45 +0000
changeset 3468 c7b80bdbc384
parent 3467 14bed9d4ed91
child 3469 39e16d76d745
* make portals delete each other only indirectly (by setting timer to 0) * add VGSHandler.inc to CMakeLists.txt
hedgewars/CMakeLists.txt
hedgewars/GSHandlers.inc
--- a/hedgewars/CMakeLists.txt	Sun May 16 23:18:23 2010 +0000
+++ b/hedgewars/CMakeLists.txt	Sun May 16 23:43:45 2010 +0000
@@ -70,6 +70,7 @@
 	uWorld.pas
 	CCHandlers.inc
 	GSHandlers.inc
+	VGSHandlers.inc
 	GearDrawing.inc
 	HHHandlers.inc
 	SinTable.inc
--- a/hedgewars/GSHandlers.inc	Sun May 16 23:18:23 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun May 16 23:43:45 2010 +0000
@@ -3300,10 +3300,16 @@
                 // make the ball visible
             end;
 
-    if destroyGear then deleteGear(oldPortal);
+    if destroyGear then oldPortal^.Timer:= 0;
 end;
 
 begin
+    if (Gear^.Timer < 1) then
+    begin
+        deleteGear(Gear);
+        EXIT;
+    end;
+    
     doPortalColorSwitch();
 
     Gear^.X := Gear^.X + Gear^.dX;
@@ -3378,13 +3384,11 @@
             while iterator <> nil do
             begin
                 if (iterator^.Kind = gtPortal) then
-                    if (iterator <> newPortal) then
+                    if (iterator <> newPortal) and (iterator^.Timer > 0) then
                     begin
                         if (iterator^.Tag and 2) = (newPortal^.Tag and 2) then
                         begin
-                            iterator := iterator^.PrevGear;
-                            deleteGear(iterator^.NextGear);
-                            continue;
+                            iterator^.Timer:= 0;
                         end
                         else
                         begin