Date:	Thursday May 10, 2001 @ 18:19
Author:	cameron

Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv8865/ntserv

Modified Files:
	genspkt.c redraw.c 
Log Message:
Trent Piepho's observer status patch as per vanilla-list.


****************************************

Index: Vanilla/ntserv/genspkt.c
diff -u Vanilla/ntserv/genspkt.c:1.20 Vanilla/ntserv/genspkt.c:1.21
--- Vanilla/ntserv/genspkt.c:1.20	Fri Apr 27 20:37:25 2001
+++ Vanilla/ntserv/genspkt.c	Thu May 10 18:19:46 2001
@@ -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: Vanilla/ntserv/redraw.c
diff -u Vanilla/ntserv/redraw.c:1.9 Vanilla/ntserv/redraw.c:1.10
--- Vanilla/ntserv/redraw.c:1.9	Tue Sep 21 00:06:25 1999
+++ Vanilla/ntserv/redraw.c	Thu May 10 18:19:46 2001
@@ -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;