Here is a pile of patches for the robot. Most of have been discussed here before, a few are new ones. For some reason, darcs insisted that I include the glib Makefile patch in this bundle. Just ignore that one or kill the glib patch I sent before and use this one instead. The patches, from oldest to newest: Rollback robotd-fixes1.dpatch, all these fixes will be re-done here, but differently Mon May 22 15:40:42 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * fix mfprintf() When mfprintf() was changed from varargs to stdarg, it wasn't done correctly. Fix this. Tue May 23 00:45:25 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * adapt when assaulting 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. Tue May 23 00:49:46 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * fix neutral planet check 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. Tue May 23 00:55:48 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * fix closest_planet 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). Tue May 23 01:00:23 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * fix crash in RCD generation 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. Tue May 23 01:08:45 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * fix use of un-initialized variable Fix a warning about a un-initialized use of pldist in update_players(). It didn't matter, but fix the warning anyway. Tue May 23 01:54:09 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * fix calls to req_cloak_off() Some calls to req_cloak_off() were missing the function's argument (reason string). Tue May 23 03:08:06 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * fix res danger 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. Tue May 23 04:09:21 PDT 2006 Trent Piepho <xyzzy at speakeasy.org> * torp dir for robot Hadley's bot expects to get torp direction from the server, but the server only sends it for your own torps. Someone probably changed this years ago to combat borgs. Changed back 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.