move RestoreHog from uGears to uTeams to break a circular dependency cmake_pascal
authorkoda
Tue, 19 Mar 2013 18:32:03 +0100
branchcmake_pascal
changeset 8817 0d3014097240
parent 8815 c28fcd8ec138
child 8819 8e25b820b360
move RestoreHog from uGears to uTeams to break a circular dependency
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
hedgewars/uTeams.pas
--- a/hedgewars/GSHandlers.inc	Tue Mar 19 18:02:06 2013 +0100
+++ b/hedgewars/GSHandlers.inc	Tue Mar 19 18:32:03 2013 +0100
@@ -132,17 +132,6 @@
     HH^.Gear:= nil
 end;
 
-procedure RestoreHog(HH: PHedgehog);
-begin
-    HH^.Gear:=HH^.GearHidden;
-    HH^.GearHidden:= nil;
-    InsertGearToList(HH^.Gear);
-    HH^.Gear^.State:= (HH^.Gear^.State and (not (gstHHDriven or gstInvisible or gstAttacking))) or gstAttacked;
-    AddGearCI(HH^.Gear);
-    HH^.Gear^.Active:= true;
-    ScriptCall('onHogRestore', HH^.Gear^.Uid)
-end;
-
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepDrowningGear(Gear: PGear);
--- a/hedgewars/uGears.pas	Tue Mar 19 18:02:06 2013 +0100
+++ b/hedgewars/uGears.pas	Tue Mar 19 18:32:03 2013 +0100
@@ -42,7 +42,6 @@
 function  GetAmmo(Hedgehog: PHedgehog): TAmmoType;
 function  GetUtility(Hedgehog: PHedgehog): TAmmoType;
 procedure HideHog(HH: PHedgehog);
-procedure RestoreHog(HH: PHedgehog);
 procedure ProcessGears;
 procedure EndTurnCleanup;
 procedure SetAllToActive;
--- a/hedgewars/uTeams.pas	Tue Mar 19 18:02:06 2013 +0100
+++ b/hedgewars/uTeams.pas	Tue Mar 19 18:32:03 2013 +0100
@@ -20,8 +20,8 @@
 
 unit uTeams;
 interface
-uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit,
-     uSound, uStore, uTypes
+uses uConsts, uInputHandler, uRandom, uFloat, uStats, uVisualGears,
+     uCollisions, GLunit, uSound, uStore, uTypes, uScript
      {$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF};
 
 
@@ -34,6 +34,8 @@
 procedure InitTeams;
 function  TeamSize(p: PTeam): Longword;
 procedure RecountTeamHealth(team: PTeam);
+procedure RestoreHog(HH: PHedgehog);
+
 procedure RestoreTeamsFromSave;
 function  CheckForWin: boolean;
 procedure TeamGoneEffect(var Team: TTeam);
@@ -482,6 +484,17 @@
 AddVisualGear(0, 0, vgtTeamHealthSorter)
 end;
 
+procedure RestoreHog(HH: PHedgehog);
+begin
+    HH^.Gear:=HH^.GearHidden;
+    HH^.GearHidden:= nil;
+    InsertGearToList(HH^.Gear);
+    HH^.Gear^.State:= (HH^.Gear^.State and (not (gstHHDriven or gstInvisible or gstAttacking))) or gstAttacked;
+    AddGearCI(HH^.Gear);
+    HH^.Gear^.Active:= true;
+    ScriptCall('onHogRestore', HH^.Gear^.Uid)
+end;
+
 procedure RestoreTeamsFromSave;
 var t: LongInt;
 begin