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

index f347774317cfae7e70050df334b2c3a369a9f87d..907034645b76373b3961340614b988cc6007bbbe 100644 (file)
@@ -7,6 +7,11 @@
 
 #include "Spell.h"
 
+#include "../loader/TypeDescription.h"
+
+using loader::FieldDescription;
+using loader::TypeDescription;
+
 namespace common {
 
 Spell::Spell()
@@ -14,4 +19,21 @@ Spell::Spell()
 
 }
 
+
+void Spell::CreateTypeDescription() {
+       Spell s;
+       TypeDescription &td(TypeDescription::CreateOrGet("Spell"));
+
+       td.SetSize(sizeof(Spell));
+
+       // TODO: flags
+       int numberId(TypeDescription::GetTypeId("Number"));
+       int stringId(TypeDescription::GetTypeId("String"));
+       int targetsId(TypeDescription::GetTypeId("TargetingMode"));
+
+       td.AddField("name", FieldDescription(((char *)&s.name) - ((char *)&s), stringId, true));
+       td.AddField("cost", FieldDescription(((char *)&s.cost) - ((char *)&s), numberId, false));
+       td.AddField("targets", FieldDescription(((char *)&s.targetingMode) - ((char *)&s), targetsId, false));
+}
+
 }
index d32de4689e780044b14092628f06040b498ce750..9bf0a4b8c5b6b689d3f600db671be15ea162dd6d 100644 (file)
@@ -38,6 +38,8 @@ public:
        void SetCost(Uint8 c) { cost = c; }
        void SetUsableInBattle() { usability |= USABILITY_BATTLE; }
 
+       static void CreateTypeDescription();
+
 private:
        enum Usability {
                // USABILITY_UNUSED = 1,
@@ -53,9 +55,9 @@ private:
 private:
        const char *name;
 
-       Uint16 value;
+       int value;
 
-       Uint8 cost;
+       int cost;
        Uint8 usability;
        TargetingMode targetingMode;
        HeroGroup usableBy;