void gnibbles_show_scores (GtkWidget * window, gint pos) { static GtkWidget *scoresdialog = NULL; gchar *message; if (!scoresdialog) { scoresdialog = games_scores_dialog_new (GTK_WINDOW (window), highscores, _("Nibbles Scores")); games_scores_dialog_set_category_description (GAMES_SCORES_DIALOG (scoresdialog), _("Speed:")); } if (pos > 0) { games_scores_dialog_set_hilight (GAMES_SCORES_DIALOG (scoresdialog), pos); message = g_strdup_printf ("<b>%s</b>\n\n%s", _("Congratulations!"), pos == 1 ? _("Your score is the best!") : _("Your score has made the top ten.")); games_scores_dialog_set_message (GAMES_SCORES_DIALOG (scoresdialog), message); g_free (message); } else { games_scores_dialog_set_message (GAMES_SCORES_DIALOG (scoresdialog), NULL); } gtk_dialog_run (GTK_DIALOG (scoresdialog)); gtk_widget_hide (scoresdialog); }
static void CheerWinner (void) { int winner; int i; gint pos; gchar *message; ShowoffPlayer (ScoreList, CurrentPlayer, 0); winner = FindWinner (); /* draw. The score is returned as a negative value */ if (winner < 0) { for (i = 0; i < NumberOfPlayers; i++) { if (total_score (i) == -winner) { ShowoffPlayer (ScoreList, i, 1); } } say (_("The game is a draw!")); return; } ShowoffPlayer (ScoreList, winner, 1); if (winner < NumberOfHumans) { pos = games_scores_add_plain_score (highscores, (guint32) WinningScore); if (pos > 0) { games_scores_update_score (highscores, players[winner].name); if (dialog) { gtk_window_present (GTK_WINDOW (dialog)); } else { dialog = games_scores_dialog_new (GTK_WINDOW (window), highscores, _("Tali Scores")); message = g_strdup_printf ("<b>%s</b>\n\n%s", _("Congratulations!"), pos == 1 ? _("Your score is the best!") : _("Your score has made the top ten.")); games_scores_dialog_set_message (GAMES_SCORES_DIALOG (dialog), message); g_free (message); } games_scores_dialog_set_hilight (GAMES_SCORES_DIALOG (dialog), pos); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_hide (dialog); } } if (players[winner].name) say (ngettext ("%s wins the game with %d point", "%s wins the game with %d points", WinningScore), players[winner].name, WinningScore); else say (_("Game over!")); }