This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Re: Question on combat procedures
Christopher Wood wrote:
I am trying to figure out how these combat module works in the
xconq source code. I have looked over combat.c and I have seen
how it switches depending on the model through the g_combat_model
call. However what I would like is to know what is calling the
functions in combat and how the order is being done. The combat.c
file is quite confusing and I can't quite figure out how it works
together with the rest of the program since I have no idea where
these functions are being called from.
You need to account for the user interfaces. They are in separate
directories; 'tcltk' houses the Tcl/Tk interface, for example. Also, the
user interfaces make use of 'ui.h' and 'ui.c'. You should also look at
'task.c' and 'plan.c'; 'task.c' contains the 'hit-unit' task code. The
kernel run code in 'run.c' and 'action.c' is what actually schedules
things to happen (i.e., running prepped actions).
Remember, grep is your friend:
$ grep 'prep_attack' *.c
combat.c:prep_attack_action(Unit *unit, Unit *unit2, Unit *defender, int n)
task.c: prep_attack_action(unit, unit, unit2, 100);
task.c: prep_attack_action(unit, unit, unit2, 100);
task.c: prep_attack_action(unit, unit, unit2, 100);
task.c: prep_attack_action(unit, unit, unit2, 100);
task.c: prep_attack_action(unit, unit, unit2, 100);
tp.c:net_prep_attack_action(Unit *unit, Unit *unit2, Unit *defender, int n)
tp.c: rslt = prep_attack_action(unit, unit2, defender, n);
ui.c: net_prep_attack_action(unit, unit, other, 100);
ui.c: net_prep_attack_action(unit, unit, other, 100);
$ grep 'do_attack' *.c
actions.c: rslt = do_attack_action(unit, unit2, aunits[0], a[1]);
combat.c:do_attack_action(Unit *unit, Unit *unit2, Unit *defender, int n)