mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-26 14:09:46 +00:00
- Morrowind load over 300,000 references, so even small inefficiencies add up to longer loading times. - std::map is used, but should try others, std::unordered_map or even std::vector
41 lines
860 B
C++
41 lines
860 B
C++
#include "ref.hpp"
|
|
|
|
#include <cmath>
|
|
|
|
CSMWorld::CellRef::CellRef()
|
|
: mIdNum(0)
|
|
{
|
|
mId.clear();
|
|
mCell.clear();
|
|
mOriginalCell.clear();
|
|
|
|
mRefNum.mIndex = 0;
|
|
mRefNum.mContentFile = 0;
|
|
}
|
|
|
|
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);
|
|
mIdNum = other.mIdNum;
|
|
mId = std::move(other.mId);
|
|
mCell = std::move(other.mCell);
|
|
mOriginalCell = std::move(other.mOriginalCell);
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
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));
|
|
}
|