weird skill reading byte alignment fix (reverted to how it was original minus the offsetof change)

develop
Simon Jackson 2010-06-17 19:24:18 +01:00
parent 39222c972a
commit 061108c685
1 changed files with 7 additions and 7 deletions

@ -265,12 +265,12 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
for (uint32_t i = 0; i < furball.defaultSoul.numSkills;i++) for (uint32_t i = 0; i < furball.defaultSoul.numSkills;i++)
{ {
uint32_t temp2 = skills[i]; uint32_t temp2 = skills[i];
// a byte: this gives us 256 skills maximum. ??? // a byte: this gives us 256 skills maximum.
furball.defaultSoul.skills[i].id = p->readDWord (temp2); furball.defaultSoul.skills[i].id = p->readByte (temp2);
furball.defaultSoul.skills[i].rating = furball.defaultSoul.skills[i].rating =
p->readDWord (temp2 + offsetof(t_skill, rating)); p->readByte (temp2 + offsetof(t_skill, rating));
furball.defaultSoul.skills[i].experience = furball.defaultSoul.skills[i].experience =
p->readDWord (temp2 + offsetof(t_skill, experience)); p->readWord (temp2 + offsetof(t_skill, experience));
} }
// mental attributes are part of the soul // mental attributes are part of the soul
@ -413,8 +413,8 @@ bool Creatures::WriteSkills(const uint32_t index, const t_soul &soul)
for (uint32_t i=0; i<soul.numSkills; i++) for (uint32_t i=0; i<soul.numSkills; i++)
{ {
uint32_t temp2 = skills[i]; uint32_t temp2 = skills[i];
p->writeDWord(temp2 + offsetof(t_skill, rating), soul.skills[i].rating); p->writeByte(temp2 + offsetof(t_skill, rating), soul.skills[i].rating);
p->writeDWord(temp2 + offsetof(t_skill, experience), soul.skills[i].experience); p->writeWord(temp2 + offsetof(t_skill, experience), soul.skills[i].experience);
} }
return true; return true;