Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Map coordinate cleanups.
Home

[Freeciv-Dev] Re: Map coordinate cleanups.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Arien Malec <arien_malec@xxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Map coordinate cleanups.
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Fri, 17 Aug 2001 18:47:59 -0400

There are two problems with this. The first is that the GUI allows one to
scroll more or less continuously in one direction. Internally I think it
resets the coordinates after a full map shift, but this means an order of
magnitude increase in the sizes of maps (3x3 ~ 10).

Secondly it doesn't remove the basic problem of dealing with faulty off map
accesses, even though it does reduce the probability. To be safe (paranoid)
code would still have to check that it didn't index outside of the 3x3 case. 

The idea is valid, though, and could be implemented without too much
trouble. The cost of doing a doubly indexed array lookup for each
coordintate pair, might turn out to be comparable to the current test and
if needed normalize.

Cheers,
RossW
=====

At 09:32 AM 01/08/17 -0700, Arien Malec wrote:
[...]
>BTH, wouldn't a sensible way of implementing normalization be to generate at
>game initalization a suitably big array mapping coordinate positions to
>normalized coordinate positions? E.g., if the map is the maximum of 200x100,
>and sensible moves are < x/2 or y/2 (since if you go more than halfway around
>the map, you might as well go the other way), you would generate a 300X150
>array of ints, each cell of which would contain either the normalized
position,
>or NULL (if the position is irreal).
>
>That moves the tricky, expensive, and topology-dependent stuff to a one-off
>operation, and should make the implementation of is_real, is_normal, etc. and
>the iterate macros very very simple....
>
>Arien




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