Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: to wrap or not to wrap?
Home

[Freeciv-Dev] Re: to wrap or not to wrap?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: to wrap or not to wrap?
From: Jason Dorje Short <vze2zq63@xxxxxxxxxxx>
Date: Wed, 10 Oct 2001 11:39:19 -0400
Reply-to: jdorje@xxxxxxxxxxxx

Raimar Falke wrote:
> 
> On Wed, Oct 10, 2001 at 10:34:13AM -0400, Jason Dorje Short wrote:
> > If we assume that each equivalency class of map positions is a
> > collection differing only by a linear combination of given vectors, then
> > "updating" the client becomes much easier.
> >
> > That is, if we limit our topologies to only those that wrap in simple
> > ways, we can write a wrap_map_pos(&vx, &vy) function that will wrap the
> > given coordinate pair [1] independent of it's being a actual tile.  This
> > can be used practically as-is in the current client implementation,
> > although I strongly feel that this implementation is flawed and should
> > be fixed anyway.
> 
> I don't understand. What should wrap_map_pos be? Should
> wrap_map_pos(&x,&y) set x=map.xsize and y=0 for the current map?

Err, no.

wrap_map_pos(&x, &y) takes the vector (x, y) and physically wraps it
into its proper position.  It is independent of (x, y) being real, so it
will only work for topologies that wrap "regularly".  However, the fact
that it'll work on any position or vector makes usage much simpler.

For a real position, it will have identical effect to
normalize_map_pos.  For an unreal position, it will wrap the coordinate
normally just as if it were real (which is only possible under a limited
set of topologies).

Like I said, it is confusing and will probably lead to misuse.


An alternative, I suppose, would be to tell the user the vectors that
are safe to operate under.  The calling code could then manipulate the
coordinates as it wanted.  This would be even more error-prone, I think.

jason


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