2013-06-08 10:45:13 +00:00
|
|
|
#include "ref.hpp"
|
2014-05-27 10:39:26 +00:00
|
|
|
|
2015-01-09 11:05:16 +00:00
|
|
|
#include <cmath>
|
|
|
|
|
2014-05-27 10:39:26 +00:00
|
|
|
CSMWorld::CellRef::CellRef()
|
2015-12-11 10:00:13 +00:00
|
|
|
: mIdNum(0)
|
2014-05-27 10:39:26 +00:00
|
|
|
{
|
2015-12-06 04:20:45 +00:00
|
|
|
mId.clear();
|
|
|
|
mCell.clear();
|
|
|
|
mOriginalCell.clear();
|
|
|
|
|
2014-05-27 10:39:26 +00:00
|
|
|
mRefNum.mIndex = 0;
|
2014-09-18 10:25:17 +00:00
|
|
|
mRefNum.mContentFile = 0;
|
2015-01-09 11:05:16 +00:00
|
|
|
}
|
|
|
|
|
2015-12-06 04:20:45 +00:00
|
|
|
CSMWorld::CellRef::CellRef (CSMWorld::CellRef&& other) : ESM::CellRef (other)
|
|
|
|
{
|
|
|
|
*this = std::move(other);
|
|
|
|
}
|
|
|
|
|
|
|
|
CSMWorld::CellRef& CSMWorld::CellRef::operator= (CSMWorld::CellRef&& other)
|
|
|
|
{
|
|
|
|
if (this != &other)
|
|
|
|
{
|
|
|
|
ESM::CellRef::operator= (other);
|
2015-12-11 10:00:13 +00:00
|
|
|
mIdNum = other.mIdNum;
|
2015-12-06 04:20:45 +00:00
|
|
|
mId = std::move(other.mId);
|
|
|
|
mCell = std::move(other.mCell);
|
|
|
|
mOriginalCell = std::move(other.mOriginalCell);
|
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2015-01-09 11:05:16 +00:00
|
|
|
std::pair<int, int> CSMWorld::CellRef::getCellIndex() const
|
|
|
|
{
|
|
|
|
const int cellSize = 8192;
|
|
|
|
|
|
|
|
return std::make_pair (
|
|
|
|
std::floor (mPos.pos[0]/cellSize), std::floor (mPos.pos[1]/cellSize));
|
2015-04-24 20:52:53 +00:00
|
|
|
}
|