Date:	Tuesday February 5, 2002 @ 6:06
Author:	xyzzy

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

Modified Files:
	redraw.c 
Log Message:
Fix several bugs with observers and transferring armies.  Observers didn't
have p_docked or p_planet set to the base docked on or planet orbited.  When
the army messages were generated, they referenced the wrong planet/player. 
Fixed this by setting p_docked/p_planet for observers, hopefully this won't
trigger any bugs I didn't find.

Also fix calculation of army capacity for observers, so the kills of the
person being observed are used instead of the observer's kills, which are
always zero.


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

Index: Vanilla/ntserv/redraw.c
diff -u Vanilla/ntserv/redraw.c:1.10 Vanilla/ntserv/redraw.c:1.11
--- Vanilla/ntserv/redraw.c:1.10	Thu May 10 18:19:46 2001
+++ Vanilla/ntserv/redraw.c	Tue Feb  5 06:06:40 2002
@@ -217,7 +217,8 @@
 	  /* me->p_flags |= PFCLOAK; */
 	  me->p_dir = pl->p_dir;
 	  me->p_tractor = pl->p_tractor;
-	  
+	  me->p_docked = pl->p_docked;
+	  me->p_planet = pl->p_planet;
 	  me->p_speed = pl->p_speed;
 	  /* me->p_kills = pl->p_kills;  Very bad: will confuse enemies */
 	}
@@ -252,7 +253,7 @@
 	    me->p_y = pln->pl_y;
 	}
 	return;
-    }   /* end if I am locked onto a player */
+    }   /* end if I am locked onto a planet */
 
     /* We are not locked onto anything */
     me->p_x = -100000;
@@ -406,14 +407,17 @@
 	}
     }
 
-    if (me->p_ship.s_type == ASSAULT)
-	troop_capacity = (((me->p_kills * 3) > myship->s_maxarmies) ?
-	    myship->s_maxarmies : (int) (me->p_kills * 3));
-    else if (me->p_ship.s_type != STARBASE)
-	troop_capacity = (((me->p_kills * 2) > myship->s_maxarmies) ?
-	    myship->s_maxarmies : (int) (me->p_kills * 2));
+#ifdef OBSERVERS
+    /* Use person observed for kills if we are an observer */
+    if(Observer && (me->p_flags&PFPLOCK)) pl = &players[me->p_playerl];
     else
-	troop_capacity = me->p_ship.s_maxarmies;
+#endif
+    pl = me;	/* Not observer, just use my kills */
+
+    troop_capacity = pl->p_kills * (myship->s_type == ASSAULT)?3:2;
+    if (myship->s_type == STARBASE || troop_capacity > myship->s_maxarmies)
+    	troop_capacity = myship->s_maxarmies;
+
     if (me->p_flags & PFBEAMUP) {
         /* Messages rewritten for stats 10/20/96 [007] */
         char *txt;