[Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordi
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8619 >
Marcelo Burda wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8619 >
>
> Le jeu 29/04/2004 à 17:46, Jason Short a écrit :
>
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=8619 >
>>
>>Marcelo Burda wrote:
>>
>>><URL: http://rt.freeciv.org/Ticket/Display.html?id=8619 >
>>>
>>>MMM...
>>>DIR_DX, DIR_DY then DIRSTEP is not well defined in ISO coordinated!
>>> the adjc_iterate in smootmap no whell defined too
>>
>>DIR_DX/DIR_DY may only be used in map coordinates. But why isn't it
>>well defined?
>
> in code make a DIRSTEP (in iterates) from map coordinated in the code of
> generator
> this call data from DIR_DX, DIR_DY
> if you work in map coordinates (ISO) and you want make a step to the E
> you need a DX=+1 and ad DY=-1 no the values DX=+1, DY=0 called by
> DIRSTEP for a step to N or S these is more complex you need to make a
> new mapstep, DIRSTEP is only to be used in natural coordinated
Hmm...
DIRSTEP only works in map coordinates. And the directions are map
directions. So if you have an iso-map DIR8_EAST isn't east on the
iso-map but east in the coordinate system.
This hasn't been a problem anywhere since nobody really hard-codes any
specific directions. Usually the callers just want to iterate over
them. However you could also have the concept of a native direction.
But you can't do a DIRSTEP in native coordinates because the vector
differs depending on where you are. So you'd need something like
bool native_mapstep(int *nat_x1, int *nat_y1, int nat_x, int nat_y,
enum direction8 nat_dir)
{
int map_x, map_y;
enum direction8 map_dir;
bool is_real;
native_to_map_pos(&map_x, &map_y, nat_x, nat_y);
native_to_map_dir(&map_dir, nat_dir);
if (MAPSTEP(map_x, map_y, map_x, map_y, map_dir)) {
map_to_native_pos(nat_x1, nat_y1, map_x, map_y);
return TRUE;
} else {
return FALSE;
}
}
or maybe just
MAPSTEP(map_x1, map_y1, map_x, map_y,
native_to_map_dir(DIR8_EAST));
Finally note that natural coordinates aren't used anywhere. But you
could do a DIRSTEP in natural coordinates. In this case east would be
(ntl_x+2, ntl_y).
jason
- [Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordinated and BORDER macro, Marcelo Burda, 2004/04/29
- [Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordinated and BORDER macro, Jason Short, 2004/04/29
- [Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordinated and BORDER macro, Jason Short, 2004/04/29
- [Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordinated and BORDER macro, Jason Short, 2004/04/29
- [Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordinated and BORDER macro, Marcelo Burda, 2004/04/29
- [Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordinated and BORDER macro,
Jason Short <=
- [Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordinated and BORDER macro, Marcelo Burda, 2004/04/29
- [Freeciv-Dev] (PR#8619) implementing IS_BORDER_MAP_POS for iso-maps, Marcelo Burda, 2004/04/29
- [Freeciv-Dev] (PR#8619) Obscure Bug related to ISO coordinated and BORDER macro, Marcelo Burda, 2004/04/29
|
|