On 1/28/07, Giel van Schijndel <[EMAIL PROTECTED]> wrote:

I assume ai.c's changes belong to 4?

Anyway, on line 74-86 of your patch you modify the droid's target update
code to make sure all targets are updated.

I'm just wondering as to why you wrap it in an if-statement (not the
existing one, but the one you've created). Since even if
`psDroid->numWeaps =< 1' (the else condition), the for loop would still
do exactly the same as your one-time function call. And yes I know this
piece of code probably saves us some CPU instructions, about 4 or so.

This however isn't good enough a reason for making the code that much
harder to read, that simple 3-line for-loop iteration is better to read
and will most certainly have no exponential performance hit, nor linear,
only static (which is negligible).

Well, since that's all my comments on that part of the patch (i.e.
change 4), I've committed it without the if-wrap around the
for-iteration in r683.

--
Giel


the '<=1' check is intended,because a utility droid without weapon will
still have one valid target...if you just use 'for(i = 0;i <
psDroid->numWeaps;i++)' for both weapon and utiltiy droids,the target update
for utility droid will get skipped and cause undesired effects such as
repairing 'died' droid and constructing destroyed building foundation I
think.
_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to