Hey. I've been chasing this bug for a long time, finally *nailed* it: The
bug appears semi randomly which is part of why it was so hard to *find* -
especially since it tended to more often than not simply not appear on other
people's machines.

What you do to demonstrate this bug (well, when it feels like happening
anyway): Attach repair units to a commander. While the commander is firing
at something, if any unit in the range of distance of the repair units get
damaged, they sometimes won't do anything. (Defined as *will* chase the
commander around, but *won't* fix anything.)

Doing a bunch of debugging proved that the units that were getting messed up
were following the order to defend the commander(DORDER_GUARD), but were
being told to *ATTACK* the target the commander was firing at; I don't know
exactly why, but after being told to attack something they go back to action
state DACTION_NONE on the next loop around... Being told to attack things
seems to (from my reading of the code in order.c) make it skip the calls to
make them look for things to fix.

As for how sometimes the repair units worked fine while attached to a
commander without this patch I don't know why, but this patch fixes the
problem I was having with them getting stuck every time my commander fired
at something.

By the way, the formatting of the code is a little wacky, perhaps you guys
should use astyle to clean it up? Just a suggestion.

Hikaru-orly
Tim McGrath
Index: src/order.c
===================================================================
--- src/order.c (revision 535)
+++ src/order.c (working copy)
@@ -1218,7 +1218,8 @@
 
                // get units in a command group to attack the commanders target
                if ((psDroid->droidType != DROID_COMMAND) &&
-                       psDroid->psGroup && (psDroid->psGroup->type == 
GT_COMMAND))
+                       psDroid->psGroup && (psDroid->psGroup->type == 
GT_COMMAND) &&
+                       !(psDroid->droidType == DROID_REPAIR OR 
psDroid->droidType == DROID_CYBORG_REPAIR))
                {
                        if ((psDroid->psGroup->psCommander->action == 
DACTION_ATTACK) &&
                                
(psDroid->psGroup->psCommander->psActionTarget[0] != NULL))
_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to