Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: PATCH: rand_pos function and usage (PR#1017)
Home

[Freeciv-Dev] Re: PATCH: rand_pos function and usage (PR#1017)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: PATCH: rand_pos function and usage (PR#1017)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 18 Oct 2001 20:36:08 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Oct 18, 2001 at 11:13:48AM -0700, jdorje@xxxxxxxxxxxxxxxxxxxxx wrote:
> Raimar Falke wrote:
> > 
> > On Wed, Oct 17, 2001 at 10:01:24PM -0700, jdorje@xxxxxxxxxxxxxxxxxxxxx 
> > wrote:
> > > The attached patch creates a function, rand_pos(&x, &y) that determines
> > > a random map position.  It also uses it in place of all similar code.
> 
> > > This could have efficiency problems if we were looking for a very small
> > > subset of positions on the map.  Fortunately, there is no such code
> > > right now.
> > 
> > I'm also converned about efficiency problems. Can't rand_pos take the
> > range of allowed distances from north. Which now are from
> > 0..map.ysize-1 and latter come from 0..height-1.
> 
> This doesn't sound so good.  Outside of map generation stuff (which
> shouldn't be a concern), the only check that's done on the returned
> value is to make sure it's not on one of the poles.  In other words,
> this will attain virtually no speedup except during map generation.
> 
> This method also isn't really very general.  For instance, how does it
> apply to a torus map?  A torus map would probably have no polar regions
> (everything would be tropical); this would be easy to achieve using the
> checks I'm proposing but difficult or impossible if you build that
> information into the rand_pos function.
> 
> Finnaly, this would make the code much uglier (IMO) and would make
> rand_pos a topology-dependent function, which I'd like to avoid.

The map generation is topology-dependent. The placement of certain
items (rand_pos is used for this) is topology-dependent. So I have no
problem of having a topology-dependent rand_pos method. This method
has to have a certain knowledge about latitude. But method for this
are needed for the general map creation anyway.

So what do you think about a general rand_pos method and a map
generation rand_pos method. The second one is local to mapgen.[ch].

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 1 + 1 = 3, for large values of 1


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