From: Daniel Karbach Date: Sun, 9 Sep 2012 12:49:45 +0000 (+0200) Subject: added type description of Stats X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=f821f7bf3d3faa6aa27eec278350b861badfa03d;p=l2e.git added type description of Stats --- diff --git a/src/battle/Stats.cpp b/src/battle/Stats.cpp index c35a14a..7ad7aa7 100644 --- a/src/battle/Stats.cpp +++ b/src/battle/Stats.cpp @@ -7,6 +7,11 @@ #include "Stats.h" +#include "../loader/TypeDescription.h" + +using loader::FieldDescription; +using loader::TypeDescription; + namespace battle { Stats::Stats() @@ -31,4 +36,22 @@ Stats::Stats(Uint16 attack, Uint16 defense, Uint16 strength, Uint16 agility, Uin } + +void Stats::CreateTypeDescription() { + Stats s; + TypeDescription &td(TypeDescription::CreateOrGet("Stats")); + + td.SetSize(sizeof(Stats)); + + int numberId(TypeDescription::GetTypeId("Number")); + + td.AddField("atp", FieldDescription(((char *)&s.attack) - ((char *)&s), numberId, false)); + td.AddField("dfp", FieldDescription(((char *)&s.defense) - ((char *)&s), numberId, false)); + td.AddField("str", FieldDescription(((char *)&s.strength) - ((char *)&s), numberId, false)); + td.AddField("agl", FieldDescription(((char *)&s.agility) - ((char *)&s), numberId, false)); + td.AddField("int", FieldDescription(((char *)&s.intelligence) - ((char *)&s), numberId, false)); + td.AddField("gut", FieldDescription(((char *)&s.gut) - ((char *)&s), numberId, false)); + td.AddField("mgr", FieldDescription(((char *)&s.magicResistance) - ((char *)&s), numberId, false)); +} + } diff --git a/src/battle/Stats.h b/src/battle/Stats.h index ae885bf..5f0d17d 100644 --- a/src/battle/Stats.h +++ b/src/battle/Stats.h @@ -35,14 +35,16 @@ public: void SetGut(Uint8 g) { gut = g; } void SetMagicResistance(Uint16 m) { magicResistance = m; } + static void CreateTypeDescription(); + private: - Uint16 attack; - Uint16 defense; - Uint16 strength; - Uint16 agility; - Uint16 intelligence; - Uint16 magicResistance; - Uint8 gut; + int attack; + int defense; + int strength; + int agility; + int intelligence; + int magicResistance; + int gut; };