]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/PartyLayout.cpp
renamed namespace geometry -> math
[l2e.git] / src / battle / PartyLayout.cpp
index ad0a54877c6b3c53e9266ea76cdeaa5c869cd2e4..e46b276d685b038efe2ce04bbf9f07295c40827e 100644 (file)
@@ -1,16 +1,11 @@
-/*
- * PartyLayout.cpp
- *
- *  Created on: Aug 5, 2012
- *      Author: holy
- */
-
 #include "PartyLayout.h"
 
+#include "../loader/Interpreter.h"
 #include "../loader/TypeDescription.h"
 
-using geometry::Vector;
+using math::Vector;
 using loader::FieldDescription;
+using loader::Interpreter;
 using loader::TypeDescription;
 using std::vector;
 
@@ -38,13 +33,17 @@ void PartyLayout::CalculatePositions(int width, int height, vector<Vector<int> >
 
 void PartyLayout::CreateTypeDescription() {
        PartyLayout p;
-       TypeDescription &td(TypeDescription::CreateOrGet("PartyLayout"));
 
+       TypeDescription &td(TypeDescription::Create(TYPE_ID, "PartyLayout"));
+       td.SetDescription("Positions of party members");
+       td.SetConstructor(&Construct);
        td.SetSize(sizeof(PartyLayout));
 
-       int vectorId(TypeDescription::GetTypeId("Vector"));
+       td.AddField("positions", FieldDescription(((char *)&p.positions) - ((char *)&p), Interpreter::VECTOR_ID).SetReferenced().SetAggregate().SetDescription("the members' positions"));
+}
 
-       td.AddField("positions", FieldDescription(((char *)&p.positions) - ((char *)&p), vectorId, true, true));
+void PartyLayout::Construct(void *data) {
+       new (data) PartyLayout;
 }
 
 }