[Freeciv-Dev] Re: (PR#2370) Path finding
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> > > > About the known-management: if we remove it from the core code:
> > > > - it will reduce the number of parameters
> > > > - it will reduce the size of the cell/node
> > >
> > > true. Less memory -- faster.
> > >
> > > > - it will increase run-time because of extra function calls to
> > > > map_get_known by the user functions.
> >
> > > 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.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"I haven't lost my mind - it's backed up on tape somewhere."
- [Freeciv-Dev] Re: (PR#2370) Path finding, (continued)
- [Freeciv-Dev] Re: (PR#2370) Path finding, Ross Wetmore, 2003/02/22
- [Freeciv-Dev] Re: (PR#2370) Path finding, Raimar Falke, 2003/02/22
- [Freeciv-Dev] Re: (PR#2370) Path finding, Gregory Berkolaiko, 2003/02/19
- [Freeciv-Dev] latest aidiplomat.c changes, Per I. Mathisen, 2003/02/19
- [Freeciv-Dev] Re: (PR#2370) Path finding, Raimar Falke, 2003/02/19
- [Freeciv-Dev] Re: (PR#2370) Path finding, Gregory Berkolaiko, 2003/02/19
- [Freeciv-Dev] Re: (PR#2370) Path finding, Raimar Falke, 2003/02/19
- [Freeciv-Dev] Re: (PR#2370) Path finding, Gregory Berkolaiko, 2003/02/19
- [Freeciv-Dev] Re: (PR#2370) Path finding,
Raimar Falke <=
- [Freeciv-Dev] Re: (PR#2370) Path finding, Gregory Berkolaiko, 2003/02/19
- [Freeciv-Dev] Re: (PR#2370) Path finding, Raimar Falke, 2003/02/19
- Message not available
- [Freeciv-Dev] Re: (PR#2370) Path finding, Jason Short, 2003/02/19
- [Freeciv-Dev] Re: (PR#2370) Path finding, Gregory Berkolaiko, 2003/02/20
- [Freeciv-Dev] Re: (PR#2370) Path finding, Raimar Falke, 2003/02/20
- [Freeciv-Dev] Re: (PR#2370) Path finding, Gregory Berkolaiko, 2003/02/21
- [Freeciv-Dev] Offtopic: Re: Re: (PR#2370) Path finding, Andreas Røsdal, 2003/02/21
- [Freeciv-Dev] Re: Offtopic: Re: Re: (PR#2370) Path finding, Raimar Falke, 2003/02/21
- [Freeciv-Dev] Re: (PR#2370) Path finding, Gregory Berkolaiko, 2003/02/21
- [Freeciv-Dev] Re: (PR#2370) Path finding, Raimar Falke, 2003/02/21
|
|