X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHero.cpp;h=8138bc11d89c328d20374888284aa8521f6d28d7;hb=b02da898c7c8a08141df4e797774a61cf5e0163f;hp=a736c671ec5ed0946a5e3856342b2b6dd8cbde45;hpb=81da0a7970ce80843ef8f144da06c1e0e2d950a9;p=l2e.git diff --git a/src/battle/Hero.cpp b/src/battle/Hero.cpp index a736c67..8138bc1 100644 --- a/src/battle/Hero.cpp +++ b/src/battle/Hero.cpp @@ -156,9 +156,6 @@ void Hero::UpdateIkariMenu(const Resources *res) { void Hero::CreateTypeDescription() { Hero h; - TypeDescription &td(TypeDescription::CreateOrGet("Hero")); - - td.SetSize(sizeof(Hero)); int animationId(TypeDescription::GetTypeId("Animation")); int numberId(TypeDescription::GetTypeId("Number")); @@ -166,6 +163,10 @@ void Hero::CreateTypeDescription() { int statsId(TypeDescription::GetTypeId("Stats")); int stringId(TypeDescription::GetTypeId("String")); + TypeDescription &td(TypeDescription::CreateOrGet("Hero")); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Hero)); + td.AddField("name", FieldDescription(((char *)&h.name) - ((char *)&h), stringId, true)); td.AddField("sprite", FieldDescription(((char *)&h.sprite) - ((char *)&h), spriteId, true)); td.AddField("level", FieldDescription(((char *)&h.level) - ((char *)&h), numberId, false)); @@ -177,9 +178,13 @@ void Hero::CreateTypeDescription() { td.AddField("ip", FieldDescription(((char *)&h.ip) - ((char *)&h), numberId, false)); td.AddField("stats", FieldDescription(((char *)&h.stats) - ((char *)&h), statsId, false)); - td.AddField("attackAnimation", FieldDescription(((char *)&h.attackAnimation) - ((char *)&h), animationId, false)); - td.AddField("spellAnimation", FieldDescription(((char *)&h.spellAnimation) - ((char *)&h), animationId, false)); - td.AddField("meleeAnimation", FieldDescription(((char *)&h.meleeAnimation) - ((char *)&h), animationId, false)); + td.AddField("attackAnimation", FieldDescription(((char *)&h.attackAnimation) - ((char *)&h), animationId, true)); + td.AddField("spellAnimation", FieldDescription(((char *)&h.spellAnimation) - ((char *)&h), animationId, true)); + td.AddField("meleeAnimation", FieldDescription(((char *)&h.meleeAnimation) - ((char *)&h), animationId, true)); +} + +void Hero::Construct(void *data) { + new (data) Hero; } }