Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] (PR#3535) Return and Recover
Home

[Freeciv-Dev] (PR#3535) Return and Recover

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: arnstein.lindgard@xxxxxxx
Subject: [Freeciv-Dev] (PR#3535) Return and Recover
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 3 Jul 2003 08:40:46 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Using pathfinding for the return-to-nearest-city code I write:

struct city *find_nearest_allied_city(struct unit *punit)
{
  struct city *pcity = NULL;

  if ((pcity = is_allied_city_tile(map_get_tile(punit->x, punit->y),
                                   game.player_ptr))) {
    /* We're already on a city - PF doesn't check for this (!). */
    return pcity;
  }

  simple_unit_path_iterator(punit, pos) {
    if ((pcity = is_allied_city_tile(map_get_tile(pos.x, pos.y),
                                     game.player_ptr))) {
      /* We use break so that the PF map can be destroyed. */
      break;
    }
  } simple_unit_path_iterator_end;

  return pcity;
}

Question 1.

Why does simple_unit_path_iterator not iterate over the current location?

Question 2:

Why does this occasionally send units off to some far-away city?  For
instance: load the attached test_game.sav.gz, connect as jshort.  Focus
the caravel near Ivanic Grad and choose Orders->Return to nearest city
(shift-G).  The caravel runs off toward Sibenik.  Is this is a bug in
pathfinding or just in the documentation?

jason

Attachment: test-game.sav.gz
Description: test-game.sav.gz


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