hedgewars/uTeams.pas
branchcmake_pascal
changeset 8817 0d3014097240
parent 8681 d0fc1dca739c
child 9224 bce8cf41d666
--- 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