Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] Re: (PR#4648) how to do wrapping in map_to_canvas_pos?
Home

[Freeciv-Dev] Re: (PR#4648) how to do wrapping in map_to_canvas_pos?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#4648) how to do wrapping in map_to_canvas_pos?
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 27 Jul 2003 21:09:16 -0700
Reply-to: rt@xxxxxxxxxxxxxx

rwetmore@xxxxxxxxxxxx wrote:

>    It is the wrapping that is tricky.  The obvious logic is something like:
>     if (map_x < map_view_x0) {
>       map_x += map.xsize;
>     }
> 
> Your "obvious logic" makes assumptions about the map coordinate being within
> a particular range, which actually has led to a number of bugs in the past.
> The WRAP or while loop constructs in (un)normalize_map_pos() fix this. The
> latter are actually so incredibly efficient for your special case that there
> is never a reason to use the buggy "obvious logic" form.

You may have noted that the "obvious logic" was immediately debunked as 
not working for gen-topologies.  However it does fix several bugs in the 
current code (since the current logic is even worse) and is therefore 
worth a quick fix IMO.

jason




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