On 2/10/07, Gerard Krol <[EMAIL PROTECTED]> wrote:

Hi all,

As some of you may know, power required and hit points of droid parts
are stored in central arrays. Individual body types are an index into
this array and are used like this:
(asBodyStats + psTemplate->asParts[COMP_BODY])->buildPower

The code in intSetTemplatePowerShadowStats and
intSetTemplateBodyShadowStats did store a pointer in this index by using
the difference with the asBodyStats address, so that after this addition
the correct address would magically reappear. Guilty code looks like this:

compTempl.asParts[COMP_BODY] = (BODY_STATS *)psStats - asBodyStats;

Funny thing is: on 64bit: sizeof(SDWORD) < sizeof(void*)

In the attached patch, the calls to calcTemplatePower and
calcTemplateBody were removed, and the (simple) formula's used for
calculation were directly included in the two modified functions.

- Gerard

I think that kind of stuff is everywhere in the source,at least I saw
multiple instances of 'weapId = psStats - asWeaponStats' or 'psStats =
asWeaponStats + weaponId'...
_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to