[Freeciv-Dev] Re: Cleaning up gotohand.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> > On Wed, Sep 19, 2001 at 11:52:57AM +0100, Gregory Berkolaiko wrote:
> [..]
> > > But the calculation like
> > >
> > > generate_warmap
> > > whole_map_iterate{
> > > evaluate_position(x,y); /* computes fitness */
> > > }
> > >
> > > is ugly and unneccessary. For an example see ai_manage_explorer.
> >
> > It is an optimization. Correct? If this is done I want a nice
> > interface. You share some state over the function calls. This has to
> > be explicit IMHO. Another way is to give the generate_warmap a
> > callback which can return 1 to terminate the generating.
>
> aye, optimization and beautyfication of the code.
> hard to make the state explicit though.
>
> callback is a great idea but
> 1. I have no experience with callbacks whatsoever. It's never late to
> start, but...
> 2. There need to be 2 callbacks: one for stopping the generation and one
> for evaluating the tile. Then a function like ai_manage_explorer will
> need about 5 callbacks.
> Can be quite complicated, don't you think?
Yes.
If I had time and would want to do such things I would first make a
list of which methods (or more general: problems) make use of the
warmap and how they use it.
$ grep -Irn "warmap.\(sea\)\?cost" .
102
Overall I have to agree that the path finding is at the top spots but
the time you can save here is very small compared to saving which
could be easily made at the client. However general audit, adding
comments, cleanup and such things are always welcome.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
What's nice about GUI is that you see what you manipulate.
What's bad about GUI is that you can only manipulate what you see.
|
|