]> git.localhorst.tv Git - l2e.git/commitdiff
added partial type description of Item
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 9 Sep 2012 11:51:11 +0000 (13:51 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 9 Sep 2012 11:51:11 +0000 (13:51 +0200)
still missing a way to describe bit fields/flags

src/common/Item.cpp
src/common/Item.h

index f14fd22e7b4374f41bd7c481c4d04a96891f333f..e695e8d641c0ccf3f7530a024e1c04b081cb82c2 100644 (file)
@@ -7,6 +7,11 @@
 
 #include "Item.h"
 
+#include "../loader/TypeDescription.h"
+
+using loader::FieldDescription;
+using loader::TypeDescription;
+
 namespace common {
 
 Item::Item()
@@ -24,4 +29,26 @@ Item::Item()
 
 }
 
+
+void Item::CreateTypeDescription() {
+       Item i;
+       TypeDescription &td(TypeDescription::CreateOrGet("Item"));
+
+       td.SetSize(sizeof(Item));
+
+       int animationId(TypeDescription::GetTypeId("Animation"));
+       int ikariId(TypeDescription::GetTypeId("Ikari"));
+       int numberId(TypeDescription::GetTypeId("Number"));
+       int spriteId(TypeDescription::GetTypeId("Sprite"));
+       int stringId(TypeDescription::GetTypeId("String"));
+       int targetsId(TypeDescription::GetTypeId("TargetingMode"));
+
+       td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId, true));
+       td.AddField("menuicon", FieldDescription(((char *)&i.menuIcon) - ((char *)&i), spriteId, true));
+       // TODO: implement flags/fields (e.g. for usability)
+       td.AddField("targets", FieldDescription(((char *)&i.targettingMode) - ((char *)&i), targetsId, false));
+       td.AddField("ikari", FieldDescription(((char *)&i.ikari) - ((char *)&i), ikariId, true));
+       td.AddField("attackanimation", FieldDescription(((char *)&i.attackAnimation) - ((char *)&i), animationId, true));
+}
+
 }
index 1d9d51c56baa8260779f6b3115d876bc8d4a964d..5a7a45381fc7fa5e08049cd9349d657e96ef1018 100644 (file)
@@ -88,6 +88,8 @@ public:
        void SetIkari(const Ikari *i) { ikari = i; }
        void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
 
+       static void CreateTypeDescription();
+
 private:
        enum Usability {
                USABILITY_MOST_USEFUL = 1,