diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 345bc79a73..e0e63c8c9e 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -52,7 +52,7 @@ bool CSVRender::Cell::addObjects (int start, int end) } CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::string& id) -: mData (data), mId (Misc::StringUtils::lowerCase (id)), mX(0), mY(0) +: mData (data), mId (Misc::StringUtils::lowerCase (id)) { mCellNode = new osg::Group; rootNode->addChild(mCellNode); @@ -76,8 +76,7 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st mTerrain->loadCell(esmLand.mX, esmLand.mY); - mX = esmLand.mX; - mY = esmLand.mY; + mCoordinates = CSMWorld::CellCoordinates (esmLand.mX, esmLand.mY); } } } @@ -245,7 +244,7 @@ void CSVRender::Cell::setCellArrows (int mask) if (enable!=(mCellArrows[i].get()!=0)) { if (enable) - mCellArrows[i].reset (new CellArrow (mCellNode, direction, mX, mY)); + mCellArrows[i].reset (new CellArrow (mCellNode, direction, mCoordinates)); else mCellArrows[i].reset (0); } @@ -254,5 +253,5 @@ void CSVRender::Cell::setCellArrows (int mask) CSMWorld::CellCoordinates CSVRender::Cell::getCoordinates() const { - return CSMWorld::CellCoordinates (mX, mY); + return mCoordinates; } diff --git a/apps/opencs/view/render/cell.hpp b/apps/opencs/view/render/cell.hpp index 5b1badcbe9..7cced4fe37 100644 --- a/apps/opencs/view/render/cell.hpp +++ b/apps/opencs/view/render/cell.hpp @@ -38,8 +38,7 @@ namespace CSVRender osg::ref_ptr mCellNode; std::map mObjects; std::auto_ptr mTerrain; - int mX; - int mY; + CSMWorld::CellCoordinates mCoordinates; std::auto_ptr mCellArrows[4]; /// Ignored if cell does not have an object with the given ID. diff --git a/apps/opencs/view/render/cellarrow.cpp b/apps/opencs/view/render/cellarrow.cpp index ee055a0b1b..443d398dd8 100644 --- a/apps/opencs/view/render/cellarrow.cpp +++ b/apps/opencs/view/render/cellarrow.cpp @@ -8,7 +8,6 @@ #include #include - #include "elements.hpp" CSVRender::CellArrowTag::CellArrowTag (CellArrow *arrow) @@ -27,8 +26,8 @@ void CSVRender::CellArrow::adjustTransform() const int cellSize = 8192; const int offset = cellSize / 2 + 400; - int x = mXIndex*cellSize + cellSize/2; - int y = mYIndex*cellSize + cellSize/2; + int x = mCoordinates.getX()*cellSize + cellSize/2; + int y = mCoordinates.getY()*cellSize + cellSize/2; switch (mDirection) { @@ -61,8 +60,8 @@ void CSVRender::CellArrow::buildShape() } CSVRender::CellArrow::CellArrow (osg::Group *cellNode, Direction direction, - int xIndex, int yIndex) -: mDirection (direction), mParentNode (cellNode), mXIndex (xIndex), mYIndex (yIndex) + const CSMWorld::CellCoordinates& coordinates) +: mDirection (direction), mParentNode (cellNode), mCoordinates (coordinates) { mBaseNode = new osg::PositionAttitudeTransform; @@ -82,12 +81,7 @@ CSVRender::CellArrow::~CellArrow() mParentNode->removeChild (mBaseNode); } -int CSVRender::CellArrow::getXIndex() const +CSMWorld::CellCoordinates CSVRender::CellArrow::getCoordinates() const { - return mXIndex; -} - -int CSVRender::CellArrow::getYIndex() const -{ - return mYIndex; + return mCoordinates; } diff --git a/apps/opencs/view/render/cellarrow.hpp b/apps/opencs/view/render/cellarrow.hpp index 822e63bdc5..4422ec890f 100644 --- a/apps/opencs/view/render/cellarrow.hpp +++ b/apps/opencs/view/render/cellarrow.hpp @@ -5,6 +5,8 @@ #include +#include "../../model/world/cellcoordinates.hpp" + namespace osg { class PositionAttitudeTransform; @@ -48,8 +50,7 @@ namespace CSVRender Direction mDirection; osg::Group* mParentNode; osg::ref_ptr mBaseNode; - int mXIndex; - int mYIndex; + CSMWorld::CellCoordinates mCoordinates; void adjustTransform(); @@ -57,13 +58,12 @@ namespace CSVRender public: - CellArrow (osg::Group *cellNode, Direction direction, int xIndex, int yIndex); + CellArrow (osg::Group *cellNode, Direction direction, + const CSMWorld::CellCoordinates& coordinates); ~CellArrow(); - int getXIndex() const; - - int getYIndex() const; + CSMWorld::CellCoordinates getCoordinates() const; }; }