On Tue, 23 May 2006, Trent Piepho wrote:
> Here is a pile of patches for the robot.  Most of have been discussed here

Ok, the actual patch this time.
-------------- next part --------------

New patches:

[remove glib-config from Makefile.in
Trent Piepho <xyzzy at speakeasy.org>**20060522213300
 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.
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Mon May 22 14:31:58 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* Makefile.in  Remove calls to glib-config, they aren't needed
+	and fail if glib-config isn't present.
+
 Mon May 22 14:03:38 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* res-rsa/configure.in  The check for gmp fails for gmp version 3,
 	fix it by adding a secondary check for the gmp3 symbol names.
hunk ./Vanilla/ntserv/Makefile.in 85
 all: $(PMAKE) ntserv daemonII 
 
 ntserv: $(PMAKE) $(R_OBJS)
-	$(CC) $(CFLAGS) ${LDFLAGS} -o ntserv $(R_OBJS) $(LIBS) $(LIBCRYPT) `glib-config --libs` -lgdbm
+	$(CC) $(CFLAGS) ${LDFLAGS} -o ntserv $(R_OBJS) $(LIBS) $(LIBCRYPT) -lgdbm
 
 daemonII: $(PMAKE) $(D_OBJS)
 	$(CC) $(CFLAGS) ${LDFLAGS} -o daemonII $(D_OBJS) $(EXTRALIBS)
hunk ./Vanilla/ntserv/Makefile.in 101
 	$(CC) $(CFLAGS) $(DEP) -c ${srcdir}/commands.c
 
 db.o: $(PMAKE) db.c
-	$(CC) $(CFLAGS) $(DEP) `glib-config --cflags` -c db.c
+	$(CC) $(CFLAGS) $(DEP) -c db.c
 
 cflags:
 	echo "static char cflags[]=\"$(CFLAGS) $(LIBS)\";" >../cflags.h
}
[robotd-fixes1.dpatch
jimmyhua73 at yahoo.com*-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
     braces.
 
     * 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. 
 
 
 
] 
<
> {
hunk ./Vanilla/robotd/util.c 445
 }
 #endif
 
