]> git.localhorst.tv Git - l2e.git/commitdiff
added type description of Stats
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 9 Sep 2012 12:49:45 +0000 (14:49 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 9 Sep 2012 12:49:45 +0000 (14:49 +0200)
src/battle/Stats.cpp
src/battle/Stats.h

index c35a14ad339e54c34490e2771a94c451df4d7082..7ad7aa7a841e2925091e396bf67605393af7ecf2 100644 (file)
@@ -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));
+}
+
 }
index ae885bf4aa6021a01d02ad244757f9be856eb5cb..5f0d17d8efc997353181b05374b4b333a6b7dea8 100644 (file)
@@ -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;
 
 };