From: Daniel Karbach Date: Sun, 9 Sep 2012 12:40:20 +0000 (+0200) Subject: added partial type description of Spell X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;ds=inline;h=76bfe67c6f41be9c862213a3cba919e6c00955b0;p=l2e.git added partial type description of Spell --- diff --git a/src/common/Spell.cpp b/src/common/Spell.cpp index f347774..9070346 100644 --- a/src/common/Spell.cpp +++ b/src/common/Spell.cpp @@ -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)); +} + } diff --git a/src/common/Spell.h b/src/common/Spell.h index d32de46..9bf0a4b 100644 --- a/src/common/Spell.h +++ b/src/common/Spell.h @@ -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;