This should fix observer status.  Currently you get told you are an observer
with the PFOBSERVE flag only when you are obsing another player.  If you are
looking at nothing or a planet, it's not set.  Other players are not told who
is an observer.

This patch sets the obs flag all the time for observers, looking at a player,
planet, or nothing.  It also sends this flag to other players, so they know
who is an obs and who isn't.  I also made a change so that certain other flags
aren't sent to other players.  There is no reason to know if someone else is
bombing a planet or is orbiting.  Only a borg would ever use this information.

This change works with COW and paradise 2000.  COW and P2000 will let
observers see kills, max armies, and torps out correctly.  P2000 will mark
observers as 'ob' in the player list.  It should also work with older
non-paradise clients, which will just ignore the flag.

The observer flag conflicts with the paradise warp flag.  This is unfortunate,
as some vanilla person could have chosen the bits so that the paradise warp
flag was the same as the bronco twarp flag, and observer flag was something
unused.  When observing with the old paradise or tedturner clients, the
client will think you are at warp when you obs a player.  This isn't a problem
really, but you get the star-streak warp effect when you switch from obsing a
player to obsing a planet/nothing, as warp gets toggled.  My patch will in
fact fix this, as the observer/warp flag will stop getting toggled and that is
what triggers the stars.

Maybe someone with crusty old windoze clients could check if they can handle
this ok.  Except cow-lite, which doesn't work with the current server anyway. 
Maybe cow-lite's keys should be removed, so people stop playing with the buggy
old client.
-------------- next part --------------
Index: include/struct.h
===================================================================
RCS file: /home/netrek/cvsroot/Vanilla/include/struct.h,v
retrieving revision 1.1
diff -u -r1.1 struct.h
--- include/struct.h	2001/05/02 02:00:19	1.1
+++ include/struct.h	2001/05/09 23:03:41
@@ -95,8 +95,10 @@
 #define PALIVE 		   0x0002
 #define PEXPLODE 	   0x0003
 #define PDEAD 		   0x0004
+/* Status value for paradise's t-mode queue feature
+#define PTQUEUE		   0x0005 */
 #ifdef OBSERVERS
-#define POBSERV		   0x005           /* not really dead, but observer. */
+#define POBSERV		   0x0006           /* not really dead, but observer. */
 #endif
  
 #define PFSHIELD	   0x0001
