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: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Cc: Gaute B Strokkenes <gs234@xxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Map coordinate cleanups.
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Date: Thu, 16 Aug 2001 15:56:17 -0700 (PDT)

On Thu, 16 Aug 2001, Jason Dorje Short wrote:
> 
> I think isometric view shapes would be good.  They're not the only kind
> of topology that doesn't wrap independently, but they're the most likely
> kind.

There is a good reason for them too, so isometric mode works correctly.  Other
topologies don't have much going for them other than gee-wiz factor, which
isn't bad, but it's not as usefull.

> You're right on this point; I understand what you're saying entirely I
> just disagree with your naming.  I would name things like this:
> 
> real tile: a coordinate position that is on the world
> proper tile: a coordinate that is canonically wrapped
> normal tile: one that is both real and proper

If I define the same types you have, but listing their properties from a
coding perspective, I get.

Real coordinates:
  Refer to a tile that is on the map, and has data associated with it.
  There is nothing you can do with non-real tiles.

Normal coordinates:
  The coordiates are in the connonical form, which makes them unique.  Two
  normal tiles can be compared for equality by comparing their coordinates.

  Coordinates can be passed to another function iff they are normal.

Porper coordinates:
  The coordiates are in the connonical form, which makes them unique.  Two
  proper tiles can be compared for equality by comparing their coordinates.

> both according to their needs, it will be very rare (possibly
> nonexistent) to check for being "proper" under my naming system (that
> is, to check the wrapping alone without worrying about the validity). 

Proper, but not necessarily normal, coordinates could be used if you want to
compare two positions for equality, but don't care if they refer to a real
tile.  I can think of no case where the check for proper would ever be needed
instead of a check for normal.

The only reason to have it, would be for efficiency.  If you already know a
tile is real, then it is possible to check for normal more efficiently than if
you didn't know the tile was real.  But this is a very small gain that very
few places could use, so I don't see point in bothering with the extra
complexity.

> My solution would be to have three check functions: is_real_tile,
> is_proper_tile, and is_normal_tile.  is_proper_tile probably won't be
> needed, but should be included for completeness.  

I would replace is_proper_tile with
is_wrapped_but_not_necessarily_real_tile().  That makes it clear what the
function returns to any people who see it.  Yes, the name is rather long and
awkward, but no one will ever use it, so it doesn't matter!



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