hedgewars/uTeams.pas
changeset 9224 bce8cf41d666
parent 9157 2f8b60b89121
parent 8817 0d3014097240
child 9236 ddd675825672
child 9283 76e68c136a11
--- a/hedgewars/uTeams.pas	Thu Jun 13 22:04:22 2013 +0200
+++ b/hedgewars/uTeams.pas	Thu Jun 13 22:27:23 2013 +0200
@@ -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);
@@ -496,6 +498,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