mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-24 04:11:50 -04:00
Make LocalMap methods const
This commit is contained in:
parent
1403fbce1b
commit
6d9063e544
@ -96,7 +96,7 @@ namespace MWRender
|
||||
mRoot->removeChild(rtt);
|
||||
}
|
||||
|
||||
const osg::Vec2f LocalMap::rotatePoint(const osg::Vec2f& point, const osg::Vec2f& center, const float angle)
|
||||
const osg::Vec2f LocalMap::rotatePoint(const osg::Vec2f& point, const osg::Vec2f& center, const float angle) const
|
||||
{
|
||||
return osg::Vec2f(
|
||||
std::cos(angle) * (point.x() - center.x()) - std::sin(angle) * (point.y() - center.y()) + center.x(),
|
||||
@ -109,12 +109,15 @@ namespace MWRender
|
||||
mInteriorSegments.clear();
|
||||
}
|
||||
|
||||
void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
|
||||
void LocalMap::saveFogOfWar(MWWorld::CellStore* cell) const
|
||||
{
|
||||
if (!mInterior)
|
||||
{
|
||||
const MapSegment& segment
|
||||
= mExteriorSegments[std::make_pair(cell->getCell()->getGridX(), cell->getCell()->getGridY())];
|
||||
const auto it
|
||||
= mExteriorSegments.find(std::make_pair(cell->getCell()->getGridX(), cell->getCell()->getGridY()));
|
||||
if (it == mExteriorSegments.end())
|
||||
return;
|
||||
const MapSegment& segment = it->second;
|
||||
|
||||
if (segment.mFogOfWarImage && segment.mHasFogState)
|
||||
{
|
||||
@ -146,7 +149,10 @@ namespace MWRender
|
||||
{
|
||||
for (int y = 0; y < segments.second; ++y)
|
||||
{
|
||||
const MapSegment& segment = mInteriorSegments[std::make_pair(x, y)];
|
||||
const auto it = mInteriorSegments.find(std::make_pair(x, y));
|
||||
if (it == mInteriorSegments.end())
|
||||
continue;
|
||||
const MapSegment& segment = it->second;
|
||||
if (!segment.mHasFogState)
|
||||
continue;
|
||||
ESM::FogTexture& texture = fog->mFogTextures.emplace_back();
|
||||
@ -422,7 +428,7 @@ namespace MWRender
|
||||
}
|
||||
}
|
||||
|
||||
void LocalMap::worldToInteriorMapPosition(osg::Vec2f pos, float& nX, float& nY, int& x, int& y)
|
||||
void LocalMap::worldToInteriorMapPosition(osg::Vec2f pos, float& nX, float& nY, int& x, int& y) const
|
||||
{
|
||||
pos = rotatePoint(pos, mCenter, mAngle);
|
||||
|
||||
@ -435,7 +441,7 @@ namespace MWRender
|
||||
nY = 1.0f - (pos.y() - min.y() - mMapWorldSize * y) / mMapWorldSize;
|
||||
}
|
||||
|
||||
osg::Vec2f LocalMap::interiorMapToWorldPosition(float nX, float nY, int x, int y)
|
||||
osg::Vec2f LocalMap::interiorMapToWorldPosition(float nX, float nY, int x, int y) const
|
||||
{
|
||||
osg::Vec2f min(mBounds.xMin(), mBounds.yMin());
|
||||
osg::Vec2f pos(mMapWorldSize * (nX + x) + min.x(), mMapWorldSize * (1.0f - nY + y) + min.y());
|
||||
|
@ -83,14 +83,14 @@ namespace MWRender
|
||||
* Save the fog of war for this cell to its CellStore.
|
||||
* @remarks This should be called when unloading a cell, and for all active cells prior to saving the game.
|
||||
*/
|
||||
void saveFogOfWar(MWWorld::CellStore* cell);
|
||||
void saveFogOfWar(MWWorld::CellStore* cell) const;
|
||||
|
||||
/**
|
||||
* Get the interior map texture index and normalized position on this texture, given a world position
|
||||
*/
|
||||
void worldToInteriorMapPosition(osg::Vec2f pos, float& nX, float& nY, int& x, int& y);
|
||||
void worldToInteriorMapPosition(osg::Vec2f pos, float& nX, float& nY, int& x, int& y) const;
|
||||
|
||||
osg::Vec2f interiorMapToWorldPosition(float nX, float nY, int x, int y);
|
||||
osg::Vec2f interiorMapToWorldPosition(float nX, float nY, int x, int y) const;
|
||||
|
||||
/**
|
||||
* Check if a given position is explored by the player (i.e. not obscured by fog of war)
|
||||
@ -149,7 +149,7 @@ namespace MWRender
|
||||
int mCellDistance;
|
||||
|
||||
float mAngle;
|
||||
const osg::Vec2f rotatePoint(const osg::Vec2f& point, const osg::Vec2f& center, const float angle);
|
||||
const osg::Vec2f rotatePoint(const osg::Vec2f& point, const osg::Vec2f& center, const float angle) const;
|
||||
|
||||
void requestExteriorMap(const MWWorld::CellStore* cell, MapSegment& segment);
|
||||
void requestInteriorMap(const MWWorld::CellStore* cell);
|
||||
|
Loading…
x
Reference in New Issue
Block a user