Make add/delete consistent (this has bugged me for so long)
authornemo
Thu, 27 Jun 2013 14:01:43 -0400
changeset 9291 15f7bb217b66
parent 9289 6bc1df062f04
child 9293 873022596d15
Make add/delete consistent (this has bugged me for so long)
hedgewars/uCollisions.pas
hedgewars/uGears.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uScript.pas
hedgewars/uTeams.pas
--- a/hedgewars/uCollisions.pas	Thu Jun 27 15:51:20 2013 +0400
+++ b/hedgewars/uCollisions.pas	Thu Jun 27 14:01:43 2013 -0400
@@ -33,7 +33,7 @@
 procedure initModule;
 procedure freeModule;
 
-procedure AddGearCI(Gear: PGear);
+procedure AddCI(Gear: PGear);
 procedure DeleteCI(Gear: PGear);
 
 function  CheckGearsCollision(Gear: PGear): PGearArray;
@@ -72,7 +72,7 @@
     cinfos: array[0..MAXRECTSINDEX] of TCollisionEntry;
     ga: TGearArray;
 
-procedure AddGearCI(Gear: PGear);
+procedure AddCI(Gear: PGear);
 var t: PGear;
 begin
 if Gear^.CollisionIndex >= 0 then
--- a/hedgewars/uGears.pas	Thu Jun 27 15:51:20 2013 +0400
+++ b/hedgewars/uGears.pas	Thu Jun 27 14:01:43 2013 -0400
@@ -49,7 +49,7 @@
 
 implementation
 uses uStore, uSound, uTeams, uRandom, uIO, uLandGraphics, {$IFDEF SDL13}uTouch,{$ENDIF}
-    uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uVariables,
+    uLocale, uAmmos, uStats, uVisualGears, uScript, GLunit, uVariables,
     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
     uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlersRope
     , uVisualGearsList, uGearsHandlersMess;
--- a/hedgewars/uGearsHandlersMess.pas	Thu Jun 27 15:51:20 2013 +0400
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Jun 27 14:01:43 2013 -0400
@@ -1543,7 +1543,7 @@
         doStepFallingGear(Gear);
         if (Gear^.State and gstMoving) = 0 then
             begin
-            AddGearCI(Gear);
+            AddCI(Gear);
             Gear^.dX := _0;
             Gear^.dY := _0
             end;
@@ -1628,7 +1628,7 @@
             PlaySound(sndRopeAttach);
             Gear^.dX:= _0;
             Gear^.dY:= _0;
-            AddGearCI(Gear);
+            AddCI(Gear);
             end;
         end
     else
@@ -1727,7 +1727,7 @@
     else
         begin
         Gear^.State := Gear^.State or gsttmpFlag;
-        AddGearCI(Gear)
+        AddCI(Gear)
         end;
 
 (*
@@ -1743,7 +1743,7 @@
             else if (((y+1 and LAND_HEIGHT_MASK)) = 0) and (((x-(Gear^.Radius-2)) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x-(Gear^.Radius-2)] = 0) then
                 Gear^.dX:= _0_08;
             end;
-    if Gear^.dX.QWordValue = 0 then AddGearCI(Gear)
+    if Gear^.dX.QWordValue = 0 then AddCI(Gear)
     end; *)
 
     if not Gear^.dY.isNegative and (Gear^.dY < _0_001) and (TestCollisionYwithGear(Gear, 1) <> 0) then
@@ -1919,7 +1919,7 @@
         end;
 
     if (Gear^.dY.QWordValue = 0) then
-        AddGearCI(Gear)
+        AddCI(Gear)
     else if (Gear^.dY.QWordValue <> 0) then
         DeleteCI(Gear)
 end;
@@ -4932,7 +4932,7 @@
 
     if (Gear^.State and gstMoving) <> 0 then
         begin
-        AddGearCI(Gear);
+        AddCI(Gear);
         Gear^.dX:= _0;
         Gear^.dY:= _0;
         Gear^.State:= Gear^.State and (not gstMoving);
@@ -4943,7 +4943,7 @@
 
     if Gear^.Pos = 1 then
         begin
-        AddGearCI(Gear);
+        AddCI(Gear);
         AfterAttack;
         if Gear = CurAmmoGear then
             CurAmmoGear:= nil;