Index: ntserv/genspkt.c
===================================================================
RCS file: /home/netrek/cvsroot/Vanilla/ntserv/genspkt.c,v
retrieving revision 1.20
diff -u -r1.20 genspkt.c
--- ntserv/genspkt.c	2001/04/28 01:37:25	1.20
+++ ntserv/genspkt.c	2001/05/09 23:03:41
@@ -307,37 +307,37 @@
 inline static int
 sndFlags( struct flags_spacket *flags, struct player *pl, int howmuch)
 {
-/*#define FLAGMASK (PFSHIELD|PFBOMB|PFORBIT|PFCLOAK|PFROBOT|PFBEAMUP|PFBEAMDOWN|PFPRACTR|PFDOCK|PFTRACT|PFPRESS|PFDOCKOK) atm mask */
+/*#define FLAGMASK (PFSHIELD|PFBOMB|PFORBIT|PFCLOAK|PFROBOT|PFBEAMUP|PFBEAMDOWN|PFPRACTR|PFDOCK|PFTRACT|PFPRESS|PFDOCKOK) aieee, too much.  7/27/91 TC */ 
+/*#define FLAGMASK (PFSHIELD|PFBOMB|PFORBIT|PFCLOAK|PFROBOT|                    PFPRACTR|PFDOCK|PFTRACT|PFPRESS|PFDOCKOK) still more than needed */
 
-/* #define FLAGMASK (PFSHIELD|PFBOMB|PFORBIT|PFCLOAK|PFROBOT|PFBEAMUP|PFBEAMDOWN|PFPRACTR|PFDOCK|PFTRACT|PFPRESS|PFDOCKOK) aieee, too much.  7/27/91 TC */ 
+/* Flags we get to know about players not seen */
+#define INVISOMASK (PFCLOAK|PFROBOT|PFPRACTR|PFDOCKOK|PFOBSERV)
+/* Flags we get to know about players who are seen */
+#define FLAGMASK   (PFSHIELD | INVISOMASK)
 
-#define FLAGMASK (PFSHIELD|PFBOMB|PFORBIT|PFCLOAK|PFROBOT|PFPRACTR|PFDOCK|PFTRACT|PFPRESS|PFDOCKOK)
-#define INVISOMASK (PFCLOAK|PFROBOT|PFPRACTR|PFDOCKOK)
-
     int mask;
     int tractor = (F_show_all_tractors && pl->p_flags&PFTRACT)?
                       (pl->p_tractor|0x40):0;
 
-    if (howmuch == UPDT_ALL)
+    if (howmuch == UPDT_ALL) {
 	mask = FLAGMASK;
-    else
-	mask = INVISOMASK | (F_show_all_tractors?PFTRACT|PFPRESS:0);
+	if(F_show_all_tractors) mask |= PFTRACT|PFPRESS;
+    } else
+	mask = INVISOMASK;
+	
+    /* With short packets 2 flag sampling, these don't need to be sent */
+    if (send_short>1 && pl->p_no<32)
+    	mask &= ~(PFSHIELD|PFCLOAK);
+
 
-    if (flags->flags==htonl(mask&pl->p_flags) &&
-        flags->tractor==tractor )
+    if ((ntohl(flags->flags)&mask) == (pl->p_flags&mask) &&
+        flags->tractor==tractor)
 	/* Nothing has changed, don't send a packet */
 	return FALSE;
 
     flags->type=SP_FLAGS;
     flags->pnum=pl->p_no;
     flags->flags=htonl(mask & pl->p_flags);
-
-    if (send_short>1 && pl->p_ship.s_type!=STARBASE &&
-        flags->tractor==tractor &&
-	!(pl->p_flags&PFROBOT) && pl->p_no<32)
-	/* S_P2 flags already sent, so don't send anything */
-	return FALSE;
-
     flags->tractor = tractor;
 
     sendClientPacket(flags);
Index: ntserv/redraw.c
===================================================================
RCS file: /home/netrek/cvsroot/Vanilla/ntserv/redraw.c,v
retrieving revision 1.9
diff -u -r1.9 redraw.c
--- ntserv/redraw.c	1999/09/21 05:06:25	1.9
+++ ntserv/redraw.c	2001/05/09 23:03:41
@@ -124,12 +124,12 @@
 
     if (!Observer) return;
     if (me->p_status != POBSERV) {
-      if (me->p_status == PDEAD || me->p_status == PEXPLODE) {
+	if (me->p_status == PDEAD || me->p_status == PEXPLODE) {
             death ();
             return;
         }else{
 	    if (me->p_status == PFREE){
-	      ERROR(1,("check_observs:  changing a PFREE!\n"));
+		ERROR(1,("check_observs:  changing a PFREE!\n"));
 	    }
             me->p_status = POBSERV;
 	}
@@ -170,6 +170,7 @@
         return;
     }
 
+    me->p_flags |= PFOBSERV;  /* future clients may understand this */
     /* Check if I am locked onto a player */
     if (me->p_flags & PFPLOCK) {
         if ( (me->p_playerl < 0) || (me->p_playerl >= MAXPLAYER) ){
@@ -208,13 +209,13 @@
 	  me->p_fuel = pl->p_fuel;
 	  me->p_wtemp = pl->p_wtemp;
 	  me->p_etemp = pl->p_etemp;
-	  me->p_flags = (pl->p_flags & ~(PFSELFDEST | PFPLOCK | PFPLLOCK)) |
-	    (me->p_flags & (PFSELFDEST | PFPLOCK | PFPLLOCK));
+	  /* These flags shouldn't be propagated to observers */
+#define NOOBSMASK	(PFSELFDEST|PFPLOCK|PFPLLOCK|PFOBSERV)
+	  me->p_flags = (pl->p_flags & ~NOOBSMASK) | (me->p_flags & NOOBSMASK);
 	  
 	  /* always cloaked, state of person watched will be obvious */
 	  /* me->p_flags |= PFCLOAK; */
 	  me->p_dir = pl->p_dir;
-	  me->p_flags |= PFOBSERV;  /* future clients may understand this */
 	  me->p_tractor = pl->p_tractor;
 	  
 	  me->p_speed = pl->p_speed;