# HG changeset patch
# User unc0rr
# Date 1209070415 0
# Node ID daddcd31ef34c148ddb9d3b4c8df927c6d19aeb7
# Parent 4884bce5e5eb8c909ded785b4a1fdded87ababb3
- New statistics
- Fixes for stats
diff -r 4884bce5e5eb -r daddcd31ef34 QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp Thu Apr 24 19:55:10 2008 +0000
+++ b/QTfrontend/hwform.cpp Thu Apr 24 20:53:35 2008 +0000
@@ -578,6 +578,13 @@
AddStatText(message);
break;
}
+ case 'k' : {
+ int i = info.indexOf(' ');
+ QString message = QLabel::tr("
The best shot award was won by %1 with %2 kills.
")
+ .arg(info.mid(i + 1), info.left(i));
+ AddStatText(message);
+ break;
+ }
case 'K' : {
QString message = QLabel::tr("A total of %1 Hedgehog(s) were killed during this round.
").arg(info);
AddStatText(message);
diff -r 4884bce5e5eb -r daddcd31ef34 hedgewars.kdevelop
--- a/hedgewars.kdevelop Thu Apr 24 19:55:10 2008 +0000
+++ b/hedgewars.kdevelop Thu Apr 24 20:53:35 2008 +0000
@@ -18,20 +18,20 @@
hedgewars
.
false
-
+
kdevsubversion
-
+
executable
/
- bin/hedgewars
-
+
+
false
true
-
+
/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GNA
false
false
@@ -98,16 +98,16 @@
make
-
+
true
- 1
+ 4
0
false
-
-
-
+
+
+
default
@@ -115,9 +115,9 @@
0
-
-
-
+
+
+
default
@@ -126,12 +126,12 @@
-
+
-
-
-
-
+
+
+
+
true
false
false
@@ -237,7 +237,7 @@
false
-
+
set
m_,_
theValue
@@ -256,7 +256,7 @@
false
-
+
true
false
@@ -269,9 +269,9 @@
-
-
-
+
+
+
diff -r 4884bce5e5eb -r daddcd31ef34 hedgewars/uConsts.pas
--- a/hedgewars/uConsts.pas Thu Apr 24 19:55:10 2008 +0000
+++ b/hedgewars/uConsts.pas Thu Apr 24 20:53:35 2008 +0000
@@ -74,7 +74,7 @@
TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpNetSay, capgrpVolume);
- TStatInfoType = (siGameResult, siMaxStepDamage, siKilledHHs);
+ TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs);
THHFont = record
Handle: PTTF_Font;
diff -r 4884bce5e5eb -r daddcd31ef34 hedgewars/uGears.pas
--- a/hedgewars/uGears.pas Thu Apr 24 19:55:10 2008 +0000
+++ b/hedgewars/uGears.pas Thu Apr 24 20:53:35 2008 +0000
@@ -384,8 +384,8 @@
procedure ProcessGears;
const delay: LongWord = 0;
- step: (stDelay, stChDmg, stChWin, stTurnReact,
- stAfterDelay, stSpawn, stNTurn) = stDelay;
+ step: (stDelay, stChDmg, stTurnReact,
+ stAfterDelay, stChWin, stSpawn, stNTurn) = stDelay;
var Gear, t: PGear;
begin
PrvInactive:= AllInactive;
@@ -410,7 +410,6 @@
inc(step)
end;
stChDmg: if CheckNoDamage then inc(step) else step:= stDelay;
- stChWin: if not CheckForWin then inc(step) else step:= stDelay;
stTurnReact: begin
if not isInMultiShoot then
begin
@@ -428,12 +427,12 @@
if delay = 0 then
inc(step)
end;
+ stChWin: if not CheckForWin then inc(step) else step:= stDelay;
stSpawn: begin
if not isInMultiShoot then SpawnBoxOfSmth;
inc(step)
end;
stNTurn: begin
- //AwareOfExplosion(0, 0, 0);
if isInMultiShoot then isInMultiShoot:= false
else begin
ParseCommand('/nextturn', true);
@@ -451,7 +450,7 @@
((GameTicks and $FFFF) = $FFFF) then
begin
SendIPCTimeInc;
- inc(hiTicks) // we do not recieve a message for it
+ inc(hiTicks) // we do not recieve a message for this
end;
inc(GameTicks)
diff -r 4884bce5e5eb -r daddcd31ef34 hedgewars/uMisc.pas
--- a/hedgewars/uMisc.pas Thu Apr 24 19:55:10 2008 +0000
+++ b/hedgewars/uMisc.pas Thu Apr 24 20:53:35 2008 +0000
@@ -234,7 +234,7 @@
end;
procedure SendStat(sit: TStatInfoType; s: shortstring);
-const stc: array [TStatInfoType] of char = 'rDK';
+const stc: array [TStatInfoType] of char = 'rDkK';
begin
SendIPC('i' + stc[sit] + s)
end;
@@ -290,7 +290,7 @@
if (surf^.format^.BytesPerPixel = 3) then mode:= GL_RGB else
if (surf^.format^.BytesPerPixel = 4) then mode:= GL_RGBA else
begin
- TryDo(false, 'Surface2Tex: BytePerPixel not in [3, 4]', true);
+ TryDo(false, 'Surface2Tex: BytesPerPixel not in [3, 4]', true);
Surface2Tex^.id:= 0;
exit
end;
diff -r 4884bce5e5eb -r daddcd31ef34 hedgewars/uStats.pas
--- a/hedgewars/uStats.pas Thu Apr 24 19:55:10 2008 +0000
+++ b/hedgewars/uStats.pas Thu Apr 24 20:53:35 2008 +0000
@@ -24,9 +24,11 @@
DamageRecv,
DamageGiven: Longword;
StepDamageRecv,
- StepDamageGiven: Longword;
+ StepDamageGiven,
+ StepKills: Longword;
MaxStepDamageRecv,
- MaxStepDamageGiven: Longword;
+ MaxStepDamageGiven,
+ MaxStepKills: Longword;
FinishedTurns: Longword;
end;
@@ -55,6 +57,7 @@
if Gear^.Health <= Gear^.Damage then
begin
+ inc(CurrentHedgehog^.stats.StepKills);
inc(Kills);
inc(KillsTotal);
if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(KillsClan);
@@ -67,6 +70,7 @@
procedure TurnReaction;
var Gear: PGear;
+ i, t: LongInt;
begin
inc(CurrentHedgehog^.stats.FinishedTurns);
@@ -94,21 +98,19 @@
else if AmmoDamagingUsed then
PlaySound(sndMissed, false);
-Gear:= GearsList;
-while Gear <> nil do
- begin
- if Gear^.Kind = gtHedgehog then
- with PHedgehog(Gear^.Hedgehog)^.stats do
- begin
- inc(DamageRecv, StepDamageRecv);
- inc(DamageGiven, StepDamageGiven);
- if StepDamageRecv > MaxStepDamageRecv then MaxStepDamageRecv:= StepDamageRecv;
- if StepDamageGiven > MaxStepDamageGiven then MaxStepDamageGiven:= StepDamageGiven;
- StepDamageRecv:= 0;
- StepDamageGiven:= 0
- end;
- Gear:= Gear^.NextGear
- end;
+for t:= 0 to Pred(TeamsCount) do
+ with TeamsArray[t]^ do
+ for i:= 0 to cMaxHHIndex do
+ with Hedgehogs[i].stats do
+ begin
+ inc(DamageRecv, StepDamageRecv);
+ inc(DamageGiven, StepDamageGiven);
+ if StepDamageRecv > MaxStepDamageRecv then MaxStepDamageRecv:= StepDamageRecv;
+ if StepDamageGiven > MaxStepDamageGiven then MaxStepDamageGiven:= StepDamageGiven;
+ if StepKills > MaxStepKills then MaxStepKills:= StepKills;
+ StepDamageRecv:= 0;
+ StepDamageGiven:= 0
+ end;
Kills:= 0;
KillsClan:= 0;
@@ -126,21 +128,39 @@
procedure SendStats;
var i, t: LongInt;
- msd: Longword; msdhh: PHedgehog;
+ msd, msk: Longword; msdhh, mskhh: PHedgehog;
+ mskcnt: Longword;
begin
msd:= 0; msdhh:= nil;
+msk:= 0; mskhh:= nil;
+mskcnt:= 0;
+
for t:= 0 to Pred(TeamsCount) do
- with TeamsArray[t]^ do
- begin
- for i:= 0 to cMaxHHIndex do
- if Hedgehogs[i].stats.StepDamageGiven > msd then
- begin
- msdhh:= @Hedgehogs[i];
- msd:= Hedgehogs[i].stats.StepDamageGiven
- end;
- end;
-if msdhh <> nil then SendStat(siMaxStepDamage, inttostr(msd) + ' ' +
- msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')');
+ with TeamsArray[t]^ do
+ begin
+ for i:= 0 to cMaxHHIndex do
+ begin
+ if Hedgehogs[i].stats.MaxStepDamageGiven > msd then
+ begin
+ msdhh:= @Hedgehogs[i];
+ msd:= Hedgehogs[i].stats.MaxStepDamageGiven
+ end;
+ if Hedgehogs[i].stats.MaxStepKills >= msk then
+ if Hedgehogs[i].stats.MaxStepKills = msk then
+ inc(mskcnt)
+ else
+ begin
+ mskcnt:= 1;
+ mskhh:= @Hedgehogs[i];
+ msk:= Hedgehogs[i].stats.MaxStepKills
+ end;
+ end
+ end;
+if msdhh <> nil then
+ SendStat(siMaxStepDamage, inttostr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')');
+if mskcnt = 1 then
+ SendStat(siMaxStepKills, inttostr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')');
+
if KilledHHs > 0 then SendStat(siKilledHHs, inttostr(KilledHHs));
end;