@@ -4960,7 +4960,7 @@
                 begin
                 DeleteCI(Gear);
                 Gear^.Y:= Gear^.Y - _0_5;
-                AddGearCI(Gear);
+                AddCI(Gear);
                 end;
             inc(Gear^.Timer);
             end;
@@ -4975,7 +4975,7 @@
                 begin
                 DeleteCI(Gear);
                 Gear^.Y:= Gear^.Y - _0_5;
-                AddGearCI(Gear);
+                AddCI(Gear);
                 end;
             inc(Gear^.Timer);
             end
@@ -5349,7 +5349,7 @@
                                 begin
                                 DeleteCI(iter);
                                 iter^.State:= iter^.State or gstFrozen;
-                                AddGearCI(iter)
+                                AddCI(iter)
                                 end
                             else // gtExplosives
                                 begin
@@ -5614,7 +5614,7 @@
         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
         Gear^.Health:= 0;
         Gear^.Timer:= 500;
-        AddGearCI(Gear)
+        AddCI(Gear)
         end
     else if GameTicks and $3F = 0 then
         begin
--- a/hedgewars/uGearsHedgehog.pas	Thu Jun 27 15:51:20 2013 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Thu Jun 27 14:01:43 2013 -0400
@@ -800,7 +800,7 @@
         MakeHedgehogsStep(Gear);
 
     SetAllHHToActive(false);
-    AddGearCI(Gear)
+    AddCI(Gear)
     end
 end;
 
@@ -1145,7 +1145,7 @@
 
     if ((HHGear^.State and (gstMoving or gstDrowning)) = 0) then
         begin
-        AddGearCI(HHGear);
+        AddCI(HHGear);
         if wasJumping then
             GHStepTicks:= 410
         else
@@ -1227,7 +1227,7 @@
         begin
         Gear^.State:= Gear^.State and (not (gstWait or gstLoser or gstWinner or gstAttacked or gstNotKickable or gstHHChooseTarget));
         if Gear^.Hedgehog^.Effects[heFrozen] = 0 then Gear^.Active:= false;
-        AddGearCI(Gear);
+        AddCI(Gear);
         exit
         end
     else dec(Gear^.Timer)
--- a/hedgewars/uScript.pas	Thu Jun 27 15:51:20 2013 +0400
+++ b/hedgewars/uScript.pas	Thu Jun 27 14:01:43 2013 -0400
@@ -1489,7 +1489,7 @@
             gear^.X:= int2hwfloat(x);
             gear^.Y:= int2hwfloat(y);
             if col then
-                AddGearCI(gear);
+                AddCI(gear);
             SetAllToActive
             end
         end;
--- a/hedgewars/uTeams.pas	Thu Jun 27 15:51:20 2013 +0400
+++ b/hedgewars/uTeams.pas	Thu Jun 27 14:01:43 2013 -0400
@@ -126,7 +126,7 @@
            DeleteCI(Gear);
            FindPlace(Gear, false, 0, LAND_WIDTH);
            if Gear <> nil then
-               AddGearCI(Gear)
+               AddCI(Gear)
            end
         end;
 
@@ -504,7 +504,7 @@
     HH^.GearHidden:= nil;
     InsertGearToList(HH^.Gear);
     HH^.Gear^.State:= (HH^.Gear^.State and (not (gstHHDriven or gstInvisible or gstAttacking))) or gstAttacked;
-    AddGearCI(HH^.Gear);
+    AddCI(HH^.Gear);
     HH^.Gear^.Active:= true;
     ScriptCall('onHogRestore', HH^.Gear^.Uid)
 end;
@@ -688,8 +688,8 @@
     CurrentHedgehog:= newHog;
    if (CurrentHedgehog <> nil) and (CurrentHedgehog^.CurAmmoType = amKnife) then
        LoadHedgehogHat(CurrentHedgehog^, 'Reserved/chef');
-    if oldCI then AddGearCI(oldHH^.Gear);
-    if newCI then AddGearCI(newHog^.Gear)
+    if oldCI then AddCI(oldHH^.Gear);
+    if newCI then AddCI(newHog^.Gear)
 end;