#include "Item.h"
+#include "../loader/TypeDescription.h"
+
+using loader::FieldDescription;
+using loader::TypeDescription;
+
namespace common {
Item::Item()
}
+
+void Item::CreateTypeDescription() {
+ Item i;
+ TypeDescription &td(TypeDescription::CreateOrGet("Item"));
+
+ td.SetSize(sizeof(Item));
+
+ int animationId(TypeDescription::GetTypeId("Animation"));
+ int ikariId(TypeDescription::GetTypeId("Ikari"));
+ int numberId(TypeDescription::GetTypeId("Number"));
+ int spriteId(TypeDescription::GetTypeId("Sprite"));
+ int stringId(TypeDescription::GetTypeId("String"));
+ int targetsId(TypeDescription::GetTypeId("TargetingMode"));
+
+ td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId, true));
+ td.AddField("menuicon", FieldDescription(((char *)&i.menuIcon) - ((char *)&i), spriteId, true));
+ // TODO: implement flags/fields (e.g. for usability)
+ td.AddField("targets", FieldDescription(((char *)&i.targettingMode) - ((char *)&i), targetsId, false));
+ td.AddField("ikari", FieldDescription(((char *)&i.ikari) - ((char *)&i), ikariId, true));
+ td.AddField("attackanimation", FieldDescription(((char *)&i.attackAnimation) - ((char *)&i), animationId, true));
+}
+
}
void SetIkari(const Ikari *i) { ikari = i; }
void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
+ static void CreateTypeDescription();
+
private:
enum Usability {
USABILITY_MOST_USEFUL = 1,