Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#13256) Show who has access
Home

[Freeciv-Dev] (PR#13256) Show who has access

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13256) Show who has access
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 13 Jun 2005 10:28:04 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13256 >

This patch for gtk2 client adds a (*) postfix to usernames for users with
higher than INFO cmdlevel. This will show other players who can change
settings (firstlevel).

  - Per

Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.129
diff -u -r1.129 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       8 Jun 2005 18:26:04 -0000       1.129
+++ client/gui-gtk-2.0/gui_main.c       13 Jun 2005 17:25:30 -0000
@@ -1249,31 +1249,40 @@
   
   if (get_client_state() != CLIENT_GAME_RUNNING_STATE) {
     bool is_ready;
-    const char *name, *nation, *leader, *team;
+    const char *nation, *leader, *team;
+    char name[MAX_LEN_NAME + 4];
 
     gtk_list_store_clear(conn_model);
     players_iterate(pplayer) {
+      enum cmdlevel_id access_level = ALLOW_NONE;
+
       if (pplayer->is_observer) {
        continue; /* Connections are listed individually. */
       }
+      conn_list_iterate(pplayer->connections, pconn) {
+        access_level = MAX(pconn->access_level, access_level);
+      } conn_list_iterate_end;
+
       if (pplayer->ai.control) {
-       name = _("<AI>");       
+       sz_strlcpy(name, _("<AI>"));
        switch (pplayer->ai.skill_level) {
        case 2:
-         name = _("<Novice AI>");
+         sz_strlcpy(name, _("<Novice AI>"));
          break;
        case 3:
-         name = _("<Easy AI>");
+         sz_strlcpy(name, _("<Easy AI>"));
          break;
        case 5:
-         name = _("<Normal AI>");
+         sz_strlcpy(name, _("<Normal AI>"));
          break;
        case 7:
-         name = _("<Hard AI>");
+         sz_strlcpy(name, _("<Hard AI>"));
          break;
        }
+      } else if (access_level <= ALLOW_INFO) {
+       sz_strlcpy(name, pplayer->username);
       } else {
-       name = pplayer->username;
+        my_snprintf(name, sizeof(name), "%s(*)", pplayer->username);
       }
       is_ready = pplayer->ai.control ? TRUE: pplayer->is_ready;
       if (pplayer->nation == NO_NATION_SELECTED) {
@@ -1299,7 +1308,7 @@
       if (pconn->player && !pconn->observer && !pconn->player->is_observer) {
        continue; /* Already listed above. */
       }
-      name = pconn->username;
+      sz_strlcpy(name, pconn->username);
       is_ready = FALSE;
       nation = "";
       leader = "";

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13256) Show who has access, Per I. Mathisen <=