gnome-games r8002 - branches/gnome-2-24/blackjack/src



Author: rancell
Date: Mon Oct 13 06:20:32 2008
New Revision: 8002
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8002&view=rev

Log:
Fix compiler warnings

Modified:
   branches/gnome-2-24/blackjack/src/chips.cpp
   branches/gnome-2-24/blackjack/src/dialog.cpp
   branches/gnome-2-24/blackjack/src/game.cpp
   branches/gnome-2-24/blackjack/src/game.h
   branches/gnome-2-24/blackjack/src/hand.cpp

Modified: branches/gnome-2-24/blackjack/src/chips.cpp
==============================================================================
--- branches/gnome-2-24/blackjack/src/chips.cpp	(original)
+++ branches/gnome-2-24/blackjack/src/chips.cpp	Mon Oct 13 06:20:32 2008
@@ -61,10 +61,10 @@
 bj_chip_set_size (gint width,
                   gint height)
 {
-        gchar *names[4] = { CHIP_FILENAME_100,
-                            CHIP_FILENAME_25,
-                            CHIP_FILENAME_5,
-                            CHIP_FILENAME_1 };
+        const gchar *names[4] = { CHIP_FILENAME_100,
+                                  CHIP_FILENAME_25,
+                                  CHIP_FILENAME_5,
+                                  CHIP_FILENAME_1 };
 
         for (gint i = 0; i < 4; i++) {
                 gchar *fullname;

Modified: branches/gnome-2-24/blackjack/src/dialog.cpp
==============================================================================
--- branches/gnome-2-24/blackjack/src/dialog.cpp	(original)
+++ branches/gnome-2-24/blackjack/src/dialog.cpp	Mon Oct 13 06:20:32 2008
@@ -58,10 +58,10 @@
                                          GTK_DIALOG_MODAL,
                                          GTK_MESSAGE_QUESTION,
                                          GTK_BUTTONS_YES_NO,
-                                         message);
+                                         "%s", message);
 
         gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                  secondary_message);
+                                                  "%s", secondary_message);
 
         gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
         gtk_window_set_title (GTK_WINDOW (dialog), "");
@@ -111,10 +111,10 @@
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_MESSAGE_INFO,
                                            GTK_BUTTONS_OK,
-                                           message);
+                                           "%s", message);
 
         gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (hint_dlg),
-                                                  secondary_message);
+                                                  "%s", secondary_message);
 
         gtk_container_set_border_width (GTK_CONTAINER (hint_dlg), 6);
         gtk_window_set_title (GTK_WINDOW (hint_dlg), "");

Modified: branches/gnome-2-24/blackjack/src/game.cpp
==============================================================================
--- branches/gnome-2-24/blackjack/src/game.cpp	(original)
+++ branches/gnome-2-24/blackjack/src/game.cpp	Mon Oct 13 06:20:32 2008
@@ -60,7 +60,7 @@
 
 gint             numHands;
 
-gchar            *game_file = "";
+const gchar      *game_file = "";
 gchar            *game_name;
 
 gboolean         allSettled = FALSE;
@@ -190,7 +190,7 @@
         return game_name;
 }
 
-char *
+const char *
 bj_game_get_rules_file ()
 {
         return game_file;
@@ -434,7 +434,7 @@
 }
 
 static void
-bj_game_eval_installed_file (gchar *file)
+bj_game_eval_installed_file (const gchar *file)
 {
         char *installed_filename;
 
@@ -509,7 +509,7 @@
 }
 
 void
-bj_game_new (gchar* file, guint *seedp )
+bj_game_new (const gchar* file, guint *seedp )
 {
         gint min_w, min_h;
 

Modified: branches/gnome-2-24/blackjack/src/game.h
==============================================================================
--- branches/gnome-2-24/blackjack/src/game.h	(original)
+++ branches/gnome-2-24/blackjack/src/game.h	Mon Oct 13 06:20:32 2008
@@ -25,7 +25,7 @@
 void bj_game_find_rules (gchar * variation);
 
 gchar *bj_game_file_to_name (const gchar *);
-void bj_game_new (gchar *, guint *);
+void bj_game_new (const gchar *, guint *);
 void bj_clear_table (void);
 
 void bj_game_show_hand_counts (void);
@@ -37,7 +37,7 @@
 gboolean bj_game_is_first_hand (void);
 
 char *bj_game_get_rules_name (void);
-char *bj_game_get_rules_file (void);
+const char *bj_game_get_rules_file (void);
 GList *bj_game_get_rules_list (void);
 
 // Extend BJRules

Modified: branches/gnome-2-24/blackjack/src/hand.cpp
==============================================================================
--- branches/gnome-2-24/blackjack/src/hand.cpp	(original)
+++ branches/gnome-2-24/blackjack/src/hand.cpp	Mon Oct 13 06:20:32 2008
@@ -156,12 +156,12 @@
 
         if (dealer_count > 21)
                 dealer_count = 0;
-        if (player_count <= 21)
+        if (player_count <= 21) {
                 if (player_count > dealer_count)
                         results = 1;
-                else 
-                        if (player_count == dealer_count)
-                                results = 0;
+                else if (player_count == dealer_count)
+                        results = 0;
+        }
 
         return results;
 }
@@ -261,7 +261,8 @@
                                                                 FALSE);
                 }
                 if (dealer->cards[0].value () == 1) {
-                        if (insurance = get_insurance_choice ())
+                        insurance = get_insurance_choice ();
+                        if (insurance)
                                 bj_adjust_balance (-1 * player->wager / 2);
                 }
         }
@@ -429,11 +430,12 @@
                                 dealer_count = 0;
                         player = (PlayerHand*) g_list_nth_data (playerHands,0);
                         while (player != NULL) {
-                                if (player->getCount () <= 21)
+                                if (player->getCount () <= 21) {
                                         if (player->getCount () > dealer_count)
                                                 bj_adjust_balance (player->wager * 2);
                                         else if (player->getCount () == dealer_count)
                                                 bj_adjust_balance (player->wager);
+                                }
                                 player = player->nextHand;
                         }
                 }
@@ -657,7 +659,7 @@
                         else
                                 check_splits = FALSE;
 
-                        if (player->getCount () >= 21) 
+                        if (player->getCount () >= 21) {
                                 if (player->nextHand == NULL) {
                                         check_splits = FALSE;
                                         allSettled = FALSE;
@@ -665,6 +667,7 @@
                                 }
                                 else
                                         player = player->nextHand;
+                        }
                         
                         bj_hand_show_dealer_probabilities ();
                         bj_hand_show_options ();



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