Fixed trailing whitespaces in all(?) source files of supertux, also fixed some svn...
[supertux.git] / src / player_status.cpp
index 95a1c11..1f233bd 100644 (file)
@@ -19,6 +19,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include <config.h>
 
+#include <math.h>
 #include "lisp/writer.hpp"
 #include "lisp/lisp.hpp"
 #include "player_status.hpp"
@@ -47,8 +48,6 @@ PlayerStatus::PlayerStatus()
   reset();
 
   coin_surface.reset(new Surface("images/engine/hud/coins-0.png"));
-
-  Console::instance->registerCommand("coins", this);
 }
 
 PlayerStatus::~PlayerStatus()
@@ -135,7 +134,9 @@ PlayerStatus::draw(DrawingContext& context)
   static int displayed_coins = -1;
   static int next_count = 0;
 
-  if (displayed_coins == -1) displayed_coins = coins;
+  if ((displayed_coins == -1) || (fabsf(displayed_coins - coins) > 100)) {
+    displayed_coins = coins;
+  }
   if (++next_count > 2) {
     next_count = 0;
     if (displayed_coins < coins) displayed_coins++;
@@ -167,17 +168,3 @@ PlayerStatus::operator= (const PlayerStatus& other)
   score_multiplier = other.score_multiplier;
   max_score_multiplier = other.max_score_multiplier;
 }
-
-bool
-PlayerStatus::consoleCommand(std::string command, std::vector<std::string> arguments)
-{
-  if (command == "coins") {
-    if ((arguments.size() < 1) || (!Console::string_is<int>(arguments[0]))) {
-      log_info << "Usage: coins <number>" << std::endl;
-    } else {
-      coins = Console::string_to<int>(arguments[0]);
-    }
-    return true;
-  }
-  return false;
-}