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 16:34:09 -0400
Reply-to: jdorje@xxxxxxxxxxxx

Raimar Falke wrote:
> 
> On Wed, Oct 10, 2001 at 12:27:06PM -0400, Jason Dorje Short wrote:
> > Raimar Falke wrote:

> > The "correct" way to do the drawing is like this, IMO:
> >
> > for (x=0; x<width; x++)
> >   for (y=0; y<height; y++) {
> >     x1 = x0+x, y1 = y0+y;
> >     if (normalize_map_pos(&x1, &y1))
> >       draw_tile(x1, y1);
> >     else
> >       draw_black_tile(x1, y1);
> >   }
> >
> > This uses only mathematically correct operations on the map position.
> > In the case of the overhead view it is still easy to avoid drawing tiles
> > multiple times [1] -
> 
> > you just restrict the size of the map canvas [2].
> 
> What if in the above loop the width isn't the map canvas width, but
> the map.xsize? It should be fine if you blank all tiles before.

It's a problem, unfortunately.  I believe a clean mathematical solution
is possible.

> > In the case of the isometric view the math would be harder but it would
> > still be possible.
> >
> > Gaute pointed out before that it doesn't matter which set of coordinates
> > you choose to be proper/normal - it's just a convenience to make
> > everything happen within map.xsize/map.ysize.  Mathematically this is
> > correct, but wrap_map_pos is not mathematically clean - the client MUST
> > have each vector returned by wrap_map_pos be exactly correct.
> >
> > [1] Personally, I would prefer to have tiles drawn multiple times.  But
> > that's just me...
> 
> If it is cleaner what is needed for one-drawing and what for the
> multiple drawing I don't have a problem. This can be a compile or
> run-time constant. However it looks to me that the easier goal of the
> next step is the one-time draw solution.
> 
> > [2] This really seems like the obvious solution.  Does anyone know why
> > it wasn't used before?
> 
> So in overall we don't need the method you suggested?!

It depends on what you mean by "need" and "method I suggested" :-).

We don't need wrap_map_pos() (originally proposed by Gaute, I believe)
if we fix the client code.  However this will be a big job.

We don't need to rework the client code (as described above) if we use
wrap_map_pos().  However this will mean only simple topologies can be
used.

I'm inclined to go with wrap_map_pos() for now, although I would
eventually like to see it removed.

jason


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