X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FSpell.cpp;h=4fce398bdaf16e534c702736b1d12d101f0362f9;hb=2a1d9169e1f6c2dfe0f93ed40d5fb68d3da342af;hp=f347774317cfae7e70050df334b2c3a369a9f87d;hpb=d872d756e64b8f1f57cba64ae19f479f8eab3927;p=l2e.git diff --git a/src/common/Spell.cpp b/src/common/Spell.cpp index f347774..4fce398 100644 --- a/src/common/Spell.cpp +++ b/src/common/Spell.cpp @@ -7,11 +7,40 @@ #include "Spell.h" +#include "../loader/TypeDescription.h" + +using loader::FieldDescription; +using loader::TypeDescription; + namespace common { Spell::Spell() -: name(""), value(0), cost(0), usability(0) { +: name(""), value(0), cost(0), status(false), battle(false) { + +} + + +void Spell::CreateTypeDescription() { + Spell s; + + int boolId(TypeDescription::GetTypeId("Boolean")); + int numberId(TypeDescription::GetTypeId("Number")); + int stringId(TypeDescription::GetTypeId("String")); + int targetsId(TypeDescription::GetTypeId("TargetingMode")); + + TypeDescription &td(TypeDescription::CreateOrGet("Spell")); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Spell)); + + 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)); + td.AddField("status", FieldDescription(((char *)&s.status) - ((char *)&s), boolId, false)); + td.AddField("battle", FieldDescription(((char *)&s.battle) - ((char *)&s), boolId, false)); +} +void Spell::Construct(void *data) { + new (data) Spell; } }