[PATCH]In death members of Project Mayhem have a name
- From: "Iain *" <iaingnome gmail com>
- To: rah rahga com, "Desktop Development List" <desktop-devel-list gnome org>
- Subject: [PATCH]In death members of Project Mayhem have a name
- Date: Fri, 30 Jun 2006 00:30:15 +0100
Hi,
My name is iain. I make patches. Here is one.
I was playing Tali and noticed that my player is called "Human" by
default. Attached is a patch that uses g_get_real_name so that I don't
feel quite so generic when I play it.
iain
Index: gtali/gyahtzee.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gtali/gyahtzee.c,v
retrieving revision 1.79
diff -U2 -r1.79 gyahtzee.c
--- gtali/gyahtzee.c 11 Apr 2006 09:42:08 -0000 1.79
+++ gtali/gyahtzee.c 29 Jun 2006 23:21:58 -0000
@@ -760,7 +760,18 @@
for (i = 0; i < MAX_NUMBER_OF_PLAYERS && name_list; i++) {
- if (name_list->data)
- players[i].name = g_strdup (name_list->data);
-
+ if (name_list->data) {
+ if (strcasecmp (name_list->data, _("Human")) == 0) {
+ char *realname;
+
+ /* Old data: Update */
+ realname = g_strdup (g_get_real_name ());
+ g_strdelimit (realname, " ", '\0');
+
+ players[i].name = realname;
+ } else {
+ players[i].name = g_strdup (name_list->data);
+ }
+ }
+
name_list = g_slist_next (name_list);
}
Index: gtali/yahtzee.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gtali/yahtzee.c,v
retrieving revision 1.24
diff -U2 -r1.24 yahtzee.c
--- gtali/yahtzee.c 29 Mar 2006 09:23:09 -0000 1.24
+++ gtali/yahtzee.c 29 Jun 2006 23:21:58 -0000
@@ -35,4 +35,7 @@
#include <config.h>
+
+#include <glib.h>
+
#include "yahtzee.h"
@@ -58,5 +61,5 @@
int DisplayComputerThoughts = 0;
int CurrentPlayer;
-char *DefaultPlayerNames[MAX_NUMBER_OF_PLAYERS] = { N_("Human"),
+char *DefaultPlayerNames[MAX_NUMBER_OF_PLAYERS] = { NULL,
"Wilber",
"Bill",
@@ -114,5 +117,14 @@
for (i = 0; i < MAX_NUMBER_OF_PLAYERS; ++i) {
- players[i].name = _(DefaultPlayerNames[i]);
+ if (DefaultPlayerNames[i] == NULL) {
+ char *realname;
+
+ realname = g_strdup (g_get_real_name ());
+ g_strdelimit (realname, " ", '\0');
+
+ players[i].name = realname;
+ } else {
+ players[i].name = _(DefaultPlayerNames[i]);
+ }
players[i].comp = 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]