|
1 (* |
|
2 * Hedgewars, a worms-like game |
|
3 * Copyright (c) 2008 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation; version 2 of the License |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 *) |
|
18 |
|
19 unit uStats; |
|
20 interface |
|
21 uses uGears; |
|
22 |
|
23 type TStatistics = record |
|
24 DamageRecv, |
|
25 DamageGiven: Longword; |
|
26 StepDamageRecv, |
|
27 StepDamageGiven: Longword; |
|
28 MaxStepDamageRecv, |
|
29 MaxStepDamageGiven: Longword; |
|
30 Turns: Longword; |
|
31 end; |
|
32 |
|
33 procedure HedgehogDamaged(Gear: PGear; Damage: Longword); |
|
34 procedure TurnReaction; |
|
35 procedure SendStats; |
|
36 |
|
37 implementation |
|
38 uses uTeams, uSound, uConsts; |
|
39 |
|
40 procedure HedgehogDamaged(Gear: PGear; Damage: Longword); |
|
41 begin |
|
42 if Gear <> CurrentHedgehog^.Gear then |
|
43 inc(CurrentHedgehog^.stats.StepDamageGiven, Damage); |
|
44 inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Damage) |
|
45 end; |
|
46 |
|
47 procedure TurnReaction; |
|
48 begin |
|
49 end; |
|
50 |
|
51 procedure SendStats; |
|
52 //var i, t: LongInt; |
|
53 // msd: Longword; msdhh: PHedgehog; |
|
54 begin |
|
55 (*msd:= 0; msdhh:= nil; |
|
56 for t:= 0 to Pred(TeamsCount) do |
|
57 with TeamsArray[t]^ do |
|
58 begin |
|
59 for i:= 0 to cMaxHHIndex do |
|
60 if Hedgehogs[i].MaxStepDamage > msd then |
|
61 begin |
|
62 msdhh:= @Hedgehogs[i]; |
|
63 msd:= Hedgehogs[i].MaxStepDamage |
|
64 end; |
|
65 end; |
|
66 if msdhh <> nil then SendStat(siMaxStepDamage, inttostr(msdhh^.MaxStepDamage) + ' ' + |
|
67 msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')'); |
|
68 if KilledHHs > 0 then SendStat(siKilledHHs, inttostr(KilledHHs));*) |
|
69 end; |
|
70 |
|
71 end. |