]> git.localhorst.tv Git - l2e.git/blobdiff - src/common/TargetingMode.cpp
switched to static type IDs
[l2e.git] / src / common / TargetingMode.cpp
index 4f365c48d931ca6e584610804783c6d12bb3d812..19b41ec2b469e88773314660252274d9262fff63 100644 (file)
@@ -7,9 +7,11 @@
 
 #include "TargetingMode.h"
 
+#include "../loader/Interpreter.h"
 #include "../loader/TypeDescription.h"
 
 using loader::FieldDescription;
+using loader::Interpreter;
 using loader::TypeDescription;
 
 namespace common {
@@ -17,10 +19,17 @@ namespace common {
 void TargetingMode::CreateTypeDescription() {
        TargetingMode t;
 
-       TypeDescription &td(TypeDescription::CreateOrGet("TargetingMode"));
+       TypeDescription &td(TypeDescription::Create(TYPE_ID, "TargetingMode"));
+       td.SetDescription("Specifies how selection of a target (e.g. for a spell) is performed.");
+       td.SetConstructor(&Construct);
        td.SetSize(sizeof(TargetingMode));
 
-       // TODO: fields
+       td.AddField("faction", FieldDescription(((char *)&t.ally) - ((char *)&t), Interpreter::BOOLEAN_ID).SetDescription("targetted faction; true for ally, false for enemy"));
+       td.AddField("mode", FieldDescription(((char *)&t.mode) - ((char *)&t), Interpreter::NUMBER_ID).SetDescription("attack mode; 0 = all, 1 = multiple, 2 = single"));
+}
+
+void TargetingMode::Construct(void *data) {
+       new (data) TargetingMode;
 }
 
 }