# HG changeset patch
# User sheepluva
# Date 1274053425 0
# Node ID c7b80bdbc3840895daad111fbd7436f82cc27172
# Parent  14bed9d4ed913dffb8cd25768b88f77f34eb0ea6
* make portals delete each other only indirectly (by setting timer to 0)
* add VGSHandler.inc to CMakeLists.txt

diff -r 14bed9d4ed91 -r c7b80bdbc384 hedgewars/CMakeLists.txt
--- 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
diff -r 14bed9d4ed91 -r c7b80bdbc384 hedgewars/GSHandlers.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