1 #include "PartyLayout.h"
3 #include "../loader/Interpreter.h"
4 #include "../loader/TypeDescription.h"
7 using loader::FieldDescription;
8 using loader::Interpreter;
9 using loader::TypeDescription;
14 Vector<int> PartyLayout::CalculatePosition(int index, int width, int height) const {
15 assert(index >= 0 && index < numPositions);
17 positions[index].X() * width / 255,
18 positions[index].Y() * height / 223
22 void PartyLayout::CalculatePositions(int width, int height, vector<Vector<int> > &dest) const {
24 dest.reserve(numPositions);
25 for (int i(0); i < numPositions; ++i) {
26 dest.push_back(Vector<int>(
27 positions[i].X() * width / 255,
28 positions[i].Y() * height / 223
34 void PartyLayout::CreateTypeDescription() {
37 TypeDescription &td(TypeDescription::Create(TYPE_ID, "PartyLayout"));
38 td.SetDescription("Positions of party members");
39 td.SetConstructor(&Construct);
40 td.SetSize(sizeof(PartyLayout));
42 td.AddField("positions", FieldDescription(((char *)&p.positions) - ((char *)&p), Interpreter::VECTOR_ID).SetReferenced().SetAggregate().SetDescription("the members' positions"));
45 void PartyLayout::Construct(void *data) {
46 new (data) PartyLayout;