Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#2370) Path finding
Home

[Freeciv-Dev] Re: (PR#2370) Path finding

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: Freeciv Development List <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: (PR#2370) Path finding
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 19 Feb 2003 23:14:50 +0100

On Wed, Feb 19, 2003 at 09:58:36PM +0000, Gregory Berkolaiko wrote:
> New version of PF attached.  A couple of bugs fixed in path_finding.c
> changes in pf_tools.[ch] and corresponding changes to Per's code in 
> aidiplomat.c
> 
> G.
> 
> Raimar, scroll for a comment on your comment.
> 
> On Wed, 19 Feb 2003, Raimar Falke wrote:
> 
> > > > > mind you, caching can still be done through void *data parameter.
> > > > > We can pass pointer to caching map.
> > > > 
> > > > Can you explain more?
> > > 
> > > we make
> > > struct cached_values {
> > >   int is_initialized;
> > >   int known;
> > >   int zoc_number;
> > >   int behavior;
> > > }
> > > 
> > > then 
> > > struct last_arg {
> > >   struct player *owner;
> > >   struct cached_values *vals;
> > > } cache;
> > > 
> > > and then do (at fill_parameter time)
> > > 
> > > cache.vals = fc_calloc(...)
> > > 
> > > get_BMC_data = &cache;
> > > get_ECOT_data = &cache;
> > > 
> > > then inside, say, get_BMC, we do 
> > > 
> > > if (!data->vals[index].is_init) {
> > >   data->vals[index].known = is_known_tile(x, y, owner);
> > >   // .....
> > > }
> > > 
> > > if (data->vals[index].known == TILE_UNKNOW) {
> > >   return 0;
> > > }
> > > 
> > > Almost the same as we have now, just done in callbacks themselves.
> > 
> > And what if a user want to cache the is-coastal state? If we limit
> > this to the above mentioned fields we can do in common code.
> 
> The user does all of the above, if he wants.  So he can add whatever 
> fields he likes.  Does it answer your comment?  If not, I didn't 
> understand it...

My mistake. I understand now.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 A life? Cool! Where can I download one?



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