Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] Re: (PR#7304) iso-map support for mapgen
Home

[Freeciv-Dev] Re: (PR#7304) iso-map support for mapgen

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7304) iso-map support for mapgen
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Sun, 25 Jan 2004 11:48:22 -0800
Reply-to: rt@xxxxxxxxxxx

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

On Sat, 24 Jan 2004, Jason Short wrote:

> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7304 >
> 
> Adding iso-map support to mapgen is an ugly task.  Here's the patch to
> do it.
> 
> We must constantly be thinking about whether the positions we're working
> with are in map or native coordinates.  Mapgen must generally work with
> both.
> 
> A few wrappers (suggested by Marcelo) are used for convenience:
>   nat_get_terrain => returns the terrain for a position in native coords
>   nat_set_terrain => blah, blah
>   do_in_map_pos(map_x, map_y, nat_x, nat_y) {
>     => mapgen macro to allow local conversion from native to map coords
>   } do_in_map_pos_end;
> 
> It's been tested moderately with a variety of generators and topologies.
>  However there are a very high number of possibilities so it's possible
> some bugs remain (usually these bugs lead to an immediate segfault and
> so are easy to find).

It looks sane to me.  Minor requests:

1. Make sure you format the lines you change.

2. We should agree on a policy where the name of a coordinate would 
indicate its type.  I am really aginst things like
        native_to_map_pos(&x, &y, x, y);
It seems the default is map coords, so native should _always_ be called 
(xn, yn).

3. I don't understand the need for the extra layer in do_in_map_pos.  Is 
it to const the variables?

Now, a big question.  I appreciate it's probably too late to ask it and 
that I possibly already asked it a couple of times.

It seems that the default coordinates throughout Freeciv will be map
coordinates.  Why not native?  They are more "natural" for most things.  
Where would you ever want to really use the map coordinates, apart from
adjacency calculations which can be hidden in few macros?

In future, when compiled with DEBUG option, which coordinates will clients 
display on middle-click?  They should be map coordinates (because such 
things are used to locate units for debugging), but these would be very 
hard to find on a map!

G.




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