More verbose gear delete debuglog message
authorunc0rr
Fri, 14 Nov 2008 16:44:39 +0000
changeset 1495 2b2b89bdb5f3
parent 1494 6e6baf165e0c
child 1496 bc2a166b4fd2
More verbose gear delete debuglog message
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
hedgewars/uTeams.pas
--- a/hedgewars/GSHandlers.inc	Tue Nov 11 15:44:27 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Fri Nov 14 16:44:39 2008 +0000
@@ -232,8 +232,11 @@
 
 procedure doStepHealthTagWorkUnderWater(Gear: PGear);
 begin
-AllInactive:= false;
+if Gear^.Kind = gtHealthTag then
+	AllInactive:= false;
+
 Gear^.Y:= Gear^.Y - _0_08;
+
 if hwRound(Gear^.Y) < cWaterLine + 10 then
    DeleteGear(Gear)
 end;
--- a/hedgewars/uGears.pas	Tue Nov 11 15:44:27 2008 +0000
+++ b/hedgewars/uGears.pas	Fri Nov 14 16:44:39 2008 +0000
@@ -184,9 +184,11 @@
 var Result: PGear;
 begin
 inc(Counter);
-{$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+'), d('+floattostr(dX)+','+floattostr(dY)+')');{$ENDIF}
+{$IFDEF DEBUGFILE}
+AddFileLog('AddGear: (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind)));
+{$ENDIF}
+
 New(Result);
-{$IFDEF DEBUGFILE}AddFileLog('AddGear: type = ' + inttostr(ord(Kind)));{$ENDIF}
 FillChar(Result^, sizeof(TGear), 0);
 Result^.X:= int2hwFloat(X);
 Result^.Y:= int2hwFloat(Y);
@@ -350,34 +352,39 @@
 DeleteCI(Gear);
 
 if Gear^.Tex <> nil then
-   begin
-   FreeTexture(Gear^.Tex);
-   Gear^.Tex:= nil
-   end;
+	begin
+	FreeTexture(Gear^.Tex);
+	Gear^.Tex:= nil
+	end;
 
 if Gear^.Kind = gtHedgehog then
-   if CurAmmoGear <> nil then
-      begin
-      Gear^.Message:= gm_Destroy;
-      CurAmmoGear^.Message:= gm_Destroy;
-      exit
-      end else
-      begin
-      if not (hwRound(Gear^.Y) < cWaterLine) then
-         begin
-         t:= max(Gear^.Damage, Gear^.Health);
-         Gear^.Damage:= t;
-         AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
-         uStats.HedgehogDamaged(Gear)
-         end;
-      team:= PHedgehog(Gear^.Hedgehog)^.Team;
-      if CurrentHedgehog^.Gear = Gear then
-         FreeActionsList; // to avoid ThinkThread on drawned gear
-      PHedgehog(Gear^.Hedgehog)^.Gear:= nil;
-      inc(KilledHHs);
-      RecountTeamHealth(team);
-      end;
-{$IFDEF DEBUGFILE}AddFileLog('DeleteGear');{$ENDIF}
+	if CurAmmoGear <> nil then
+		begin
+		Gear^.Message:= gm_Destroy;
+		CurAmmoGear^.Message:= gm_Destroy;
+		exit
+		end
+	else
+		begin
+		if not (hwRound(Gear^.Y) < cWaterLine) then
+			begin
+			t:= max(Gear^.Damage, Gear^.Health);
+			Gear^.Damage:= t;
+			AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
+			uStats.HedgehogDamaged(Gear)
+			end;
+		team:= PHedgehog(Gear^.Hedgehog)^.Team;
+		if CurrentHedgehog^.Gear = Gear then
+			FreeActionsList; // to avoid ThinkThread on drawned gear
+		PHedgehog(Gear^.Hedgehog)^.Gear:= nil;
+		inc(KilledHHs);
+		RecountTeamHealth(team);
+		end;
+
+{$IFDEF DEBUGFILE}
+with Gear^ do AddFileLog('Delete: (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind)));
+{$ENDIF}
+
 if Gear^.TriggerId <> 0 then TickTrigger(Gear^.TriggerId);
 if CurAmmoGear = Gear then CurAmmoGear:= nil;
 if FollowGear = Gear then FollowGear:= nil;
@@ -434,19 +441,20 @@
 procedure AddDamageTag(X, Y, Damage: LongWord; Gear: PGear);
 begin
 if cAltDamage then
-   AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
+	AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
 end;
 
 procedure ProcessGears;
 const delay: LongWord = 0;
-      step: (stDelay, stChDmg, stTurnReact,
-             stAfterDelay, stChWin, stWater, stChWin2, stHealth,
-             stSpawn, stNTurn) = stDelay;
+	step: (stDelay, stChDmg, stTurnReact,
+			stAfterDelay, stChWin, stWater, stChWin2, stHealth,
+			stSpawn, stNTurn) = stDelay;
 
 var Gear, t: PGear;
 begin
 PrvInactive:= AllInactive;
 AllInactive:= true;
+
 t:= GearsList;
 while t <> nil do
 	begin
--- a/hedgewars/uTeams.pas	Tue Nov 11 15:44:27 2008 +0000
+++ b/hedgewars/uTeams.pas	Fri Nov 14 16:44:39 2008 +0000
@@ -368,7 +368,7 @@
 
 with TeamsArray[t]^ do
 	begin
-	AddChatString('* '+ TeamName + ' is gone');
+	AddChatString('** '+ TeamName + ' is gone');
 	for i:= 0 to cMaxHHIndex do
 		with Hedgehogs[i] do
 			if Gear <> nil then