]> git.localhorst.tv Git - l2e.git/blob - src/map/Trigger.cpp
commented headers in app/ directory
[l2e.git] / src / map / Trigger.cpp
1 /*
2  * Trigger.cpp
3  *
4  *  Created on: Oct 3, 2012
5  *      Author: holy
6  */
7
8 #include "Trigger.h"
9
10 #include "../loader/TypeDescription.h"
11
12 using loader::FieldDescription;
13 using loader::TypeDescription;
14
15 namespace map {
16
17 Trigger::Trigger()
18 : script(0)
19 , type(TYPE_CONTACT) {
20
21 }
22
23
24 void Trigger::CreateTypeDescription() {
25         Trigger t;
26
27         int numberId(TypeDescription::GetTypeId("Number"));
28         int scriptId(TypeDescription::GetTypeId("Script"));
29         int vectorId(TypeDescription::GetTypeId("Vector"));
30
31         TypeDescription &td(TypeDescription::CreateOrGet("Trigger"));
32         td.SetConstructor(&Construct);
33         td.SetSize(sizeof(Trigger));
34
35         td.AddField("script", FieldDescription(((char *)&t.script) - ((char *)&t), scriptId).SetReferenced());
36         td.AddField("position", FieldDescription(((char *)&t.tilePosition) - ((char *)&t), vectorId));
37         td.AddField("type", FieldDescription(((char *)&t.type) - ((char *)&t), numberId));
38 }
39
40 void Trigger::Construct(void *data) {
41         new (data) Trigger;
42 }
43
44 }