hedgewars/uTeams.pas
branchwebgl
changeset 9236 ddd675825672
parent 9160 fc46e75f6b72
parent 9224 bce8cf41d666
child 9521 8054d9d775fd
--- a/hedgewars/uTeams.pas	Mon Jun 17 22:54:17 2013 +0200
+++ b/hedgewars/uTeams.pas	Mon Jun 17 23:10:45 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