X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FPartyLayout.h;h=1d72aa8ad483bc8fadeafc6cf62a16d41fea5971;hb=520af5a8ef4fdfd4156377d4fccd93eecd450f0f;hp=df247f348ad1b8110ecae3bcd2bac3528d9e12ff;hpb=3ac8cd5fa819210d36499d908607a82ae82cca0b;p=l2e.git diff --git a/src/battle/PartyLayout.h b/src/battle/PartyLayout.h index df247f3..1d72aa8 100644 --- a/src/battle/PartyLayout.h +++ b/src/battle/PartyLayout.h @@ -8,8 +8,9 @@ #ifndef BATTLE_PARTYLAYOUT_H_ #define BATTLE_PARTYLAYOUT_H_ -#include "../geometry/Point.h" +#include "../geometry/Vector.h" +#include #include #include @@ -21,26 +22,34 @@ public: PartyLayout() { } public: - std::vector >::size_type NumPositions() const { return positions.size(); } + std::vector >::size_type NumPositions() const { return positions.size(); } template - void CalculatePositions(U width, U height, std::vector > &dest) const { + void CalculatePositions(U width, U height, std::vector > &dest) const { dest.clear(); dest.reserve(positions.size()); - for (std::vector >::const_iterator i(positions.begin()), end(positions.end()); i != end; ++i) { - dest.push_back(geometry::Point( - i->X() * width / 256, - i->Y() * height / 256 + for (std::vector >::const_iterator i(positions.begin()), end(positions.end()); i != end; ++i) { + dest.push_back(geometry::Vector( + i->X() * width / 255, + i->Y() * height / 223 )); } } + template + geometry::Vector CalculatePosition(std::vector >::size_type index, U width, U height) const { + assert(index >= 0 && index < positions.size()); + return geometry::Vector( + positions[index].X() * width / 255, + positions[index].Y() * height / 223 + ); + } public: - void AddPosition(const geometry::Point &p) { + void AddPosition(const geometry::Vector &p) { positions.push_back(p); } private: - std::vector > positions; + std::vector > positions; };