Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: [RFC] Path finding interface
Home

[Freeciv-Dev] Re: [RFC] Path finding interface

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [RFC] Path finding interface
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Apr 2002 20:00:14 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Wed, Apr 10, 2002 at 06:33:54PM +0100, Gregory Berkolaiko wrote:
> On Wed, 10 Apr 2002, Raimar Falke wrote:
> 
> > On Wed, Apr 10, 2002 at 05:38:55PM +0100, Gregory Berkolaiko wrote:
> > > On Wed, 10 Apr 2002, Raimar Falke wrote:
> > > 
> > > either I am very confused or you propose to return the whole path to each 
> > > new accessible destination but you don't use anything but the last 
> > > position.  Doesn't make any sense to me...
> > 
> > Yes it returns a whole path. We may shorten this to one position if
> > this get speed. I made it this way to be consistent with the
> > pf_get_path_from_map.
> 
> yes.  to get path (if you know you want it), just call the get_path 
> function.

Possible. But this is an performance thing and I can't estimate the
gain of it. So I would rather defer it till it gets measurable.

> > > > > > provide provide iterators not only for one step but also for 
> > > > > > multiple
> > > > > > targets. Just thing of this example: you have a settler which want
> > > > > > itself to add to some city. You have the start position and multiple
> > > > > > destinations on the same continent. You don't have to calculate all
> > > > > > costs to reach all tiles of the continent. You may use the simple
> > > > > > iterator but pf_get_path_from_map will do this for you.
> > > > > 
> > > > > how will get_path do it?
> > > > 
> > > > pf_get_path_from_map is an optimized version of:
> > > > 
> > > >   forever:
> > > >     path=pf_get_next_path_from_map
> > > >     if !path.is_valid: 
> > > >       return path
> > > >     if LAST_POS(path) == destination:
> > > >       return path
> > > 
> > > that doesn't answer the question.
> > > do you propose to stuff a list of destinations into pf_get_path ?
> > > or supply it with a is_final_destination callback?
> > 
> > void pf_get_path_from_map(pf_map_t map, int dest_x, int dest_y,
> >                           struct pf_path *path);
> > 
> > So the user just specify the destination by a map position.
> 
> Let's concentrate.
> We are talking about multiple destinations which are fx cities or ports, 
> or maybe even huts (location as yet unknown).  you say  
> pf_get_path_from_map will handle it.  How?

The player knows is own cities?! Or doesn't it? Come on it should be
clear that the function can only be called with a valid position that
the caller knows.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "Heuer's Law: Any feature is a bug unless it can be turned off."


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