hedgewars/uGearsList.pas
changeset 7028 0f60591f3a16
parent 7010 10a0a31804f3
child 7069 bcf9d8e64e92
--- a/hedgewars/uGearsList.pas	Sat May 05 18:10:41 2012 +0100
+++ b/hedgewars/uGearsList.pas	Sat May 05 19:04:59 2012 +0100
@@ -33,6 +33,8 @@
     uTextures, uScript, uRenderUtils, uAI, uCollisions,
     uGearsRender, uGearsUtils;
 
+var GCounter: LongWord = 0; // this doesn't 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;