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]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: to wrap or not to wrap?
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Oct 2001 17:57:14 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Wed, Oct 10, 2001 at 11:39:19AM -0400, Jason Dorje Short wrote:
> 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).

Ok I now understand.

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

Usual question: who/what needs this? Note that the only wrapping
occurs at the GUI and even this case will be no longer if the client
draw each tile only one time.

> 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.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Just because you put a flag on the moon doesn't make it yours, it just
  puts a hole in the moon."


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