Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] (PR#9042) RFC: removal of map_distance
Home

[Freeciv-Dev] (PR#9042) RFC: removal of map_distance

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9042) RFC: removal of map_distance
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 20 Jun 2004 07:41:46 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9042 >

There are three distance functions:

  real_map_distance: the distance (in moves)
  sq_map_distance: the square of the "pythagorean" distance
  map_distance: the manhatten distance

The third is of practically no use.  It is however used in a few 
different places:

common/city.c:        || map_distance(pc1->x, pc1->y, pc2->x, pc2->y) > 8));
common/city.c:  tb = map_distance(pc1->x, pc1->y, pc2->x, pc2->y) + 10;
common/map.c:int map_distance(int x0, int y0, int x1, int y1)
server/cityturn.c:    int tmp = map_distance(capital->x, capital->y, 
pcity->x, pcity->y);
server/diplomats.c:    int tmp = map_distance(capital->x, capital->y, 
punit->x,
punit->y);

this includes calculation of trade and corruption.  It would be hard to 
argue that this is intentional, rather than simple confusion between 
map_distance and real_map_distance.  However this _may_ (but probably 
doesn't) provide some sort of compatability to older civ games (civ2).

My proposal would therefore be to remove map_distance, replacing its 
users with either real_map_distance of sq_map_distance.  Then we can 
rename real_map_distance as map_distance.

jason




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