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: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Cc: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Map coordinate cleanups.
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: Mon, 20 Aug 2001 00:50:18 +0200

On Sat, 18 Aug 2001, xyzzy@xxxxxxxxxxxxx wrote:
> 
> Consider a diamond shaped map that's supposed to play like a sphere:
> 
> X    0  1  2  3  4
> Y
>           +--+
> 0         |  |
>        +--+--+--+
> 1      |  |  |  |
>     +--+--+--+--+--+
> 2   |  |  |  |  |  |
>     +--+--+--+--+--+
> 3      |  |  |  |
>        +--+--+--+  
> 4         |  |
>           +--+    
> 
> Coordinates wrap around the east and west edges, but not the north
> and south.  For example, (0,1) would wrap around the edge to (3,1),
> and (-1,2) would wrap to (4,2).  What would the coordinate (4, -1)
> wrap to?  Since it's a not a real coordinate, there is no meaningful
> way to wrap it.  The cylinder topology just creates the illusion
> that it is possible to wrap non-real coordinates.

That's an interesting idea, but you haven't thought it through
properly.

If I understand you correctly, if I'm standing on (1, 1) and move left
I will arrive at (3, 1).  As such, the coordinate pairts (0, 1) and
(3, 1) are canonically equivalent.  On the other hand, if I stand on
(0, 2) and try to move north, I'm not allowed to do that.

Freeciv currently assumes that it can tell if a move is legal by
adding the appropriate offsets to the old coordinates and then calling
is_real_tile() (or normalize_map_pos(), or whatever) on the result.
But in the above case, is_real_tile() has no way to tell whether we
arrived at (0, 1) by going north or west.  So in order to make this
topology work, you would have to create a function that tells you
whether you are allowed to move somewhere from a given position, and
if so, where.

The bottom line is that Freeciv implements coordinates the way it does
because declaring that coordinates "wrap" when you cross a magical
threshold is a reasonable way to implement and deal with a cylinder.
However, wrapping of any sort is not a reasonable way to implement
what you describe above, and so the whole sordid discussion does not
apply, and your argument is bogus.

-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
Four thousand different MAGNATES, MOGULS & NABOBS are romping in my
 gothic solarium!!


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