]> git.localhorst.tv Git - l2e.git/commitdiff
added type description of Ikari
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 8 Sep 2012 12:38:21 +0000 (14:38 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 8 Sep 2012 12:38:21 +0000 (14:38 +0200)
src/common/Ikari.cpp
src/common/Ikari.h

index 6f7da0cd6ce77460771395783b18b31b9b966053..408b0f8277f0d2aba8bbf1f1e56019429813b312 100644 (file)
@@ -7,6 +7,11 @@
 
 #include "Ikari.h"
 
+#include "../loader/TypeDescription.h"
+
+using loader::FieldDescription;
+using loader::TypeDescription;
+
 namespace common {
 
 Ikari::Ikari()
@@ -16,4 +21,22 @@ Ikari::Ikari()
 
 }
 
+
+void Ikari::CreateTypeDescription() {
+       Ikari i;
+       TypeDescription &td(TypeDescription::CreateOrGet("Ikari"));
+
+       td.SetSize(sizeof(Ikari));
+
+       int boolId(TypeDescription::GetTypeId("Boolean"));
+       int numberId(TypeDescription::GetTypeId("Number")); // FIXME: need small number type
+       int stringId(TypeDescription::GetTypeId("String"));
+       int targetsId(TypeDescription::GetTypeId("TargetingMode"));
+
+       td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId, true));
+       td.AddField("cost", FieldDescription(((char *)&i.cost) - ((char *)&i), numberId, false));
+       td.AddField("targets", FieldDescription(((char *)&i.targetingMode) - ((char *)&i), targetsId, false));
+       td.AddField("physical", FieldDescription(((char *)&i.isPhysical) - ((char *)&i), boolId, true));
+}
+
 }
index 299953824df6374cff9e95f36e4f443e8fa22c9d..76730defbc72e0f6a5900aa34faffa1b43111179 100644 (file)
@@ -35,10 +35,12 @@ public:
        void SetMagical() { isPhysical = false; }
        void SetPhysical() { isPhysical = true; }
 
+       static void CreateTypeDescription();
+
 private:
        const char *name;
 
-       Uint8 cost;
+       int cost;
        TargetingMode targetingMode;
 
        bool isPhysical;