Re: [Warzone-dev] Patch to fix repair droid disorder when attached to commander

2006-12-04 Thread Dennis Schridde
Am Montag, 4. Dezember 2006 10:43 schrieb [EMAIL PROTECTED]:
 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.
What about other non attacking units like sensors (and I guess there are 
others)?
Do we need to handle them as special cases, too?
If yes, would it somehow be possible to make this more generic? Eg classify a 
droid as not attacking?

 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.
Would be good, Per and I allready talked about that a looong time ago.
But the code is currently very much moving and I think we didn't yet agree on 
a style we want to use, so we skiped it for now.

--Dennis


pgpzmIloXEoYo.pgp
Description: PGP signature
___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] Patch to fix repair droid disorder when attached to commander

2006-12-04 Thread tmhikaru
On Mon, Dec 04, 2006 at 04:52:57PM +0100, Dennis Schridde wrote:
 What about other non attacking units like sensors (and I guess there are 
 others)?
 Do we need to handle them as special cases, too?
I don't know. I admit I hadn't even thought of that, the repair droid
problem has been driving me crazy for so long that when I finally found the
solution, I didn't even think of that. In addition, I don't use sensors or
other kinds of non attacking units (other than repair droids/cyborgs) in a
commander group because they don't seem to provide any benefits; however,
it'd be a good idea to find out if they also malfunction wouldn't it? I'll
test this tonight.

 If yes, would it somehow be possible to make this more generic? Eg classify a 
 droid as not attacking?
I don't know. Sorry, this is the first time I've worked with the code so I
don't even know if there's a generic classification for things like non
attacking units. I haven't *seen* one, but that doesn't mean much at this
point. If something to do the equivalent doesn't already exist, I could
invent a function to do this - obviously if something does, well, please
tell me and I'll use it instead if I need to.(Reinventing the wheel is bad. :)

  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.
 Would be good, Per and I allready talked about that a looong time ago.
 But the code is currently very much moving and I think we didn't yet agree on 
 a style we want to use, so we skiped it for now.
Maybe we should start discussing the kind of style to use then? I'm not
saying you should run astyle against the tree now, or even relatively soon.
If you haven't agreed on the style to use, that's one more thing preventing
you from actually doing it right? I'll drop this if it's a touchy subject,
but I would like to be able to easily understand nested code. :)

Hikaru-orly
Tim McGrath

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] Patch to fix repair droid disorder when attached to commander

2006-12-04 Thread tmhikaru
On Mon, Dec 04, 2006 at 07:57:38PM +0100, Dennis Schridde wrote:
 Would be nice if you could find out.
 But currently I don't know what the usual action of a sensor is, so I can't 
 tell you how that should be done...
 Does it even do _anything_ besides just rolling around?
From playing the game back when I was fooling around with them in commander
groups, no. Even units attached to the sensor wouldn't do anything if the
commander started firing on something; It was greatly disappointing to me. I
have yet to test how the current code works in the game...

Watermelon2 told me on IRC while I was sleeping that I have read your
mail,to tell whether a unit is a combat or non-combat,the easiest way is to
check the numWeaps of the 'psDroid' got passed to that function.numWeaps = 0
is non combat numWeaps =1 is combat etc. - Obvious, and makes sense
(Thanks Watermelon2)

 Shure we should decide on a style...
 
 The ansi style looks good to me.
 With options:
 --brackets=break --indent-switches --indent-cases  
 --indent-preprocessor --one-line=keep-statements --one-line=keep-blocks
 
 What I wouldn't set is --convert-tabs
Looks good to me :)

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] Patch to fix repair droid disorder when attached to commander

2006-12-04 Thread tmhikaru
Did a bit of testing; all of the non weapon units were affected by this
problem, but really this wouldn't have been a big deal anyway since they
*still* couldn't attack things. (They'd just act like the bugged repair
units and would make the sfx for wheels/tracks without moving) If memory
serves the original behavior for them was just to follow the commander
around anyway, so this doesn't IMHO break anything.

Hikaru-orly
Tim McGrathIndex: 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-numWeaps  0))
{
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