Ooops, forgot to upload the actual Statistics implementation.
[supertux.git] / src / statistics.h
1 //  SuperTux
2 //  Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details
3 //
4 //  This program is free software; you can redistribute it and/or
5 //  modify it under the terms of the GNU General Public License
6 //  as published by the Free Software Foundation; either version 2
7 //  of the License, or (at your option) any later version.
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
17 //  02111-1307, USA.
18
19 #ifndef SUPERTUX_STATISTICS_H
20 #define SUPERTUX_STATISTICS_H
21
22 using namespace SuperTux;
23
24 namespace SuperTux {
25 class LispReader;
26 class LispWriter;
27 }
28
29 enum {
30   SCORE_STAT,
31   MAX_STATS
32 };
33
34 /** This class is a layer between level and worldmap to keep
35  *  track of stuff like scores, and minor, but funny things, like
36  *  number of jumps and stuff */
37
38 class Statistics
39 {
40 public:
41   Statistics();
42   ~Statistics();
43
44   /// read statistics from lisp file
45   void parse(LispReader& reader);
46   /// write statistics to lisp file
47   void write(LispWriter& writer);
48
49   // TODO: add drawing functions to draw stats on WorldMap
50
51   void add_points(int stat, int points);
52   int get_points(int stat);
53
54   void reset();
55
56   /* Give another Statistics object, find the best of each one */
57   void merge(Statistics& stats);
58
59   /* Add two statistic objects */
60   void operator+=(const Statistics& o);
61
62 private:
63   int stats[MAX_STATS];
64 };
65
66 extern Statistics global_stats;
67
68 #endif /*SUPERTUX_STATISTICS_H*/