1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00
OpenMW/apps/openmw/mwworld/cellutils.hpp

21 lines
454 B
C++
Raw Normal View History

#ifndef OPENMW_MWWORLD_CELLUTILS_H
#define OPENMW_MWWORLD_CELLUTILS_H
#include <components/misc/constants.hpp>
#include <components/esm3/cellid.hpp>
#include <cmath>
namespace MWWorld
{
inline ESM::CellId::CellIndex positionToIndex(float x, float y)
{
return {
static_cast<int>(std::floor(x / Constants::CellSizeInUnits)),
static_cast<int>(std::floor(y / Constants::CellSizeInUnits))
};
}
}
#endif