<URL: http://bugs.freeciv.org/Ticket/Display.html?id=34680 >

 This is idea I got when looking through aiferry code. This might be
overkill for current freeciv codebase, but something to consider.

 aiferry code keeps statistics about passengers and free boats. For
that to work perfectly, it would require notifications about new units
and removed units. Scripting interface requires notifications about
these events too. Maybe other AI subsystems require same notifications
as well.

 Each subsystem registers set of callbacks to system. When something
important happens, we iterate through callbacksets and call all the
relevant callbacks.

 This is close to subject/observer design pattern.

 callbackset_iterate(pset) {
    if (pset->new_unit != NULL) {
 } callbackset_iterate_end;

 - ML

Freeciv-dev mailing list

Reply via email to