No more count-to-infinity for the coins display
authorChristoph Sommer <mail@christoph-sommer.de>
Wed, 1 Nov 2006 03:06:18 +0000 (03:06 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Wed, 1 Nov 2006 03:06:18 +0000 (03:06 +0000)
SVN-Revision: 4428

src/player_status.cpp

index 95a1c11..44512a1 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"
@@ -135,7 +136,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++;