gnome-games r8001 - trunk/blackjack/src



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

Log:
Fix compiler warnings

Modified:
   trunk/blackjack/src/chips.cpp
   trunk/blackjack/src/dialog.cpp
   trunk/blackjack/src/game.cpp
   trunk/blackjack/src/game.h
   trunk/blackjack/src/hand.cpp

Modified: trunk/blackjack/src/chips.cpp
==============================================================================
--- trunk/blackjack/src/chips.cpp	(original)
+++ trunk/blackjack/src/chips.cpp	Mon Oct 13 06:18:17 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: trunk/blackjack/src/dialog.cpp
==============================================================================
--- trunk/blackjack/src/dialog.cpp	(original)
+++ trunk/blackjack/src/dialog.cpp	Mon Oct 13 06:18:17 2008
@@ -49,7 +49,7 @@
         gboolean    choice = FALSE;
 
         message = _("Would you like insurance?");
-        secondary_message = _("Insurance is a side wager of 50% of the original wager"
+        secondary_message = _("Insurance is a side wager of 50%% of the original wager"
                               " that the dealer has a natural 21 (aka blackjack) that is"
                               " offered when the dealer's face up card is an ace. If the"
                               " dealer has a natural 21 then the player is paid double.");

Modified: trunk/blackjack/src/game.cpp
==============================================================================
--- trunk/blackjack/src/game.cpp	(original)
+++ trunk/blackjack/src/game.cpp	Mon Oct 13 06:18:17 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: trunk/blackjack/src/game.h
==============================================================================
--- trunk/blackjack/src/game.h	(original)
+++ trunk/blackjack/src/game.h	Mon Oct 13 06:18:17 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: trunk/blackjack/src/hand.cpp
==============================================================================
--- trunk/blackjack/src/hand.cpp	(original)
+++ trunk/blackjack/src/hand.cpp	Mon Oct 13 06:18:17 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]