Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordi
Home

[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]
To: mburda@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8619) AutoReply: Obscure Bug related to ISO coordinated and BORDER macro
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Apr 2004 08:50:49 -0700
Reply-to: rt@xxxxxxxxxxx

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

Your is_border_map_pos is slightly wrong.  You have

+bool IS_BORDER_MAP_POS(int map_x, int map_y, int dist)
+{
+    int x, y;
+    map_to_native_pos(&x, &y, map_x, map_y);
+    return ((x) < (dist) || (x) >= map.xsize - (dist)
+           || (y) < (dist) || (y) >= map.ysize - (dist));
+}

But because iso-native coordinates are compressed in the X direction 
this isn't quite right.  I think it should be something like:


bool IS_BORDER_MAP_POS(int map_x, int map_y, int dist)
{
     int x, y;
     map_to_native_pos(&x, &y, map_x, map_y);
     return ((x) < (dist) || (x) >= map.xsize - (dist)
            || (y) < (2 * dist) || (y) >= map.ysize - (2 * dist));
}

for iso-maps (of course this won't work for non-iso maps).  Your 
original implementation that worked directly in map positions could also 
work, but you may need to multiple dist by 2 in this case also.

However I don't see how this explains the errors you're getting.  That 
will take a closer look.

jason




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