Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: [Patch] dir_ok
Home

[Freeciv-Dev] Re: [Patch] dir_ok

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] dir_ok
From: Jason Dorje Short <vze2zq63@xxxxxxxxxxx>
Date: Fri, 05 Oct 2001 15:00:54 -0400
Reply-to: jdorje@xxxxxxxxxxxx

Raimar Falke wrote:
> 
> Comments?
> 
> I see not much point in verifying that savegames are equal since the
> result is never used and the old code was buggy (allowed orthogonal
> moves).

This is not topology-independent.  It assumes a rectangular map with
wrapping in the X direction only.  I'm not sure how to replace the
following code:

  if (dest_x > src_x) {
    diff_x = dest_x - src_x < map.xsize / 2 ? 1 : -1;
  } else if (dest_x < src_x) {
    diff_x = src_x - dest_x < map.xsize / 2 ? -1 : 1;
  } else {                      /* dest_x == src_x */
    diff_x = 0;
  }

A new topology-dependent function may be required to do this (like
diff_map_positions(), for instance).


Although your patch isn't topology-independent, neither was the old code
so this isn't a step backwards.  So I'd just as soon see your patch
attached and then worry about the topology aspects later.  (Assuming, of
course, the patch is correct.  It looks OK to me.)

jason


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