X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FSpell.cpp;h=8f8784a761ed83840f9ee6c8ad77729ca6302a68;hb=b02da898c7c8a08141df4e797774a61cf5e0163f;hp=907034645b76373b3961340614b988cc6007bbbe;hpb=76bfe67c6f41be9c862213a3cba919e6c00955b0;p=l2e.git diff --git a/src/common/Spell.cpp b/src/common/Spell.cpp index 9070346..8f8784a 100644 --- a/src/common/Spell.cpp +++ b/src/common/Spell.cpp @@ -22,18 +22,23 @@ 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")); + 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)); } +void Spell::Construct(void *data) { + new (data) Spell; +} + }