Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] Re: (PR#8624) New clima function to best handle terrain pl
Home

[Freeciv-Dev] Re: (PR#8624) New clima function to best handle terrain pl

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: mburda@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8624) New clima function to best handle terrain place, used to place poles.
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 7 May 2004 11:28:05 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8624 >

Marcelo Burda wrote:

> the probem is to known the number to counted in a no-singular position
> and compare it  the option i am thinking in.:

Ugly but workable.

It's also possible to make the check directly using topology code.  In 
addition to IS_BORDER_MAP_POS(x, y, dist) we would have 
IS_SINGULAR_MAP_POS(x, y, dist).  The second function would be similar 
to the first but with some additional wrapping checks.

bool is_singular_map_pos(int x, int y, int dist)
{
   if (!topo_has_flag(TF_ISO)) {
     if (!topo_has_flag(TF_WRAPX)
         && x < dist || x >= map.xsize - dist) {
       return TRUE;
     }

     if (!topo_has_flag(TF_WRAPY)
         && y < dist || y >= map.ysize - dist) {
       return TRUE;
     }

     return FALSE;
   }

}

of course this will only work with the real_map_distance.  And it may be 
harder to get it to work with hex tiles.  This function needs to be more 
accurate than is_border_map_pos since that function just says if the 
position _may_ be a border position.  is_singular_map_pos must be 100% 
accurate.

jason




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