Add kill counter to Survival Mode -Burp
authortiyuri@gmail.com
Thu, 26 Aug 2010 14:02:48 +0100
changeset 3770 f54e8cb9a12b
parent 3769 bb9ecd0346d8
child 3771 23f4183ba605
Add kill counter to Survival Mode -Burp
hedgewars/uGears.pas
hedgewars/uStats.pas
hedgewars/uTeams.pas
hedgewars/uWorld.pas
--- a/hedgewars/uGears.pas	Thu Aug 26 06:06:28 2010 -0400
+++ b/hedgewars/uGears.pas	Thu Aug 26 14:02:48 2010 +0100
@@ -1549,7 +1549,8 @@
     gear^.dX := _0;
     gear^.dY := _0;
     gear^.State := gstWait;
-    FindPlace(Gear, false, 0, LAND_WIDTH); 
+    inc(CurrentHedgehog^.Team^.stats.AIKills);
+    FindPlace(gear, false, 0, LAND_WIDTH); 
     RenderHealth(PHedgehog(gear^.Hedgehog)^);
     RecountTeamHealth(PHedgehog(gear^.Hedgehog)^.Team);
     ScriptCall('onResurrect', gear^.uid);
--- a/hedgewars/uStats.pas	Thu Aug 26 06:06:28 2010 -0400
+++ b/hedgewars/uStats.pas	Thu Aug 26 14:02:48 2010 +0100
@@ -32,8 +32,13 @@
                    MaxStepDamageGiven,
                    MaxStepKills: Longword;
                    FinishedTurns: Longword;
+                   AIKills : LongInt;
                    end;
 
+type TTeamStats = record
+    AIKills : LongInt;
+end;
+
 var TotalRounds: LongInt;
     FinishedTurnsTotal: LongInt;
 
--- a/hedgewars/uTeams.pas	Thu Aug 26 06:06:28 2010 -0400
+++ b/hedgewars/uTeams.pas	Thu Aug 26 14:02:48 2010 +0100
@@ -76,6 +76,7 @@
             hasGone: boolean;
             voicepack: PVoicepack;
             PlayerHash: shortstring;   // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players
+            stats: TTeamStats;
             end;
 
     TClan = record
--- a/hedgewars/uWorld.pas	Thu Aug 26 06:06:28 2010 -0400
+++ b/hedgewars/uWorld.pas	Thu Aug 26 14:02:48 2010 +0100
@@ -778,6 +778,13 @@
       inc(r.x, cTeamHealthWidth + 2);
       r.w:= 3;
       DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY, @r, HealthTex);
+
+      // draw ai kill counter for gfAISurvival
+      if (GameFlags and gfAISurvival) <> 0 then begin
+          DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY,
+              RenderStringTex(''+inttostr(stats.AIKills)+'', Clan^.Color, fnt16));
+      end;
+
       // if highlighted, draw flag and other contents again to keep their colors
       // this approach should be faster than drawing all borders one by one tinted or not
       if highlight then