-/* This function causes a SIGSEV, dunno why JKH */
-/* replacing it with a straight fprintf which */
-/* accomplishes the same thing */
+
 mfprintf(char *format, ...)
 {
    FILE	*fo;
hunk ./Vanilla/robotd/update_players.c 1356
 
 {
    register			k;
-   register struct planet	*pl, *rp = opl; /* zxxy */
+   register struct planet	*pl, *rp = NULL;
    register			d, mdist = INT_MAX;
 
    if(opl && (mdist = ihypot((double)(j->p_x - opl->pl_x), 
hunk ./Vanilla/robotd/update_players.c 1097
       return;
    }
    if(/* from < 0 ||*/ from >= MAXPLAYER){
-     /* mfprintf(stderr, "process_general_message: unknown player %d\n", from); */
-     fprintf(stderr, "process_general_message: unknown player %d\n", from); 
+      mfprintf(stderr, "process_general_message: unknown player %d\n", from);
       return;
    }
    p = &_state.players[from];
hunk ./Vanilla/robotd/update_players.c 282
       if(_state.player_type == PT_OGGER || _state.player_type == PT_DOGFIGHTER){
 	 timer ++;
 	 if(timer == 100){
-	   /* mfprintf(stderr, "nobody to fight\n"); */
-	    fprintf(stderr, "nobody to fight\n");
+	    mfprintf(stderr, "nobody to fight\n");
 	    exitRobot(0);
 	 }
       }
hunk ./Vanilla/robotd/update_players.c 145
 	 army_check1(p, j);
 	 army_check2(p, j);
       }
-
-      if(p->invisible) {
-	  p->closest_pl = NULL;
-      } else {
-	  p->closest_pl = closest_planet(j, &pldist, p->closest_pl);
-	  p->closest_pl_dist = pldist;
-      }
+      if(p->invisible)
+	 p->closest_pl = NULL;
+      else
+	 p->closest_pl = closest_planet(j, &pldist, p->closest_pl);
+      p->closest_pl_dist = pldist;
 
       if(j->p_flags & PFBOMB)
 	 p->bombing = _udcounter;
hunk ./Vanilla/robotd/socket.c 2412
     int attempts;
 
     if (udpSock >= 0) {
-      /* mfprintf(stderr, "netrek: tried to open udpSock twice\n"); */
-        fprintf(stderr, "netrek: tried to open udpSock twice\n");
+        mfprintf(stderr, "netrek: tried to open udpSock twice\n");
         return (0);     /* pretend we succeeded (this could be bad) */
     }
 
hunk ./Vanilla/robotd/socket.c 2395
         UDPDIAG(("Received UDP verification\n"));
         break;
     default:
-      /* mfprintf(stderr, "netrek: Got funny reply (%d) in UDP_REPLY packet\n",
-	 packet->reply); */
-        fprintf(stderr, "netrek: Got funny reply (%d) in UDP_REPLY packet\n",
+        mfprintf(stderr, "netrek: Got funny reply (%d) in UDP_REPLY packet\n",
                 packet->reply);
 
         break;
hunk ./Vanilla/robotd/socket.c 1921
         if (n < 0){
 #ifdef ATM
             if (fd == udpSock) {
-	        /* mfprintf(stderr, "Tried to write %d, 0x%x, %d (error %d)\n",
-		 fd, buf, bytes, errno); */
-                fprintf(stderr, "Tried to write %d, 0x%x, %d (error %d)\n",
+                mfprintf(stderr, "Tried to write %d, 0x%x, %d (error %d)\n",
                     fd, buf, bytes, errno);
 	        perror("write");
                 printUdpInfo();
hunk ./Vanilla/robotd/shmem.c 178
    int			tv = mtime(0), htv;
 
    if(!(j->p_flags & PFCLOAK)){
-      /* mfprintf(stderr, "shmem_cloakd: player not cloaked\n"); */
-      fprintf(stderr, "shmem_cloakd: player not cloaked\n");
+      mfprintf(stderr, "shmem_cloakd: player not cloaked\n");
       return 0;
    }
    /* assign my idea of location */
hunk ./Vanilla/robotd/main.c 433
 	 if(team != _state.team && team != -1){
 	    timer2 = 0;
 	    _state.team = team;
-	    if (!teamRequest(team, s_type)){
-              /* mfprintf(stderr, "team or ship rejected.\n"); */
-	      fprintf(stderr, "team or ship rejected.\n");
-	      showteams();
+	    if(!teamRequest(team, s_type)){
+	       mfprintf(stderr, "team or ship rejected.\n");
+	       showteams();
 	    }
 	    else 
 	       break;
hunk ./Vanilla/robotd/decide.c 713
 	     if(pl->pl_mydist < 20000 && pl_defended(pl,3)) continue;
 	   */
 
-	   if(pl->pl_mydist < min_dist){
-	       tpl = pl;
-	       min_dist = pl->pl_mydist;
-	   }
-       }
+	 if(pl->pl_mydist < min_dist){
+	    tpl = pl;
+	    min_dist = pl->pl_mydist;
+	 }
+      }
    }
    if(tpl){
       if(pls->total_textra_armies + me->p_armies < tpl->pl_armies)
hunk ./Vanilla/robotd/decide.c 702
       }
    }
 
-   /* take indep planet first over regular planets */
-   /* but take agris first if you have the armies */
-   if (!tpl || !(tpl->pl_flags&PLAGRI && me->p_armies >= 5) ) {
-       min_dist = GWIDTH;	/* ind overrides non-ind */
-       for(k=0; k< pls->num_indsp; k++){
-	   pl = pls->ind_planets[k];
-	   
-	   /*
-	     if(pl->pl_mydist < 20000 && pl_defended(pl,3)) continue;
-	   */
+	 /*
+	 if(pl->pl_mydist < 20000 && pl_defended(pl,3)) continue;
+	 */
 
 	 if(pl->pl_mydist < min_dist){
 	    tpl = pl;
hunk ./Vanilla/robotd/decide.c 701
 	 min_dist = pl->pl_mydist;
       }
    }
+   if(!(pl->pl_flags & PLAGRI) || me->p_armies >= 5){
+      min_dist = GWIDTH;	/* ind overrides non-ind */
+      for(k=0; k< pls->num_indsp; k++){
+	 pl = pls->ind_planets[k];
 
 	 /*
 	 if(pl->pl_mydist < 20000 && pl_defended(pl,3)) continue;
hunk ./Vanilla/robotd/decide.c 686
 
    if(pls->total_textra_armies == 0 && me->p_armies == 0) return 0;
 
-   /* find a planet to take */
    for(k=0; k< pls->num_warteamsp; k++){
       pl = pls->warteam_planets[k];
 
hunk ./Vanilla/robotd/decide.c 173
 
 decide_take()
 {
-   PlanetRec	 *pls = _state.planets;
+   PlanetRec		*pls = _state.planets;
    struct planet *tpl = _state.assault_planet;
    struct planet *cpl = me_p->closest_pl;
 
hunk ./Vanilla/robotd/assault.c 198
    else
       req_cloak_off("no cloak in assault_planet()");
 
-   /* Extra check not to bomb your own armies that you just */
-   /* dropped onto a planet you took */
-   /* Sometimes the bots will try to bomb friendly planets too */
-   /* will need to reset the warring if this happens */
-   /* that should happen elsewhere */
-   if( (armies > 4) && ( pl->pl_owner != me->p_team ) ){
+   if(armies > 4){
       req_bomb();
       return;
    }
}
[fix mfprintf()
Trent Piepho <xyzzy at speakeasy.org>**20060522224042
 When mfprintf() was changed from varargs to stdarg, it wasn't done
 correctly.  Fix this.
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Mon May 22 15:39:35 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* robotd/util.c When mfprintf() was change from varargs to stdarg,
+	it wasn't done correctly.  Fix this.
+
 Mon May 22 14:31:58 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* Makefile.in  Remove calls to glib-config, they aren't needed
 	and fail if glib-config isn't present.
hunk ./Vanilla/robotd/util.c 446
 #endif
 
 
-mfprintf(char *format, ...)
+mfprintf(FILE *fo, char *format, ...)
 {
hunk ./Vanilla/robotd/util.c 448
-   FILE	*fo;
    va_list	ap;
 
    if(!read_stdin)
hunk ./Vanilla/robotd/util.c 454
       return;
    
    va_start(ap, format);
-   fo = va_arg(ap, FILE *);
    (void)vfprintf(fo, format, ap);
    fflush(stdout);
    va_end(ap);
}
[adapt when assaulting
Trent Piepho <xyzzy at speakeasy.org>**20060523074525
 The assault planet code didn't re-check the target planet after the
 assult started.  If the planet was taken by another player on a friendly
 team, or modified by god, the robot would still try to bomb/take it, even
 when that action was no longer possible.  The robot will now check for
 planets is can not drop on, and abort the assault if so.  It will not try
 to bomb planets it can not bomb.  It will also stop reinforcing planets
 when they get to 4 armies.
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Mon May 22 16:31:58 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* robotd/assault.c Have robot check the planet status in
+	assault code, so that if a planet changes teams while it
+	being assaulted the robot will adapt.  It will not try to drop
+	on a planet it can not drop on, and not try to bomb a planet
+	it can not bomb.
+	Also, the robot will not reinforce a planet past 4 armies after
+	it takes it.
+
 Mon May 22 15:39:35 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* robotd/util.c When mfprintf() was change from varargs to stdarg,
 	it wasn't done correctly.  Fix this.
hunk ./Vanilla/robotd/assault.c 198
    else
       req_cloak_off("no cloak in assault_planet()");
 
-   if(armies > 4){
+   /* Planets that _can_ be dropped on:
+   1. Planets owned by your team
+   2. Planets that you are hostile to
+   3. Independent planets (owned by team 0)
+   Everything else can't be dropped on.  Planets in groups 1 and 3 _can't_
+   be bombed, only group 2 can be bombed, ie. bombable planets is a
+   proper subset of droppable planets. */
+
+   /* Turn off assault for non-droppable (thus non-bombable too) planets. */
+   if(!unknownpl(pl) && !( (pl->pl_owner == me->p_team) ||
+   	((me->p_swar|me->p_hostile) & pl->pl_owner) ||
+	(pl->pl_owner == 0) )){
+      req_shields_up();
+      unassault_c("planet not droppable");
+      return;
+   }
+
+   if(pl->pl_owner == me->p_team && pl->pl_armies >= 4){
+      req_shields_up();
+      unassault_c("planet fully reinforced");
+      return;
+   }
+
+   /* Only bomb bombable planets. */
+   if(armies > 4 && ((me->p_swar|me->p_hostile) & pl->pl_owner)){
       req_bomb();
       return;
    }
}
[fix neutral planet check
Trent Piepho <xyzzy at speakeasy.org>**20060523074946
 Fix several bugs with check_take().  It didn't handle the case when no
 enemy planets were left.  It looked at the last enemy planet in the list,
 rather than the target enemy planet when deciding if it should take neut
 planets.  It would skip looking for neuts when it found an enemy agri and
 _didn't_ have enough armies to take it.
         
 Now it handles no enemy planets left.  It only skips looking for neut
 planets in preference of enemy planets if it has found an enemy agri and
 it _does_ have enough armies to take it.  In that case, the agri take
 will take precedence.
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Mon May 22 16:53:42 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* robotd/decide.c Fix several bugs with check_take().
+	It didn't handle the case when no enemy planets were left.  It
+	looked at the last enemy planet in the list, rather than the
+	target enemy planet when deciding if it should take neut planets.
+	It would skip looking for neuts when it found an enemy agri and
+	*didn't* have enough armies to take it.
+
 Mon May 22 16:31:58 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* robotd/assault.c Have robot check the planet status in
 	assault code, so that if a planet changes teams while it
hunk ./Vanilla/robotd/decide.c 686
 
    if(pls->total_textra_armies == 0 && me->p_armies == 0) return 0;
 
+   /* Look for closest takeable enemy planet */
    for(k=0; k< pls->num_warteamsp; k++){
       pl = pls->warteam_planets[k];
 
hunk ./Vanilla/robotd/decide.c 701
 	 min_dist = pl->pl_mydist;
       }
    }
-   if(!(pl->pl_flags & PLAGRI) || me->p_armies >= 5){
+   /* Look for ind planets in preference to enemy, unless we found an
+   enemy agri and have the armies to take it.  In that case, the agri
+   take is better. */
+   if(!(tpl && (tpl->pl_flags & PLAGRI) && me->p_armies >= 5)){
       min_dist = GWIDTH;	/* ind overrides non-ind */
       for(k=0; k< pls->num_indsp; k++){
 	 pl = pls->ind_planets[k];
}
[fix closest_planet
Trent Piepho <xyzzy at speakeasy.org>**20060523075548
 closest_planet() would usually return NULL every other time it was
 called.  For speed, it would check the previous closest planet first,
 then look for a _closer_ planet.  If it didn't find one, it returned
 NULL, rather than the previous (and current) closest planet (which
 it now returns).  
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Tue May 23 00:52:55 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* robotd/update_players.c The function closest_planet() would
+	usually return NULL every other time it was called.  For speed,
+	it would check the previous closest planet first, then look
+	for a _closer_ planet.  If it didn't find one, it returned
+	NULL, rather than the previous (and current) closest planet.
+
 Mon May 22 16:53:42 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* robotd/decide.c Fix several bugs with check_take().
 	It didn't handle the case when no enemy planets were left.  It
hunk ./Vanilla/robotd/update_players.c 1352
 
 {
    register			k;
-   register struct planet	*pl, *rp = NULL;
+   register struct planet	*pl, *rp = opl;
    register			d, mdist = INT_MAX;
 
    if(opl && (mdist = ihypot((double)(j->p_x - opl->pl_x), 
hunk ./Vanilla/robotd/update_players.c 1361
       return opl;
    }
 
-   *dist = INT_MAX;
-
    for(k=0, pl=planets; k < MAXPLANETS; k++, pl++){
 
       d = ihypot((double)(j->p_x - pl->pl_x), (double)(j->p_y - pl->pl_y));
}
[fix crash in RCD generation
Trent Piepho <xyzzy at speakeasy.org>**20060523080023
 The code to generate the RCD message didn't handle the case when there
 were no visible friendly and/or enemy ships.  In this case,
 _state.closest_{e,f} would be NULL.  Do what clients do in this case, and
 use me->p_no when no suitable other player is known.
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Tue May 23 00:57:29 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* robotd/dmessage.c The code to generate the RCD message didn't
+	handle the case when there were no visible friendly and/or enemy
+	ships.  In this case, _state.closest_{e,f} would be NULL.
+
 Tue May 23 00:52:55 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* robotd/update_players.c The function closest_planet() would
 	usually return NULL every other time it was called.  For speed,
hunk ./Vanilla/robotd/dmessage.c 1866
     dist.distype = i;
 
     dist.close_pl = me_p->closest_pl->pl_no;
-    dist.close_en = _state.closest_e->p->p_no;
-    dist.close_fr = _state.closest_f->p->p_no;
-    dist.close_j = (_state.closest_e->dist < _state.closest_f->dist) ?
-                    dist.close_en : dist.close_fr;
+    dist.close_en = _state.closest_e ? _state.closest_e->p->p_no : me->p_no;
+    dist.close_fr = _state.closest_f ? _state.closest_f->p->p_no : me->p_no;
+    if(!_state.closest_f) {
+       dist.close_j = dist.close_en;
+    } else if(!_state.closest_e) {
+       dist.close_j = dist.close_fr;
+    } else {
+       dist.close_j = (_state.closest_e->dist < _state.closest_f->dist) ?
+		       dist.close_en : dist.close_fr;
+    }
                     
     /* These are just guesses.... */
     dist.tclose_pl = 0;
}
[fix use of un-initialized variable
Trent Piepho <xyzzy at speakeasy.org>**20060523080845
 Fix a warning about a un-initialized use of pldist in update_players(). 
 It didn't matter, but fix the warning anyway.
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Tue May 23 01:07:02 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* robotd/update_players.c Fix a warning about a uninitialized use
+	of pldist in update_players().
+
 Tue May 23 00:57:29 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* robotd/dmessage.c The code to generate the RCD message didn't
 	handle the case when there were no visible friendly and/or enemy
hunk ./Vanilla/robotd/update_players.c 145
 	 army_check1(p, j);
 	 army_check2(p, j);
       }
-      if(p->invisible)
+      if(p->invisible){
 	 p->closest_pl = NULL;
hunk ./Vanilla/robotd/update_players.c 147
-      else
+      }
+      else {
 	 p->closest_pl = closest_planet(j, &pldist, p->closest_pl);
hunk ./Vanilla/robotd/update_players.c 150
-      p->closest_pl_dist = pldist;
+	 p->closest_pl_dist = pldist;
+      }
 
       if(j->p_flags & PFBOMB)
 	 p->bombing = _udcounter;
}
[fix calls to req_cloak_off()
Trent Piepho <xyzzy at speakeasy.org>**20060523085409
 Some calls to req_cloak_off() were missing the function's argument
 (reason string).
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Tue May 23 01:51:17 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* robotd/assault.c, robotd/escort.c, robotd/getarmies.c,
+	robotd/robot.c Some calls to req_cloak_off() were missing the
+	function's argument (reason string).
+
 Tue May 23 01:07:02 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* robotd/update_players.c Fix a warning about a uninitialized use
 	of pldist in update_players().
hunk ./Vanilla/robotd/assault.c 179
 
 #ifdef nodef
    if(!do_cloak(0))
-      req_cloak_off();
+      req_cloak_off("no do cloak");
 #endif
 
    cloak=0; /* start assuming you don't need to cloak */
hunk ./Vanilla/robotd/escort.c 52
    /* check internal state */
    switch(_state.escort){
       case 0:
-	 req_cloak_off();
+	 req_cloak_off("escort: 0");
 	 /* just got request, need to go to planet */
 	 if(DEBUG & DEBUG_ESCORT)
 	    printf("goto escort planet %s\n", escpl->pl_name);
hunk ./Vanilla/robotd/escort.c 61
 
       case 1:
 	 /* close enough to escort planet .. wait for escortee */
-	 req_cloak_off();
+	 req_cloak_off("escort: 1");
 	 if(DEBUG & DEBUG_ESCORT)
 	    printf("wait for escort %s\n", escp->p->p_mapchars);
 	 wait_for_escort(escp, escpl);
hunk ./Vanilla/robotd/escort.c 85
 	 break;
       
       case 5:
-	 req_cloak_off();
+	 req_cloak_off("escort: 5");
 	 /* do defenders */
 	 if(DEBUG & DEBUG_ESCORT)
 	    printf("no defenders\n");
hunk ./Vanilla/robotd/getarmies.c 176
    else{
       _state.lock = 0;
       req_shields_up();
-      req_cloak_off();
+      req_cloak_off("no armies to beam");
       _state.p_desspeed = me->p_speed;
       return;
    }
hunk ./Vanilla/robotd/robot.c 722
    }
    if((me->p_flags & PFCLOAK) &&
       me->p_ship.s_type != ASSAULT && (!pl || !(pl->pl_flags & PLFUEL))){
-      req_cloak_off();
+      req_cloak_off("recharge: no fuel planet");
    }
 
    if(_state.pl_danger){
}
[fix res danger
Trent Piepho <xyzzy at speakeasy.org>**20060523100806
 The check for res danger would make the robot cloak when near _any_ home
 planet, so it would cloak even when bombing it's own core.  Unfortunately,
 it is not possible to tell from the planet flags whose home world a
 planet is.  Changed the code to only check the normal home planet
 indexes, skipping it's own HW, for proximity.  This makes the code much
 smaller and faster.  Realistically, the HWs are always at the standard
 indexes, even with non-standard planet layouts.  Included a bit of code,
 #if'ed out, that will find home worlds by name, the way the bot does when
 it wants to refit.
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Tue May 23 03:05:55 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* robotd/assault.c  The check for res danger would make the
+	robot cloak when near _any_ home planet, so it would
+	cloak even when bombing it's own core.  Fixed this, and made
+	it faster too.
+
 Tue May 23 01:51:17 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* robotd/assault.c, robotd/escort.c, robotd/getarmies.c,
 	robotd/robot.c Some calls to req_cloak_off() were missing the
hunk ./Vanilla/robotd/assault.c 49
 /* determine if there is risk of death due to res of opponent */
 static int risk_res_death(struct planet *pl)
 {
-  int i;
-  if (pl == NULL) return 0;
-  /* One of the home planets identified by server etc/sysdef PLANETS */
-  if (pl->pl_flags & PLHOME) return 1;
-  /* Altair in standard position */
-  if (pl->pl_no == 7 && pl->pl_x == 11000 && pl->pl_y == 75000) return 1;
-  /* Draconis in standard position */
-  if (pl->pl_no == 16 && pl->pl_x == 28000 && pl->pl_y == 23000) return 1;
-  /* Scorpii in standard position */
-  if (pl->pl_no == 26 && pl->pl_x == 70720 && pl->pl_y == 26320) return 1;
-  /* Within rectangular phaser distance of any home planet res point */
-  for (i=0,pl=planets;i<MAXPLANETS;i++,pl++) {
-    if (pl->pl_flags & PLHOME) {
-      if(ABS(pl->pl_x - me->p_x) < 12000 && ABS(pl->pl_y - me->p_y) < 12000) {
-	return 1;
+   /* Home planet locations.  This will not work if the HWs are not at
+   their normal indexes.  This should always be the case, even for
+   non-standard planet layouts. */
+   const static int hw[4] = {0, 10, 20, 30};
+   int i;
+
+#if 0
+   /* Code to find home planets by name, like the bot does to refit. */
+   static int found_hw = 0;
+   if(!found_hw) {
+      extern struct planet *team_planet(int);
+      hw[0] = (team_planet(FED)?:&planets[0])->pl_no;
+      hw[1] = (team_planet(ROM)?:&planets[0])->pl_no;
+      hw[2] = (team_planet(KLI)?:&planets[0])->pl_no;
+      hw[3] = (team_planet(ORI)?:&planets[0])->pl_no;
+      found_hw = 1;
+      mfprintf(stderr, "planets at %d %d %d %d\n", hw[0], hw[1], hw[2], hw[3]);
+   }
+#endif
+
+   if(pl == NULL) return 0;
+
+   for(i = 0; i < 4; i++){
+      if((1<<i) == me->p_team) continue; /* No danger at MY homeworld */
+
+      pl = &planets[hw[i]];
+      /* Inside rectangular phaser/tractor range of a ressing ship. */
+      if(ABS(pl->pl_x - me->p_x) < 12200 && ABS(pl->pl_y - me->p_y) < 12200){
+	 return 1;
       }
hunk ./Vanilla/robotd/assault.c 79
-    }
-  }
-  return 0;
+   }
+   return 0;
 }
 
 goto_assault_planet()
}
[torp dir for robot
Trent Piepho <xyzzy at speakeasy.org>**20060523110921
 Hadley's bot expects to get torp direction from the server, but the
 server only sends it for your own torps.  Changed to send it for other
 torps too.  Without it, the bot thinks all torps are going straight up,
 making it a very bad dodger (unless you attack from below).  
 
 This should be fixed to only turn this on for the robot, so as not to
 help borgs.  This will have to wait on a better way to detect robots.
] 
<
> {
hunk ./Vanilla/ChangeLog 1
+Tue May 23 04:06:08 2006  Trent Piepho <xyzzy at speakeasy.org>
+	* ntserv/genspkt.c Hadley's bot expects to get torp direction
+	from the server, but the server only sends it for your own torps. 
+	Changed to send it for other torps too.  Without it, the bot
+	thinks all torps are going straight up, making it a very bad
+	dodger (unless you attack from below).  Should be fixed to only
+	turn this on for the robot, so as not to help borgs.
+
 Tue May 23 03:05:55 2006  Trent Piepho <xyzzy at speakeasy.org>
 	* robotd/assault.c  The check for res danger would make the
 	robot cloak when near _any_ home planet, so it would
hunk ./Vanilla/ntserv/genspkt.c 564
 	tp->type = SP_TORP;
 	tp->x    = htonl(t->t_x);
 	tp->y    = htonl(t->t_y);
+	tp->dir  = t->t_dir; /* The robot needs this */
 	tp->tnum = htons(i);
 	sendClientPacket(tp);
 	if ( (t->t_status != tpi->status)
}

Context:

[resrsa-gmp-autoconf.darcs
Trent Piepho <xyzzy at speakeasy.org>**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
 from http://www.kaffe.org/pipermail/kaffe/2000-November/090303.html,
 is to just do a new test with the gmp3 names if the first test fails. 
] 
[resolve conflicts with changelog
Stephen Thorne <stephen at thorne.id.au>**20060522011533] 
[fix two second delay on client connection if daemon not running changelog
quozl at us.netrek.org**20060521123415] 
[add game pause/resume/terminate tool, setgame changelog
quozl at us.netrek.org**20060521115308] 
[add max duplicate ip count for pickup play changelog
quozl at us.netrek.org**20060519080824] 
[add install-ntserv target for live updates changelog
quozl at us.netrek.org**20060519061157] 
[mute banned observers changelog
quozl at us.netrek.org**20060519042833] 
[transcription of ChangeLog data for Jimmy's patch
Stephen Thorne <stephen at thorne.id.au>**20060522005345] 
[robotd-fixes1.dpatch
jimmyhua73 at yahoo.com**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
     braces.
 
     * 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 us.netrek.org**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 us.netrek.org**20060521115034
 
 	* tools/setgame.c: add script utility for pausing, resuming, and
 	terminating the game.
 
 	* tools/Makefile.in: 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 us.netrek.org**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 us.netrek.org**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
 badly.
 
 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 us.netrek.org**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 thorne.id.au>**20060519024319] 
[Transwarp war errormsg
williamb at its.caltech.edu**20060519021844] 
[ATT fixes
williamb at its.caltech.edu**20060518081658] 
[patch acceptance policy regarding patch name and comment
quozl at us.netrek.org**20060519015208
 Define a new policy of not changing ChangeLog and NEWS until release.
] 
[resolve ChangeLog conflict again
Stephen Thorne <stephen at thorne.id.au>**20060518095505] 
[add setteam utility source
quozl at us.netrek.org**20060518061257
 The actual source now, so that builds complete.
] 
[add setteam utility
quozl at us.netrek.org**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 
 script.
 
 Some common code now exists in setplanet.c and setteam.c that deserves
 factorisation.
] 
[resolve ChangeLog conflict - this is getting annoying
Stephen Thorne <stephen at thorne.id.au>**20060518095316] 
[adding aclocal.m4
Stephen Thorne <stephen at thorne.id.au>**20060518020621] 
[resolve conflict
Stephen Thorne <stephen at thorne.id.au>**20060518034143] 
[move wdt reset from SIGALRM handler to input handler
quozl at us.netrek.org**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
 timer.
 
 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 thorne.id.au>**20060518014309
 	* tests/build: Set the configure and mktrekon files executable, just in
 	case.
 
 	* configure.in: Add AC_PROG_LIBTOOL macro.
 
 	* ntserv/Makefile.in: Use the @RANLIB@ and @RANLIB_FLAGS@ macros.
] 
[fix the OSX build by passing the -c flag to ranlib.
Stephen Thorne <stephen at thorne.id.au>**20060517111623] 
[Fix style of some code patched by Jimmy, as per Trent's code review
Stephen Thorne <stephen at thorne.id.au>**20060517030403] 
[updateplayers.dpatch
jimmyhua73 at yahoo.com**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.
 
 Jimmy
 
] 
[newbie better 2 changelog fix
quozl at us.netrek.org**20060516070248
 Applying the principles of the Software Release Practice HOWTO
 http://www.tldp.org/HOWTO/Software-Release-Practice-HOWTO/
] 
[newbiebetter.dpatch
jimmyhua73 at yahoo.com**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 us.netrek.org**20060516040416] 
[Compilation fix for gcc4.0
williamb at its.caltech.edu**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 us.netrek.org**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 us.netrek.org**20060515100328
 Changed the notes regarding the release process, to assist self or others
 for next release.
] 
[TAG 2.11.0
quozl at us.netrek.org**20060515091704] 
Patch bundle hash:
7b5ddf2aa0cf2d038e3f1bb0472d96e99df60bf0