This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Question on combat procedures
Hi all,
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. The only
place I could find something that even fits that is action.def
where it seemed it went according to the following list.
DEF_ACTION("attack", ACTION_ATTACK, "Un",
prep_attack_action, net_prep_attack_action,
do_attack_action, check_attack_action,
(Unit *unit, Unit *unit2, Unit *defender, int n),
"Attack a given unit")
DEF_ACTION("overrun", ACTION_OVERRUN, "xyzn",
prep_overrun_action, net_prep_overrun_action,
do_overrun_action, check_overrun_action,
(Unit *unit, Unit *unit2, int x, int y, int z, int n),
"Attack everything in a cell and occupy if possible")
DEF_ACTION("fire-at", ACTION_FIRE_AT, "Um",
prep_fire_at_action, net_prep_fire_at_action,
do_fire_at_action, check_fire_at_action,
(Unit *unit, Unit *unit2, Unit *defender, int m),
"Throw a given material at a given unit")
DEF_ACTION("fire-into", ACTION_FIRE_INTO, "xyzm",
prep_fire_into_action, net_prep_fire_into_action,
do_fire_into_action, check_fire_into_action,
(Unit *unit, Unit *unit2, int x, int y, int z, int m),
"Throw a given material at a given cell")
DEF_ACTION("capture", ACTION_CAPTURE, "U",
prep_capture_action, net_prep_capture_action,
do_capture_action, check_capture_action,
(Unit *unit, Unit *unit2, Unit *defender),
"Take a unit prisoner")
DEF_ACTION("detonate", ACTION_DETONATE, "xyz",
prep_detonate_action, net_prep_detonate_action,
do_detonate_action, check_detonate_action,
(Unit *unit, Unit *unit2, int x, int y, int z),
"Damage or destroy self in a violent fashion")
This seems to be saying that any action is broken into a
series of four calls, a prep, a net_prep (I take it this has
to do with network protocals), a do and a check. So if I wanted
to change things around I would change the function calls in this
list? Also when two units are next to eachother and one targets
another, how does the engine determine which of the overrun, attack,
fire at, etc lists gets called?
So here broken down are my questions.
1) Is the above lists in action.def the series of functions that get
called for a particular attack?
2) Would it be possible to switch the do_ action for one of my own that
would implement the tactical combat engine?
3) This question is mainly for Elijah. Were you able to get the
castironlife extension to implement the tactical engine you have on
the site for your game?
Thanks,
Chris Wood