Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#2370) Path finding

[Freeciv-Dev] Re: (PR#2370) Path finding

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Cc: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>, <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: (PR#2370) Path finding
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Wed, 19 Feb 2003 16:40:35 +0000 (GMT)

On Wed, 19 Feb 2003, Raimar Falke wrote:
> My ordered list of goal for development is
> still: correctness, maintainability, speed. Warmap had great speed but
> low maintainability. You change this with PF but you can't get both
> easily.

Maybe the warmap code itself wasn't easily maintained, but code which
_uses_ the warmap can be written in an easily maintained manner. Code
which uses pf directly is going to be very ugly, and rather
unmaintainable, simply because the pf API is so big.

Correctness be damned, Raimar. Maintainability is much more important in
the long run.


  generate_warmap(map_get_city(x, y), punit);
  WARMAP_COST(x, y);

  pf_map_t UPI_map;                                         \
  struct pf_parameter UPI_parameter;                        \
  struct pf_path UPI_path;                                  \
  pft_fill_default_parameter(&UPI_parameter);               \
  pft_fill_unit_parameter(&UPI_parameter, punit);           \
  pft_adjust_param_to_overlap(&UPI_parameter, punit);       \
  UPI_map = pf_get_map(&UPI_parameter);                     \
  while (pf_next(UPI_map)) {                                \
    int x, y, movecost;                                     \
    int px = punit->x;                                      \
    int py = punit->y;                                      \
    struct pf_position UPI_pos;                             \
    pf_next_get_position(UPI_map, &UPI_pos);                \
    movecost = UPI_pos.total_BMC;                           \
    x = UPI_pos.x;                                          \
    y = UPI_pos.y;                                          \
    pf_next_get_path(UPI_map, &UPI_path);                   \
    if (UPI_path.positions_used > 0) {                      \
      px = UPI_path.positions[UPI_path.positions_used-1].x; \
      py = UPI_path.positions[UPI_path.positions_used-1].y; \

  - Per

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