Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] city_map_size fix and idea
Home

[Freeciv-Dev] Re: [PATCH] city_map_size fix and idea

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gaute B Strokkenes <gs234@xxxxxxxxx>
Cc: Jason Dorje Short <jshort@xxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Aug 2001 10:11:05 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Aug 24, 2001 at 01:30:50AM +0200, Gaute B Strokkenes wrote:
> On Wed, 22 Aug 2001, hawk@xxxxxxxxxxxxxxxxxxxxxxx wrote:
> > On Wed, Aug 22, 2001 at 01:14:36AM -0400, Jason Dorje Short wrote:
> >> Jason Dorje Short wrote:
> > 
> > [Best of all, we may wish to get rid of the idea of local city
> > coordinates alltogether and replace them with just a number.  As the
> > above sentence shows, the whole idea of local city map coordinates
> > is rather confusing anyway.]  -------
> > 
> > The idea of replacing is nice but this just make the code looking
> > more complex and unpleasant.
> 
> I don't really think so.  Juggling about two different sets of
> coordinates certainly is complex and confusing.
> 
> IMHO the best thing to do would be to use global map coordinates
> everywhere and do transform them to a table lookup position
> (a.k.a. local city coordinates) at some lower level.
> 
> >> -    if (map_get_tile(pcity->x+x-2, pcity->y+y-2)->worked) {
> >> +    if (map_get_tile(pcity->x+x-CITY_MAP_SIZE/2, 
> >> pcity->y+y-CITY_MAP_SIZE/2)->worked) {
> > 
> > The new is line is really not beautiful.
> 
> Correctness first; you're the one who said that...

You got me. But if we change this we can also get rid of this
altogether. To be more precise: I will not accept a patch which does
s|2|CITY_MAP_SIZE/2|. I will happily accept a patch which implements:

/*
 * 0 for failure
 */
int map_to_local_city_map(int city_center_x,int city_center_y,
                          int map_x, int map_y,
                          int *local_city_map_x, int *local_city_map_y);

void local_city_map_to_map(int city_center_x,int city_center_y,
                           int local_city_map_x, int local_city_map_y,
                           int *map_x, int *map_y);

get_citymap_xy should also be converted.

The solution with the index is nice but a step to far.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  This message has been ROT-13 encrypted twice for extra security.


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