]> git.localhorst.tv Git - l2e.git/blob - Trigger.cpp
cb65ae641cb3766a309d46d31cc9b4a9c7937a95
[l2e.git] / Trigger.cpp
1 #include "Trigger.h"
2
3 #include "../common/Script.h"
4 #include "../loader/Interpreter.h"
5 #include "../loader/TypeDescription.h"
6
7 using loader::FieldDescription;
8 using loader::Interpreter;
9 using loader::TypeDescription;
10
11 namespace map {
12
13 Trigger::Trigger()
14 : script(0)
15 , type(TYPE_CONTACT) {
16
17 }
18
19
20 void Trigger::CreateTypeDescription() {
21         Trigger t;
22
23         TypeDescription &td(TypeDescription::Create(TYPE_ID, "Trigger"));
24         td.SetConstructor(&Construct);
25         td.SetSize(sizeof(Trigger));
26
27         td.AddField("script", FieldDescription(((char *)&t.script) - ((char *)&t), Interpreter::SCRIPT_ID).SetReferenced());
28         td.AddField("position", FieldDescription(((char *)&t.tilePosition) - ((char *)&t), Interpreter::VECTOR_ID));
29         td.AddField("type", FieldDescription(((char *)&t.type) - ((char *)&t), Interpreter::NUMBER_ID));
30 }
31
32 void Trigger::Construct(void *data) {
33         new (data) Trigger;
34 }
35
36 }