hedgewars/uGearsList.pas
changeset 7110 c91d33837b0d
parent 7093 2d7f1fb73335
child 7168 8defaabce92e
--- a/hedgewars/uGearsList.pas	Thu May 03 22:48:02 2012 +0200
+++ b/hedgewars/uGearsList.pas	Tue May 22 11:19:32 2012 +0200
@@ -33,6 +33,8 @@
     uTextures, uScript, uRenderUtils, uAI, uCollisions,
     uGearsRender, uGearsUtils;
 
+var GCounter: LongWord = 0; // this does not get re-initialized, but should be harmless
+
 procedure InsertGearToList(Gear: PGear);
 var tmp, ptmp: PGear;
 begin
@@ -74,8 +76,8 @@
 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
 var gear: PGear;
 begin
-inc(Counter);
-AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
+inc(GCounter);
+AddFileLog('AddGear: #' + inttostr(GCounter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
 
 New(gear);
 FillChar(gear^, sizeof(TGear), 0);
@@ -91,7 +93,7 @@
 gear^.CollisionIndex:= -1;
 gear^.Timer:= Timer;
 gear^.FlightTime:= 0;
-gear^.uid:= Counter;
+gear^.uid:= GCounter;
 gear^.SoundChannel:= -1;
 gear^.ImpactSound:= sndNone;
 gear^.nImpactSounds:= 0;
@@ -148,7 +150,7 @@
                 gear^.Z:= cHHZ;
                 if (GameFlags and gfAISurvival) <> 0 then
                     if gear^.Hedgehog^.BotLevel > 0 then
-                        gear^.Hedgehog^.Effects[heResurrectable] := 0;
+                        gear^.Hedgehog^.Effects[heResurrectable] := 1;
                 end;
        gtShell: begin
                 gear^.Radius:= 4;
@@ -168,7 +170,7 @@
                     begin
                     Pos:= 0;
                     Radius:= 1;
-                    DirAngle:= random * 360;
+                    DirAngle:= random(360);
                     if State and gstTmpFlag = 0 then
                         begin
                         dx.isNegative:= GetRandom(2) = 0;
@@ -455,6 +457,7 @@
                 gear^.Tag:= TotalRounds + 3;
                 gear^.Pos:= 1;
                 end;
+      gtIceGun: gear^.Health:= 1000;
     end;
 
 InsertGearToList(gear);