Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2002:
[freeciv-ai] Re: ai move cleanup #4

[freeciv-ai] Re: ai move cleanup #4

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: Freeciv AI development <freeciv-ai@xxxxxxxxxxx>
Subject: [freeciv-ai] Re: ai move cleanup #4
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Thu, 8 Aug 2002 13:49:03 +0100 (BST)

On Thu, 8 Aug 2002, Per I. Mathisen wrote:

> This is version four, with a number of fixes and changes after massive
> tests run with the rewritten active ai diplomats patch (see next post).
> Please read and comment.

Issue 1:

In ai_unit_bodyguard_move:
+  if (bodyguard->moves_left < map_move_cost(bodyguard, x, y)) {
+    /* should generally should not happen */
+    freelog(LOG_VERBOSE, "%s: %s left its %s bodyguard behind at (%d,%d)!",
+            pplayer->name, unit_type(punit)->name, 
+            unit_type(bodyguard)->name, x, y);
+    return;
+  }

If bodyguard->moves_left > 0, the bodyguard can still attempt to move!

Issue 2:

In has_bodyguard, after punit->ai.bodyguard = 0;
Can we have a freelog(LOG_DEBUG, "%s's bodyguard has disappeared!");

Issue 3:

In do_unit_goto, why do you remove

-      /* Don't attack more than once per goto */
-      if (penemy && !pplayer->ai.control) { /* Should I cancel for ai's too? */
-       punit->activity = ACTIVITY_IDLE;
-       send_unit_info(NULL, punit);
-       return GR_FOUGHT;
-      }

In any case, can you move the declarations of penemy, x, y and dir inside 
the do-while loop?

Issue 4: (a nitpick)
in handle_unit_move_request after /******* ok now move the unit *******/

+  if (can_unit_move_to_tile_with_notify(punit, dest_x, dest_y, igzoc)
+     && try_move_unit(punit, dest_x, dest_y)) {

the second line should be shifted one space to the right.

The rest seems to be pretty good work.  Also seems to fix the bug when an 
attacker wouldn't occupy an empty city because it's bodyguard wouldn't 
budge.  I didn't test it though.  Savegames would differ at later stage, I 


[Prev in Thread] Current Thread [Next in Thread]