#include "Spell.h"
+#include "../loader/TypeDescription.h"
+
+using loader::FieldDescription;
+using loader::TypeDescription;
+
namespace common {
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"));
+
+ 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 SetCost(Uint8 c) { cost = c; }
void SetUsableInBattle() { usability |= USABILITY_BATTLE; }
+ static void CreateTypeDescription();
+
private:
enum Usability {
// USABILITY_UNUSED = 1,
private:
const char *name;
- Uint16 value;
+ int value;
- Uint8 cost;
+ int cost;
Uint8 usability;
TargetingMode targetingMode;
HeroGroup usableBy;