Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: PATCH: map iteration (PR#1018)
Home

[Freeciv-Dev] Re: PATCH: map iteration (PR#1018)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: PATCH: map iteration (PR#1018)
From: Jason Dorje Short <vze2zq63@xxxxxxxxxxx>
Date: Tue, 06 Nov 2001 22:02:28 -0500
Reply-to: jdorje@xxxxxxxxxxxx

"Ross W. Wetmore" wrote:
> At 10:39 PM 01/11/03 -0500, Jason Dorje Short wrote:
> >An iso-rectangular map with any kind of wrapping will have a number of
> >tiles that occur multiple times within that space.  My
> >general-topologies patch provides such a topology.
> 
> It was agreed in past discussions that showing tiles multiple times was
> not only a problem in managing updates to all occurences, but was an
> incredibly poor user interface design, and would be forbidden.
> 
> This makes your general topologies patch quite unsuitable until you
> figure out how to fix these problems.

But I have.  The patch accomplishes exactly that using the misnamed
normalize_map_pos_[iso|rect].  There are a few problems with the
arithmetic in these functions (it's pretty ugly, as I've said), but in
general the solution is fundamentally sound.

Basically the GUI mapview code is left unchanged, except that the
wrapping step in get_canvas_xy is hijacked to use normalize_map_pos_iso
or normalize_map_pos_rect instead.  Thus, each tile will only be drawn
once.  The overview code is a bit more tricky since the current solution
saves a backing store of the entire overview and hard-wires the wrapping
into the drawing code to wrap the entire backing store; AFAICT this is
not possible to do in the general case.  However, I have found no
appreciable slowdown to dropping the backing store completely and just
redrawing the overview each time (although this is ugly).

The original post/discussion was about something entirely different; see
below.

> BTW:  Your comment about this being the case for iso-rectangular map
> with any kind of wrapping is not correct. Showing tiles once only is
> always possible, and not really difficult if you do it right.

I'm not talking about showing tiles only once, I'm talking about a loop
of the form

for (x=0; x<map.xsize; x++)
  for (y=0; y<map.ysize; y++) {
    ...
  }

which _will_ cover each tile (or positional class) more than once unless
an is_normal_map_pos check is done.  Gaute suggested doing the same
thing with an is_real_tile check instead, but this is almost the exact
same thing and would not work in any case (because in the case of an
iso-rectangular map that wraps it will still cover a tile more than one
time).  Really, I think my solution is about the simplest one possible
for this problem.

jason


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