This should fix everything, the problem of bots not getting their shields
sent correctly and problems with shields while observing.  Includes a
change to not send the flags of observers to other players, except for
the PFOBSERV flag.  Should also fix difficult to notice problems with
bases' shields appearing to lower when they toggle docking or shields
getting lowered and players uncloaking after a full update.  Might also
fix a longstanding problem with cow-lite, not that anyone uses that
client anymore.

I'm including the patch, less changelog entry.  For the changelog, I'm
attaching a normal diff, since darcs wants to send every patch I've made
with that one.
-------------- next part --------------

New patches:

[fix SP_2 flag sending for real
Trent Piepho <xyzzy at>**20060524002833
 The sndFlags function will not send flags of observers (except for
 PFOBSERV of course).  The SP_2 flag sampling code will sample the flags
 of robots now.  It wll not sample observers' flags, except for an
 observer's own flags.  The SP_2 sampling code will update the last sent
 flags data, so shield/cloak are not sent again via sndFlags().  When
 sndFlags() does send flags, it will sent the correct shield/cloak and not
> {
hunk ./Vanilla/ntserv/genspkt.c 154
 u_char clientVKills[MAXPLAYER*2+2 +4];
 int clientVKillsCount;
 struct stats_s_spacket singleStats;
-unsigned char n_flags[MAXPLAYER]; 
-int highest_active_player;
+static unsigned char n_flags[MAXPLAYER];
+static int highest_active_player;
 #if MAXPLAYER > 32
 static u_char	clientVXPlayers[33*4];
hunk ./Vanilla/ntserv/genspkt.c 303
+/* This function is for sending the flags of OTHER players, the player's
+   own flags are handled elsewhere.  The cambot will set f_many_self,
+   and use this function to record the flags of all players.  */
 int sndFlags( struct flags_spacket *flags, struct player *pl, int howmuch)
hunk ./Vanilla/ntserv/genspkt.c 320
     int tractor = ((F_show_all_tractors || f_many_self) && pl->p_flags&PFTRACT)?
+    if (!f_many_self && pl->p_status == POBSERV) {
+    	mask = PFOBSERV;	/* All we need to know about observers. */
+	tractor = 0;
+    } else
     if (howmuch == UPDT_ALL) {
 	mask = FLAGMASK;
 	if(F_show_all_tractors || f_many_self) mask |= PFTRACT|PFPRESS;
hunk ./Vanilla/ntserv/genspkt.c 331
     } else
 	mask = INVISOMASK;
-    /* With short packets 2 flag sampling, these don't need to be sent */
-    if (!(pl->p_flags & PFROBOT)) {
-        if (send_short > 1 && pl->p_no < 32)
-            mask &= ~(PFSHIELD|PFCLOAK);
-    }
     if ((ntohl(flags->flags)&mask) == (pl->p_flags&mask) &&
hunk ./Vanilla/ntserv/genspkt.c 1176
 	sndPlayerInfo(cpli, pl);
 	sndKills(kills, pl);
+	/* S_P2 new flag sampling */
+	if (send_short > 1) {
+	    u_int oldflags;
hunk ./Vanilla/ntserv/genspkt.c 1180
-	if(pl->p_status != POBSERV){
+	    /* Skip observers' flags, unless I am the observer. */
+	    if (pl->p_status != POBSERV || pl == me) {
hunk ./Vanilla/ntserv/genspkt.c 1183
-	    /* S_P2 new flag sampling */
-	    if(!(pl->p_flags & PFROBOT)) { /* No robos please */
 		case PALIVE: /* huh, we must work */
 		    highest_active_player = i;
hunk ./Vanilla/ntserv/genspkt.c 1188
 		    if(pl->p_flags & PFCLOAK){
 			n_flags[i] = 1;
-			break;
 		    else if(pl->p_flags & PFSHIELD){
 			n_flags[i] = 2;
hunk ./Vanilla/ntserv/genspkt.c 1206
 		    /* Is it ok to send the old value ? */
-	    } /* robos out */ 
+		/* Mark shield and cloak as updated, so they won't be resent
+		   again with a flags packet. */
+		oldflags = ntohl(flags->flags);
+		oldflags &= ~(PFSHIELD|PFCLOAK);
+		oldflags |= pl->p_flags&(PFSHIELD|PFCLOAK);
+		flags->flags = htonl(oldflags);
hunk ./Vanilla/ntserv/genspkt.c 1213
-	}
+	    }
hunk ./Vanilla/ntserv/genspkt.c 1215
+	}
 	if (sndPStatus(pstatus, pl)) {


[fix lack of shields shown on practice robots and iggies changelog
quozl at**20060523040534] 
[fix lack of shields shown on practice robots and iggies
quozl at**20060523040421
 	* ntserv/genspkt.c (sndFlags): for practice robots, terminators,
 	and hunter-killer, in conjunction with short packets version two,
 	shields were not being sent.  Changed to send shields in SP_FLAGS.
 	See also "S_P2 new flag sampling" in updateShips().  Reported by
 	William Balcerski.
jimmyhua73 at**20060523010939
 fixed indentation to follow existing code. 
 The following files were changed:
 decide.c, main.c, shmem.c, socket.c, update_players.c, util.c
[remove glib-config from
Trent Piepho <xyzzy at>**20060522212353
 The Makefile includes calls to glib-config, which aren't necessary to
 build the server, and fail if glib-config doesn't exist.  If someone
 wants to enable the (disabled) database timing functionality that uses
 glib, they can just add the options when they run configure.
[revise build test after libtoolize adoption
quozl at**20060522061037
 Stephen Thorne's addition of libtool to the configuration requires a
 change to the build test sequence, to run libtoolize and aclocal.
 Also it is no longer necessary to make configure executable, as autoconf
 does that for us.
[setteam usage fix
quozl at**20060522022327
 	* tools/setteam.c: fix error in usage propogated from setplanet,
 	and remove unnecessary include.
[Observ mask fix
williamb at**20060522014159
         * socket.c, redraw.c: removal of lockup for observers under
           declare war/transwarp/refit situations.  Reverses previous
           patch by restoring PFWAR and PFREFITTING mask to observers.
Trent Piepho <xyzzy at>**20060522210616
 The test for gmp in the res-rsa autoconf file failed for gmp version
 3.  In gmp3, functions are #define'd to different names in gmp.h, for
 example mpz_init() becomes __gmpz_init().  Since the autoconf test
 doesn't include gmp.h, it didn't find the new names.  The fix, copied
 is to just do a new test with the gmp3 names if the first test fails. 
[resolve conflicts with changelog
Stephen Thorne <stephen at>**20060522011533] 
[fix two second delay on client connection if daemon not running changelog
quozl at**20060521123415] 
[add game pause/resume/terminate tool, setgame changelog
quozl at**20060521115308] 
[add max duplicate ip count for pickup play changelog
quozl at**20060519080824] 
[add install-ntserv target for live updates changelog
quozl at**20060519061157] 
[mute banned observers changelog
quozl at**20060519042833] 
[transcription of ChangeLog data for Jimmy's patch
Stephen Thorne <stephen at>**20060522005345] 
jimmyhua73 at**20060521152116
 changelog entry here. 
     * robotd/assault.c added extra check not to bomb your own armies. 
     Bots will try to bomb own armies when 2 carriers drop on same planet.
     And planet ends up with >4 armies. 
     * robotd/decide.c changed some tabbing
     * robotd/decide.c corrected logic in check_take function. Robotd now
     takes neutral planets. Before it had a tendency to ignore neutral 
     planets. Also used to crash out when no more enemy planets. Both are
     fixed with this. 
     * robotd/main.c, shmem.c, socket.c, update_players.c
     removed mfprintf function. replaced with fprintf function until such
     time that mfprintf function is fixed so it doesn't crash. Bandaid. 
     * robotd/update_players.c changed some tabbing, added some missing
     * robotd/update_players.c changed closest_planet() function to 
     return the current closest planet instead of NULL when it cannot
     find a closer planet. 
     * robotd/util.c added comments to reflect that mfprintf causes
     crashes for as yet unknown reasons. 
[fix two second delay on client connection if daemon not running
quozl at**20060521123246
 	Remove the two second delay experienced by clients that connect to
 	a server on which the daemon is not running.  Also fix a cause of
 	initial connection failing, which happens if the daemon does not
 	start up within the hoped-for interval.
 	Solution is implemented using the SIGUSR1 signal, but only during
 	the initialisation window between when ntserv forks the daemon and
 	the daemon completes initialisation.  The signal is not used at
 	other times.
 	* ntserv/daemonII.c (main): send a SIGUSR1 to parent process
 	(ntserv) once initialisation of shared memory is completed and
 	regular SIGALRMs are about to commence.
 	* ntserv/openmem.c (openmem): remove two second delay that was
 	used to hope for daemon to initialise.
 	* ntserv/openmem.c (startdaemon): add a wait for SIGUSR1.
[add game pause/resume/terminate tool, setgame
quozl at**20060521115034
 	* tools/setgame.c: add script utility for pausing, resuming, and
 	terminating the game.
 	* tools/ add setgame target.
 	* ntserv/input.c (input): send bad version packet to terminate
 	client as soon as a GU_GAMEOK termination is requested.
 	* ntserv/daemonII.c (udplayers): terminate daemon as soon as
 	possible if a GU_GAMEOK termination is requested.  Change nplayers
 	to nfree, to better explain what the variable is.
 	* include/struct.h (game_ok): remove unused macro.
[add max duplicate ip count for pickup play
quozl at**20060519075351
 Adds a new etc/sysdef option DUPLICATES which is the maximum number of
 pickup player slots allowed from the same IP address before the next
 connection is given the Q32 response.
 This is a denial of service filtering feature.
 The default is 3.  Set this above 16 to make it ineffective.
 Set this to less than half of the number of players per side, otherwise
 abusers may not be ejected or banned by majority vote because a majority
 would be impossible.
 Does not affect robots, unless they join via the pickup queue ... which
 would be a misconfiguration.  Robots normally join via a special queue.
[add install-ntserv target for live updates
quozl at**20060519060623
 Addition of a target install-ntserv to the ntserv Makefile so that a
 server operator can do a live update of ntserv during a running game.
 The target moves the existing in-use ntserv binary into an archive
 tree before installing the new ntserv binary.  This makes it possible
 to manually back out of an installation if the new binary breaks
 Other methods to test a new ntserv binary include running it manually
 for connection back to the client.  See ntserv command line options.
[mute banned observers
quozl at**20060519042723
 Banned observers are allowed in and can speak, which was a surprise, but the
 code has always allowed this since observers were added.  Change to prevent
 banned observers from talking.  Simplify ban logic further.
[fix changelog conflict from att patch
Stephen Thorne <stephen at>**20060519024319] 
[Transwarp war errormsg
williamb at**20060519021844] 
[ATT fixes
williamb at**20060518081658] 
[patch acceptance policy regarding patch name and comment
quozl at**20060519015208
 Define a new policy of not changing ChangeLog and NEWS until release.
[resolve ChangeLog conflict again
Stephen Thorne <stephen at>**20060518095505] 
[add setteam utility source
quozl at**20060518061257
 The actual source now, so that builds complete.
[add setteam utility
quozl at**20060518055920
 Add a utility for viewing and changing the starbase reconstruction timer
 and surrender timer, both of which are in struct teams.  Although these
 timers can be manipulated by other means, setteam makes it easier to 
 Some common code now exists in setplanet.c and setteam.c that deserves
[resolve ChangeLog conflict - this is getting annoying
Stephen Thorne <stephen at>**20060518095316] 
[adding aclocal.m4
Stephen Thorne <stephen at>**20060518020621] 
[resolve conflict
Stephen Thorne <stephen at>**20060518034143] 
[move wdt reset from SIGALRM handler to input handler
quozl at**20060518024416
 Slots may jam in POUTFIT after KWINNER if the user terminates
 the client ungracefully ... such that the TCP connection is gone but
 the ntserv lives on.
 During this time, daemon synchronisation still sends SIGALRM to the
 ntserv, and ntserv's SIGALRM handler still resets the p_ghostbust
 Prototype solution is to move p_ghostbust watchdog timer reset from
 within the SIGALRM handler to the section of main loop that is
 executed when input arrives from the client.
 Monitoring the p_ghostbust timer with gdb shows it is now reset for a
 dormant client on receipt of ping responses.
[improve the autoconf system to use AC_PROG_LIBTOOL and @RANLIB@ correctly.
Stephen Thorne <stephen at>**20060518014309
 	* tests/build: Set the configure and mktrekon files executable, just in
 	* Add AC_PROG_LIBTOOL macro.
 	* ntserv/ Use the @RANLIB@ and @RANLIB_FLAGS@ macros.
[fix the OSX build by passing the -c flag to ranlib.
Stephen Thorne <stephen at>**20060517111623] 
[Fix style of some code patched by Jimmy, as per Trent's code review
Stephen Thorne <stephen at>**20060517030403] 
jimmyhua73 at**20060516075315
 Treats humans and bots differently. 
 Humans with a high planet rating > 4 are assumed to carry once they
 have a kill. 
 Humans alive longer than 5 minutes with 1 kill are also assumed to carry. 
 If you have 2 kills, the time they assume you carry drops to 2.5 minutes...
 Uses the OggV packet and "robot!" login to ID the robots. Needed to change
 server source code and newbie.c source to help support this. All
 those changes are already there if you have the newbiebetter.dpatch.
[newbie better 2 changelog fix
quozl at**20060516070248
 Applying the principles of the Software Release Practice HOWTO
jimmyhua73 at**20060516071923
 newbie now will generate t-mode games randomly any team against
 any other. Also, won't start diagonal games. 
 newbie starts up bots with -g option so server knows about the bots. 
 genspkt.c also modified so server tells clients which clients
 are newbie bots. 
 Merlin still nukes bots based on "robot!" login. So, if you want
 to pretend to be a bot, you may get nuked.  Robots will ID each
 other based both on "robot!" login and also OggV packet. 
 If you are the only player on a server and have a "robot!" login...
 The newbie game ends...
[changelog for Compilation fix for gcc4.0
quozl at**20060516040416] 
[Compilation fix for gcc4.0
williamb at**20060516015945
 Fix for jimmy's code with gcc4.0, compiler doesn't like variables declared in this way, so
 moved the int declare to top of the function.
 This patch contains the following changes:
 M ./Vanilla/robotd/assault.c -1 +1
[enable CONTINUOUS_MOUSE by default
quozl at**20060515223159
 Upgrade of Continuum to 2.11.0 revealed a regression caused by not
 adopting the features file from the previous server.
[post-release notes for 2.11.0
quozl at**20060515100328
 Changed the notes regarding the release process, to assist self or others
 for next release.
[TAG 2.11.0
quozl at**20060515091704] 
Patch bundle hash:
-------------- next part --------------
Tue May 23 17:44:09 PDT 2006  Trent Piepho <xyzzy at>
  * fix SP_2 flag sending for real changelog
--- old-netrek-server/Vanilla/ChangeLog	2006-05-23 17:45:36.000000000 -0700
+++ new-netrek-server/Vanilla/ChangeLog	2006-05-23 17:45:36.000000000 -0700
@@ -1,3 +1,13 @@
+Tue May 23 17:21:56 2006  Trent Piepho <xyzzy at>
+	* ntserv/genspkt.c Fix SP_2 flags, for real.  The sndFlags
+	function will not send flags of observers (except for PFOBSERV of
+	course).  The SP_2 flag sampling code will sample the flags of
+	robots now.  It will not sample observers' flags, except for an
+	observer's own flags.  The SP_2 sampling code will update the
+	last sent flags data, so shield/cloak are not sent again via
+	sndFlags().  When sndFlags() does send flags, it will send the
+	correct shield/cloak and not zero.
 Tue May 23 04:06:08 2006  Trent Piepho <xyzzy at>
 	* ntserv/genspkt.c Hadley's bot expects to get torp direction
 	from the server, but the server only sends it for your own torps.