SuperTuxKart
kart_with_stats.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2011-2015 Joerg Henrichs
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef HEADER_KART_WITH_STATS_HPP
20 #define HEADER_KART_WITH_STATS_HPP
21 
22 #include "karts/kart.hpp"
23 
31 class KartWithStats : public Kart
32 {
33 private:
35  float m_top_speed;
36 
39 
41  unsigned int m_explosion_count;
42 
44  unsigned int m_rescue_count;
45 
47  unsigned int m_bonus_count;
48 
50  unsigned int m_banana_count;
51 
53  unsigned int m_small_nitro_count;
54 
56  unsigned int m_large_nitro_count;
57 
59  unsigned int m_bubblegum_count;
60 
62  unsigned int m_brake_count;
63 
65  unsigned int m_off_track_count;
66 
69 
72 
73 public:
74  KartWithStats(const std::string& ident,
75  unsigned int world_kart_id,
76  int position,
77  const btTransform& init_transform,
78  HandicapLevel handicap);
79  virtual void update(int ticks) OVERRIDE;
80  virtual void reset() OVERRIDE;
81  virtual void collectedItem(ItemState *item_state) OVERRIDE;
82  virtual void setKartAnimation(AbstractKartAnimation *ka) OVERRIDE;
83 
85  float getTopSpeed() const { return m_top_speed; }
86  // ------------------------------------------------------------------------
88  float getExplosionTime() const { return m_explosion_time; }
89  // ------------------------------------------------------------------------
91  unsigned int getExplosionCount() const { return m_explosion_count; }
92  // ------------------------------------------------------------------------
94  float getSkiddingTime() const { return m_skidding_time; }
95  // ------------------------------------------------------------------------
97  unsigned int getBrakeCount() const { return m_brake_count; }
98  // ------------------------------------------------------------------------
100  unsigned int getRescueCount() const { return m_rescue_count; }
101  // ------------------------------------------------------------------------
103  unsigned int getBonusCount() const { return m_bonus_count; }
104  // ------------------------------------------------------------------------
106  unsigned int getBananaCount() const { return m_banana_count; }
107  // ------------------------------------------------------------------------
109  unsigned int getSmallNitroCount() const { return m_small_nitro_count; }
110  // ------------------------------------------------------------------------
112  unsigned int getLargeNitroCount() const { return m_large_nitro_count; }
113  // ------------------------------------------------------------------------
115  unsigned int getBubblegumCount() const { return m_bubblegum_count; }
116  // ------------------------------------------------------------------------
118  float getRescueTime() const { return m_rescue_time; }
119  // ------------------------------------------------------------------------
121  unsigned int getOffTrackCount() const { return m_off_track_count; }
122  // ------------------------------------------------------------------------
123 
124 }; // KartWithStats
125 #endif
The base class for all kart animation, like rescue, explosion, or cannon.
Definition: abstract_kart_animation.hpp:60
Contains the state information of an item, i.e.
Definition: item.hpp:53
This class implements a kart that collects statistics about a race, which is used in profiling mode.
Definition: kart_with_stats.hpp:32
unsigned int getBananaCount() const
Returns the number of bananas that were taken.
Definition: kart_with_stats.hpp:106
virtual void update(int ticks) OVERRIDE
This function is called each timestep, and it collects most of the statistics for this kart.
Definition: kart_with_stats.cpp:61
float m_skidding_time
How much time this kart was skidding.
Definition: kart_with_stats.hpp:71
float m_explosion_time
How long this kart spent in explosions.
Definition: kart_with_stats.hpp:38
virtual void setKartAnimation(AbstractKartAnimation *ka) OVERRIDE
Overloading setKartAnimation with a kind of listener function in order to gather statistics about res...
Definition: kart_with_stats.cpp:77
unsigned int m_off_track_count
How often the kart was off-track.
Definition: kart_with_stats.hpp:65
float getRescueTime() const
Returns how long a kart was rescued all in all.
Definition: kart_with_stats.hpp:118
unsigned int m_small_nitro_count
How many small nitro tanks were taken.
Definition: kart_with_stats.hpp:53
unsigned int m_bubblegum_count
How many bubblegums were taken.
Definition: kart_with_stats.hpp:59
unsigned int getRescueCount() const
Returns how often a kart was rescued.
Definition: kart_with_stats.hpp:100
unsigned int m_rescue_count
How often a kart was rescued.
Definition: kart_with_stats.hpp:44
unsigned int m_large_nitro_count
How many large nitro tanks were taken.
Definition: kart_with_stats.hpp:56
unsigned int getExplosionCount() const
Returns how often this kart was hit by an explosion.
Definition: kart_with_stats.hpp:91
virtual void collectedItem(ItemState *item_state) OVERRIDE
Called when an item is collected.
Definition: kart_with_stats.cpp:105
unsigned int m_bonus_count
How many bonuses were taken.
Definition: kart_with_stats.hpp:47
unsigned int getBonusCount() const
Returns the number of bonuses that were taken.
Definition: kart_with_stats.hpp:103
float m_top_speed
The maximum speed of this kart had.
Definition: kart_with_stats.hpp:35
float getTopSpeed() const
Returns the top speed of this kart.
Definition: kart_with_stats.hpp:85
float m_rescue_time
How much time was spent in rescue.
Definition: kart_with_stats.hpp:68
unsigned int getOffTrackCount() const
Returns how often the kart was off track.
Definition: kart_with_stats.hpp:121
float getExplosionTime() const
Returns how much time this kart spent in explosion animations.
Definition: kart_with_stats.hpp:88
unsigned int m_explosion_count
How often that kart was hit.
Definition: kart_with_stats.hpp:41
unsigned int m_banana_count
How many bananas were taken.
Definition: kart_with_stats.hpp:50
virtual void reset() OVERRIDE
Called at the start of each race, esp.
Definition: kart_with_stats.cpp:38
unsigned int getBrakeCount() const
Returns how often the kart braked.
Definition: kart_with_stats.hpp:97
float getSkiddingTime() const
Returns how much time this kart spent skidding.
Definition: kart_with_stats.hpp:94
unsigned int getLargeNitroCount() const
Returns the number of large nitro tanks that were taken.
Definition: kart_with_stats.hpp:112
unsigned int getSmallNitroCount() const
Returns the number of small nitro tanks that were taken.
Definition: kart_with_stats.hpp:109
unsigned int getBubblegumCount() const
Returns the number of bubblegums that were taken.
Definition: kart_with_stats.hpp:115
unsigned int m_brake_count
How often the kart braked.
Definition: kart_with_stats.hpp:62
The main kart class.
Definition: kart.hpp:72
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:43