]> git.localhorst.tv Git - l2e.git/blob - src/common/Spell.cpp
added area bounds to debug overlay
[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), status(false), battle(false) {
19
20 }
21
22
23 void Spell::CreateTypeDescription() {
24         Spell s;
25
26         int boolId(TypeDescription::GetTypeId("Boolean"));
27         int numberId(TypeDescription::GetTypeId("Number"));
28         int stringId(TypeDescription::GetTypeId("String"));
29         int targetsId(TypeDescription::GetTypeId("TargetingMode"));
30
31         TypeDescription &td(TypeDescription::CreateOrGet("Spell"));
32         td.SetConstructor(&Construct);
33         td.SetSize(sizeof(Spell));
34
35         td.AddField("name", FieldDescription(((char *)&s.name) - ((char *)&s), stringId, true));
36         td.AddField("cost", FieldDescription(((char *)&s.cost) - ((char *)&s), numberId, false));
37         td.AddField("targets", FieldDescription(((char *)&s.targetingMode) - ((char *)&s), targetsId, false));
38         td.AddField("status", FieldDescription(((char *)&s.status) - ((char *)&s), boolId, false));
39         td.AddField("battle", FieldDescription(((char *)&s.battle) - ((char *)&s), boolId, false));
40 }
41
42 void Spell::Construct(void *data) {
43         new (data) Spell;
44 }
45
46 }