Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2002:
[Freeciv-Dev] Re: Path-finding in the presence of danger
Home

[Freeciv-Dev] Re: Path-finding in the presence of danger

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: rf13@xxxxxxxxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Path-finding in the presence of danger
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Sat, 05 Oct 2002 14:27:58 -0400

The correct solution should either have one callback in which the
caller is required/free to deal with all effects relevant for this
particular invocation, or a mechanism for pushing individual callback
modules on a generic internally managed stack.

Note the second is basically an extension of the first to try and
standardize an interface to individual sub-elements so they can 
more easily be arranged as a mix and match selection library.

The incorrect solution is to try and manage the second case by 
hardcoding the flow inside the implementation to deal with a limited
selection of specifically ordered and always setup/checked cases.
This leads to both a maintenance nightmare and performance piggery.

Note Gregory's solution can always be implemented by pushing a single
module in which the caller assumes full responsibility. His solution
can also be extended to the second by pushing a module that has all
the extra logic to setup a generic module stack and iterate over it. 
With such a stack-module, a single hardcoded callback is sufficient, 
and thus Gregory is defining a completely generic solution which can 
be extended trivially to handle future needs including anything
Raimar would like to do in his private code implementations.

Cheers,
RossW
=====

At 01:04 PM 02/10/04 +0100, Gregory Berkolaiko wrote:
>
>On Fri, 4 Oct 2002 rf13@xxxxxxxxxxxxxxxxx wrote:
[...]
>We have rather different attitudes to the subject.  You seem to prefer to 
>have many call-backs, while I would rather have one which does it all.
>For this particular proposal,
>       int get_extra(int x, int y, int curent_extra, void *data)
>provides for the desired freedom.
>
>G.




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