Fixing a few cppcheck warnings
[supertux.git] / src / supertux / player_status.cpp
index a66663b..2c95b8f 100644 (file)
@@ -40,6 +40,8 @@ PlayerStatus::PlayerStatus() :
   bonus(NO_BONUS),
   max_fire_bullets(0),
   max_ice_bullets(0),
+  max_air_time(0),
+  max_earth_time(0),
   displayed_coins(DISPLAYED_COINS_UNSET),
   displayed_coins_frame(0),
   coin_surface()
@@ -65,15 +67,17 @@ void PlayerStatus::reset()
 void
 PlayerStatus::add_coins(int count, bool play_sound)
 {
-  static float sound_played_time = 0;
   coins = std::min(coins + count, MAX_COINS);
-  if(play_sound) {
-    if(count >= 100)
-      SoundManager::current()->play("sounds/lifeup.wav");
-    else if (real_time > sound_played_time + 0.010) {
-      SoundManager::current()->play("sounds/coin.wav");
-      sound_played_time = real_time;
-    }
+
+  if(!play_sound)
+    return;
+
+  static float sound_played_time = 0;
+  if(count >= 100)
+    SoundManager::current()->play("sounds/lifeup.wav");
+  else if (real_time > sound_played_time + 0.010) {
+    SoundManager::current()->play("sounds/coin.wav");
+    sound_played_time = real_time;
   }
 }