Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8425/src

Modified Files:
	defaults.c input.c option.c playerlist.c 
Log Message:
Some playerlist fixes, including new playerlist option to show all players, but put all observers on the bottom of the playerlist.

Index: playerlist.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/playerlist.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- playerlist.c	30 Apr 2006 15:59:40 -0000	1.4
+++ playerlist.c	30 Apr 2006 20:17:48 -0000	1.5
@@ -366,7 +366,7 @@
             {
                 if (players[count].p_status != PFREE)
                 {
-                    if (playerListObserver == 0)
+                    if (playerListObserver == 0 || playerListObserver == 3)
                     {
                         PlistLine (playerw, players + count, plistPos[count]);
                         PlistLine (playerw2, players + count, plistPos[count]);
@@ -388,7 +388,7 @@
             else
             {
                 if ((players[count].p_status != PFREE) &&
-                    ((playerListObserver == 0) ||
+                    ((playerListObserver == 0 || playerListObserver == 3) ||
                     ((playerListObserver == 1) &&
                     !(players[count].p_flags & PFOBSERV)) ||
                     ((playerListObserver == 2) &&
@@ -423,6 +423,7 @@
     struct player *current;
     int teamPos[NUMTEAM + 1];
     int *pos;
+    int obscount = 0;
 
     static int plistLastRow = -1;
     static int blankLine = -1;
@@ -450,7 +451,7 @@
     }
 
 
-    /* Count the number of players in each team. */
+    /* Count the number of players in each team, and total number of in game players. */
 
     for (i = NUMTEAM; i >= 0; --i)
         teamPos[i] = 0;
@@ -463,22 +464,31 @@
             {
                 if (playerListObserver == 0)
                     ++teamPos[remap[current->p_team]];
-                else if (playerListObserver == 1 &&
-                         current->p_mapchars[1] <= 'f')
+                else if ((playerListObserver == 1 || playerListObserver == 3)
+                        && current->p_mapchars[1] <= 'f')
                     ++teamPos[remap[current->p_team]];
-                else if (playerListObserver == 2 &&
-                        !(current->p_mapchars[1] <= 'f'))
+                else if (playerListObserver == 2
+                        && !(current->p_mapchars[1] <= 'f'))
                     ++teamPos[remap[current->p_team]];
+                    
+                if (!(current->p_mapchars[1] <= 'f'))
+                    obscount++;
             }
         }
         else
         {
-            if ((current->p_status != PFREE) &&
-                ((playerListObserver == 0) ||
-                ((playerListObserver == 1) && !(current->p_flags & PFOBSERV))
-                || ((playerListObserver == 2)
-                && (current->p_flags & PFOBSERV))))
-                ++teamPos[remap[current->p_team]];
+            if (current->p_status != PFREE)
+            {
+            	if ( (playerListObserver == 0)
+                 || ((playerListObserver == 1 || playerListObserver == 3)
+            	   && !(current->p_flags & PFOBSERV))
+                 || ((playerListObserver == 2)
+                   && (current->p_flags & PFOBSERV)) )
+                   ++teamPos[remap[current->p_team]];
+                   
+                if (current->p_flags & PFOBSERV)
+                    obscount++;
+            }
         }
     }
 
@@ -562,8 +572,8 @@
     }
 
     plistLastRow = last;
-
-
+    if (playerListObserver == 3)
+        plistLastRow += obscount;
 
     /* Write out each player that has either changed position or has
      * new stats. */
@@ -578,8 +588,12 @@
         }
         if (playerListHack)
         {
-            if (playerListObserver == 0)
+            if (playerListObserver == 0 || playerListObserver == 3)
             {
+            	if (playerListObserver == 3 && !(current->p_mapchars[1] <= 'f'))
+            	    row = --plistLastRow;
+            	else
+                    row = --(teamPos[remap[current->p_team]]);
                 row = --(teamPos[remap[current->p_team]]);
                 if ((!updatePlayer[i]) && plistPos[i] == row)
                     continue;
@@ -616,14 +630,30 @@
                 PlistLine (playerw, current, row);
                 PlistLine (playerw2, current, row);
             }
+            else if (playerListObserver == 3)
+            {
+            	row = --(teamPos[remap[current->p_team]]);
+                if ((!updatePlayer[i]) && plistPos[i] == row)
+                    continue;
+
+                plistPos[i] = row;
+                updatePlayer[i] = FALSE;
+
+                PlistLine (playerw, current, row);
+                PlistLine (playerw2, current, row);
+            }
         }            
         else
         {
-            if ((playerListObserver == 0) ||
+            if ((playerListObserver == 0) || 
                 ((playerListObserver == 1) && !(current->p_flags & PFOBSERV)) ||
-                ((playerListObserver == 2) && (current->p_flags & PFOBSERV)))
+                ((playerListObserver == 2) && (current->p_flags & PFOBSERV)) ||
+                (playerListObserver == 3))
             {
-                row = --(teamPos[remap[current->p_team]]);
+            	if (playerListObserver == 3 && (current->p_flags & PFOBSERV))
+            	    row = --plistLastRow;
+            	else
+                    row = --(teamPos[remap[current->p_team]]);
                 if ((!updatePlayer[i]) && plistPos[i] == row)
                     continue;
 
@@ -694,7 +724,10 @@
         pos = count + 1;
         plistPos[count] = pos;
 
-        if (players[count].p_status != PFREE)
+        if ( players[count].p_status != PFREE &&
+           (((playerListObserver == 0) || (playerListObserver == 3)) ||
+           ((playerListObserver == 1) && !(players[count].p_flags & PFOBSERV)) ||
+           ((playerListObserver == 2) && (players[count].p_flags & PFOBSERV))) )
         {
             PlistLine (playerw, players + count, pos);
             PlistLine (playerw2, players + count, pos);
@@ -1376,7 +1409,7 @@
         {
             if (playerListHack)
             {
-                if (playerListObserver == 0)
+                if (playerListObserver == 0 || playerListObserver == 3)
                 {
                     player_no = i;
                     break;
@@ -1396,7 +1429,7 @@
             }
             else
             {
-                if (playerListObserver == 0)
+                if (playerListObserver == 0 || playerListObserver == 3)
                 {
                     player_no = i;
                     break;
@@ -1420,7 +1453,7 @@
     {
         if (playerListHack)
         {
-            if (playerListObserver == 0)
+            if (playerListObserver == 0 || playerListObserver == 3)
                 flag = 1;
             else if (playerListObserver == 1 &&
                     (players[player_no].p_mapchars[1] <= 'f'))
@@ -1431,7 +1464,7 @@
         }
         else
         {
-            if (playerListObserver == 0)
+            if (playerListObserver == 0 || playerListObserver == 3)
                 flag = 1;
             else if (playerListObserver == 1 &&
                    !(players[player_no].p_flags & PFOBSERV))

Index: input.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- input.c	30 Apr 2006 15:59:40 -0000	1.7
+++ input.c	30 Apr 2006 20:17:47 -0000	1.8
@@ -2634,19 +2634,25 @@
 
     if (sortPlayers)
     {
-        playerListObserver++;
         switch (playerListObserver)
         {
         case (0):
-            W_MapWindow (playerw);
+            playerListObserver++;
             break;
         case (1):
+            playerListObserver++;
             break;
         case (2):
+            playerListObserver++;
             break;
         case (3):
-            playerListObserver = -1;
+            playerListObserver++;
             W_UnmapWindow (playerw);
+            break;
+        case (4):
+            playerListObserver = 0;
+            W_MapWindow (playerw);
+            break;
         }
 
         if (W_IsMapped (playerw))

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- option.c	29 Apr 2006 19:22:38 -0000	1.10
+++ option.c	30 Apr 2006 20:17:48 -0000	1.11
@@ -113,6 +113,8 @@
 static char *playerlistobservermess[] = { "Display all players in playerlist",
                                           "Display in game players only",
                                           "Display observers only",
+                                          "Display players, then observers",
+                                          "Playerlist is off",
                                           ""
 };
 
@@ -226,7 +228,7 @@
 struct int_range messagehud_range = { 0, 2, 1 };
 #endif
 
-struct int_range playerlistobserver_range = { 0, 2, 1 };
+struct int_range playerlistobserver_range = { 0, 4, 1 };
 
 struct int_range planetbitmaprange = { 0, 2, 1 };
 

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- defaults.c	29 Apr 2006 19:22:38 -0000	1.12
+++ defaults.c	30 Apr 2006 20:17:47 -0000	1.13
@@ -368,6 +368,7 @@
             "0 - all (default)",
             "1 - players",
             "2 - observers",
+            "3 - players, then observers",
             NULL
         }
     },