]> git.localhorst.tv Git - l2e.git/blob - src/common/Spell.cpp
added partial type description of Spell
[l2e.git] / src / common / Spell.cpp
1 /*
2  * Spell.cpp
3  *
4  *  Created on: Aug 10, 2012
5  *      Author: holy
6  */
7
8 #include "Spell.h"
9
10 #include "../loader/TypeDescription.h"
11
12 using loader::FieldDescription;
13 using loader::TypeDescription;
14
15 namespace common {
16
17 Spell::Spell()
18 : name(""), value(0), cost(0), usability(0) {
19
20 }
21
22
23 void Spell::CreateTypeDescription() {
24         Spell s;
25         TypeDescription &td(TypeDescription::CreateOrGet("Spell"));
26
27         td.SetSize(sizeof(Spell));
28
29         // TODO: flags
30         int numberId(TypeDescription::GetTypeId("Number"));
31         int stringId(TypeDescription::GetTypeId("String"));
32         int targetsId(TypeDescription::GetTypeId("TargetingMode"));
33
34         td.AddField("name", FieldDescription(((char *)&s.name) - ((char *)&s), stringId, true));
35         td.AddField("cost", FieldDescription(((char *)&s.cost) - ((char *)&s), numberId, false));
36         td.AddField("targets", FieldDescription(((char *)&s.targetingMode) - ((char *)&s), targetsId, false));
37 }
38
39 }