4 * Created on: Aug 19, 2012
10 #include "../loader/TypeDescription.h"
12 using loader::FieldDescription;
13 using loader::TypeDescription;
28 Stats::Stats(Uint16 attack, Uint16 defense, Uint16 strength, Uint16 agility, Uint16 intelligence, Uint8 gut, Uint16 magicResistance)
33 , intelligence(intelligence)
34 , magicResistance(magicResistance)
40 void Stats::CreateTypeDescription() {
43 int numberId(TypeDescription::GetTypeId("Number"));
45 TypeDescription &td(TypeDescription::CreateOrGet("Stats"));
46 td.SetSize(sizeof(Stats));
48 td.AddField("atp", FieldDescription(((char *)&s.attack) - ((char *)&s), numberId, false));
49 td.AddField("dfp", FieldDescription(((char *)&s.defense) - ((char *)&s), numberId, false));
50 td.AddField("str", FieldDescription(((char *)&s.strength) - ((char *)&s), numberId, false));
51 td.AddField("agl", FieldDescription(((char *)&s.agility) - ((char *)&s), numberId, false));
52 td.AddField("int", FieldDescription(((char *)&s.intelligence) - ((char *)&s), numberId, false));
53 td.AddField("gut", FieldDescription(((char *)&s.gut) - ((char *)&s), numberId, false));
54 td.AddField("mgr", FieldDescription(((char *)&s.magicResistance) - ((char *)&s), numberId, false));