On Thu, 18 May 2006, Jimmy Huang wrote:
> > > This is the correct fix:
> > >
> > > -   if(!(pl->pl_flags & PLAGRI) || me->p_armies >=
> > > 5){
> > > +   if(!tpl || !(tpl->pl_flags & PLAGRI) ||
> > > me->p_armies < 5){
> Hi. Although logically that is correct. It is real
> tough to figure out what that if statement means!
> I split it apart and re-wrote it in the attached
> patch. Hopefully you like it.

It would be better if you just added a comment to what the if statement means,
rather than add in more code and extra variables.  Something like:

/* Skip check for neut planets if we found an enemy agri to take and have
   enough armies. */

You can also change the logic to:

if(!tpl || !( tpl->pl_flags&PLAGRI && me->p_armies >= 5 ) ) {

     * robotd/update_players.c changed closest_planet() function to return
       the old closest_planet if it cannot find a closest planet.

This is not what my fix to the bug in closest_planet is about at all.
Hadley's fuction had a bug where it would usually not find a closest planet
every other update.

     * robotd/update_players.c:  The function closest_planet() would
       usually return NULL every other time it was called.  It checks
       the distance to opl, the previous closest planet, and if the
       player is very close it doesn't bother searching.  If the
       player isn't very close, it would search for a planet _closer_
       than opl.  If opl was still the closest, it won't find a closer
       planet, but instead of returning opl, it would return NULL.