From: Daniel Karbach Date: Sat, 8 Sep 2012 12:38:21 +0000 (+0200) Subject: added type description of Ikari X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;ds=sidebyside;h=5406a47cf13ec720c39094765a75906c7ed1cdbc;p=l2e.git added type description of Ikari --- diff --git a/src/common/Ikari.cpp b/src/common/Ikari.cpp index 6f7da0c..408b0f8 100644 --- a/src/common/Ikari.cpp +++ b/src/common/Ikari.cpp @@ -7,6 +7,11 @@ #include "Ikari.h" +#include "../loader/TypeDescription.h" + +using loader::FieldDescription; +using loader::TypeDescription; + namespace common { Ikari::Ikari() @@ -16,4 +21,22 @@ Ikari::Ikari() } + +void Ikari::CreateTypeDescription() { + Ikari i; + TypeDescription &td(TypeDescription::CreateOrGet("Ikari")); + + td.SetSize(sizeof(Ikari)); + + int boolId(TypeDescription::GetTypeId("Boolean")); + int numberId(TypeDescription::GetTypeId("Number")); // FIXME: need small number type + int stringId(TypeDescription::GetTypeId("String")); + int targetsId(TypeDescription::GetTypeId("TargetingMode")); + + td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId, true)); + td.AddField("cost", FieldDescription(((char *)&i.cost) - ((char *)&i), numberId, false)); + td.AddField("targets", FieldDescription(((char *)&i.targetingMode) - ((char *)&i), targetsId, false)); + td.AddField("physical", FieldDescription(((char *)&i.isPhysical) - ((char *)&i), boolId, true)); +} + } diff --git a/src/common/Ikari.h b/src/common/Ikari.h index 2999538..76730de 100644 --- a/src/common/Ikari.h +++ b/src/common/Ikari.h @@ -35,10 +35,12 @@ public: void SetMagical() { isPhysical = false; } void SetPhysical() { isPhysical = true; } + static void CreateTypeDescription(); + private: const char *name; - Uint8 cost; + int cost; TargetingMode targetingMode; bool isPhysical;