[gnome-games/gnome-2-32] aisleriot: Store 'score' as int



commit 00f6234ed659a51437e2318d30df50e74ca10c65
Author: Christian Persch <chpe gnome org>
Date:   Thu Aug 26 19:29:30 2010 +0200

    aisleriot: Store 'score' as int
    
    Bug #556359.

 aisleriot/game.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/aisleriot/game.c b/aisleriot/game.c
index a51b9c8..185d263 100644
--- a/aisleriot/game.c
+++ b/aisleriot/game.c
@@ -52,13 +52,14 @@ struct _AisleriotGame
   GPtrArray *slots;
 
   char *game_file;
-  guint timeout;
-  guint score;
   guint32 seed;
   guint delayed_call_timeout_id;
 
   GTimer *timer;
 
+  int timeout;
+  int score;
+
   double width;
   double height;
 
@@ -149,7 +150,7 @@ set_game_state (AisleriotGame *game,
 
 static void
 set_game_score (AisleriotGame *game,
-                guint score)
+                int score)
 {
   if (score != game->score) {
     game->score = score;
@@ -902,7 +903,7 @@ scm_get_score (void)
 {
   AisleriotGame *game = app_game;
 
-  return scm_from_uint (game->score);
+  return scm_from_int (game->score);
 }
 
 static SCM
@@ -918,11 +919,11 @@ static SCM
 scm_add_to_score (SCM delta)
 {
   AisleriotGame *game = app_game;
-  guint new_score;
+  int new_score;
 
   new_score = game->score + scm_num2int (delta, SCM_ARG1, NULL);
   set_game_score (game, new_score);
-  return scm_from_uint (new_score);
+  return scm_from_int (new_score);
 }
 
 static SCM
@@ -944,7 +945,7 @@ scm_get_timeout (void)
 
   g_warning ("(get-timeout) unimplemented\n");
 
-  return scm_from_uint (game->timeout);
+  return scm_from_int (game->timeout);
 }
 
 static void
@@ -1229,7 +1230,7 @@ aisleriot_game_get_property (GObject *object,
       g_value_set_string (value, game->game_file);
       break;
     case PROP_SCORE:
-      g_value_set_uint (value, game->score);
+      g_value_set_int (value, game->score);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1343,10 +1344,10 @@ aisleriot_game_class_init (AisleriotGameClass *klass)
   g_object_class_install_property
     (gobject_class,
      PROP_SCORE,
-     g_param_spec_uint ("score", NULL, NULL,
-                        0, G_MAXUINT, 0,
-                        G_PARAM_READABLE |
-                        G_PARAM_STATIC_STRINGS));
+     g_param_spec_int ("score", NULL, NULL,
+                       G_MININT, G_MAXINT, 0,
+                       G_PARAM_READABLE |
+                       G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property
     (gobject_class,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]