--- Trent Piepho <xyzzy at speakeasy.org> wrote:
> I think if keeping the stale information around was
> a good idea, Hadley
> would have done that.  He clearly detects invisible
> players, and sets the
> closest planet to NULL, then checks for this
> everytime closest_pl is
> examined.

This is true. I spoke to Hadley many eons ago. And he
doesn't like to keep stale information while I do. I
made a mod to his code a LONG time ago, where it kept
the x & y coordinates of enemy carriers even though
they were way off the screen and/or cloaked. It seemed
to help... back then. I have no idea if that code ever
got propagated back into here though. 

Anyways, baby steps and lots of testing. I'll keep the
if invisible -> set to NULL. And run it through the
debugger for a couple hours and see if it still
crashes at that point, as I am only interested in
making the code run stable for now. 

> Also, have you considered what happens when the bots
> first joins, and has
> never seen where some player is?  What will
> closest_pl be, some random
> uninitialized data?  NULL anyway?

Yeah yeah. I see your point. 

> > I plan to do that, as I am sure there are some
> > consequences (even though they don't crash
> anymore).
> > I originally did the same thing to
> > test for NULL'ness for me_p->closest_pl. And just
> > avoid the SIGSEV. This resulted in bots that
> started
> > to not report where they wanted to take their
> armies
> > to.

You probably already read this in a previous e-mail.
But, the call for pl in check_take seems to be not
well thought out. I took the whole if statement block
out, and kept what was inside the block, and the code
runs much better. 

was:

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 < min_dist){
	   tpl = pl;
	   min_dist = pl->pl_mydist;
       }
   }

}

now:

   min_dist = GWIDTH;	/* ind overrides non-ind */
   for(k=0; k< pls->num_indsp; k++){
       pl = pls->ind_planets[k];
        if(pl->pl_mydist < min_dist){
	   tpl = pl;
	   min_dist = pl->pl_mydist;
       }
   }

The pl->pl_flags is referring to a previous for-loop.
The last planet of warteams_planets... Non-sensical...
Why a if statement referring to the last warteams
planet? 

> There is a bug in the function that generates RCDs. 
> I fixed it months ago,
> but since CVS was down I never committed it.  The
> bot will crash if it
> tries to bomb or take and can't see any friendly or
> any enemy players.

Cool. e-mail me the related files, and I can manually
patch. 

> If you want to fix mfprintf, man stdarg

I was thinking about simply getting rid of it.  Have
any idea why use mfprintf instead of regular fprintf?

Anyways, I'll give reading "man stdargs" a try and
hope I can make some sense out of it. 

Jimmy