Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10657) player_dlg must have a column for username
Home

[Freeciv-Dev] (PR#10657) player_dlg must have a column for username

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#10657) player_dlg must have a column for username
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 24 Oct 2004 23:39:45 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10657 >

+  if (has_capability("username_info", aconnection.capability)) {
+    sz_strlcpy(pplayer->username, pinfo->username);
+  } else {
+    conn_list_iterate(game.est_connections, pconn) {
+      if (pconn->player == pplayer && !pconn->observer) {
+        sz_strlcpy(pplayer->username, pconn->username);
+      }
+    } conn_list_iterate_end;
+  }

But if it's as easy as finding the conn matching the player why do we
need a new network field at all?

jason

Index: client/plrdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/plrdlg_common.c,v
retrieving revision 1.11
diff -u -r1.11 plrdlg_common.c
--- client/plrdlg_common.c      23 Oct 2004 20:02:52 -0000      1.11
+++ client/plrdlg_common.c      25 Oct 2004 06:37:22 -0000
@@ -77,6 +77,20 @@
 }
 
 /******************************************************************
+  Return the username matching this player.
+*******************************************************************/
+static const char *col_username(struct player *player)
+{
+  conn_list_iterate(game.est_connections, pconn) {
+    if (pconn->player == pplayer && !pconn->observer) {
+      return pconn->username;
+    }
+  } conn_list_iterate_end;
+
+  return ""
+}
+
+/******************************************************************
  ...
 *******************************************************************/
 static const char *col_nation(struct player *player)
@@ -212,6 +226,7 @@
 *******************************************************************/
 struct player_dlg_column player_dlg_columns[] = {
   {TRUE, COL_TEXT, N_("?Player:Name"), col_name, NULL, "name"},
+  {FALSE, COL_TEXT, N_("Username"), col_username, NULL, "username"},
   {TRUE, COL_FLAG, N_("Flag"), NULL, NULL, "flag"},
   {TRUE, COL_TEXT, N_("Nation"), col_nation, NULL, "nation"},
   {TRUE, COL_COLOR, N_("Border"), NULL, NULL, "border"},

[Prev in Thread] Current Thread [Next in Thread]