mirror of
https://github.com/OpenMW/openmw.git
synced 2025-07-04 01:41:35 +00:00
Rename positionToCellIndex to match return type
This commit is contained in:
parent
98e80d65b0
commit
235eb65c97
9 changed files with 20 additions and 17 deletions
|
@ -275,7 +275,7 @@ namespace MWGui
|
||||||
|
|
||||||
if (!mInterior)
|
if (!mInterior)
|
||||||
{
|
{
|
||||||
ESM::ExteriorCellLocation cellPos = ESM::positionToCellIndex(worldX, worldY);
|
ESM::ExteriorCellLocation cellPos = ESM::positionToExteriorCellLocation(worldX, worldY);
|
||||||
cellIndex.x() = cellPos.mX;
|
cellIndex.x() = cellPos.mX;
|
||||||
cellIndex.y() = cellPos.mY;
|
cellIndex.y() = cellPos.mY;
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace MWGui
|
||||||
std::string_view cellname = transport[i].mCellName;
|
std::string_view cellname = transport[i].mCellName;
|
||||||
bool interior = true;
|
bool interior = true;
|
||||||
const ESM::ExteriorCellLocation cellIndex
|
const ESM::ExteriorCellLocation cellIndex
|
||||||
= ESM::positionToCellIndex(transport[i].mPos.pos[0], transport[i].mPos.pos[1]);
|
= ESM::positionToExteriorCellLocation(transport[i].mPos.pos[0], transport[i].mPos.pos[1]);
|
||||||
if (cellname.empty())
|
if (cellname.empty())
|
||||||
{
|
{
|
||||||
MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getExterior(cellIndex);
|
MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getExterior(cellIndex);
|
||||||
|
@ -192,7 +192,7 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(1);
|
MWBase::Environment::get().getWindowManager()->fadeScreenOut(1);
|
||||||
const ESM::ExteriorCellLocation posCell = ESM::positionToCellIndex(pos.pos[0], pos.pos[1]);
|
const ESM::ExteriorCellLocation posCell = ESM::positionToExteriorCellLocation(pos.pos[0], pos.pos[1]);
|
||||||
ESM::RefId cellId = ESM::Cell::generateIdForCell(!interior, cellname, posCell.mX, posCell.mY);
|
ESM::RefId cellId = ESM::Cell::generateIdForCell(!interior, cellname, posCell.mX, posCell.mY);
|
||||||
|
|
||||||
// Teleports any followers, too.
|
// Teleports any followers, too.
|
||||||
|
|
|
@ -402,7 +402,7 @@ namespace MWScript
|
||||||
if (store->isExterior())
|
if (store->isExterior())
|
||||||
{
|
{
|
||||||
const ESM::ExteriorCellLocation cellIndex
|
const ESM::ExteriorCellLocation cellIndex
|
||||||
= ESM::positionToCellIndex(x, y, store->getCell()->getWorldSpace());
|
= ESM::positionToExteriorCellLocation(x, y, store->getCell()->getWorldSpace());
|
||||||
store = &worldModel->getExterior(cellIndex);
|
store = &worldModel->getExterior(cellIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ namespace MWScript
|
||||||
if (!isPlayer)
|
if (!isPlayer)
|
||||||
return;
|
return;
|
||||||
const ESM::ExteriorCellLocation cellIndex
|
const ESM::ExteriorCellLocation cellIndex
|
||||||
= ESM::positionToCellIndex(x, y, store->getCell()->getWorldSpace());
|
= ESM::positionToExteriorCellLocation(x, y, store->getCell()->getWorldSpace());
|
||||||
store = &worldModel->getExterior(cellIndex);
|
store = &worldModel->getExterior(cellIndex);
|
||||||
}
|
}
|
||||||
if (store)
|
if (store)
|
||||||
|
@ -469,7 +469,7 @@ namespace MWScript
|
||||||
if (isPlayer)
|
if (isPlayer)
|
||||||
world->getPlayer().setTeleported(true);
|
world->getPlayer().setTeleported(true);
|
||||||
const ESM::ExteriorCellLocation cellIndex
|
const ESM::ExteriorCellLocation cellIndex
|
||||||
= ESM::positionToCellIndex(x, y, ESM::Cell::sDefaultWorldspaceId);
|
= ESM::positionToExteriorCellLocation(x, y, ESM::Cell::sDefaultWorldspaceId);
|
||||||
|
|
||||||
// another morrowind oddity: player will be moved to the exterior cell at this location,
|
// another morrowind oddity: player will be moved to the exterior cell at this location,
|
||||||
// non-player actors will move within the cell they are in.
|
// non-player actors will move within the cell they are in.
|
||||||
|
@ -570,7 +570,7 @@ namespace MWScript
|
||||||
if (player.getCell()->isExterior())
|
if (player.getCell()->isExterior())
|
||||||
{
|
{
|
||||||
const ESM::ExteriorCellLocation cellIndex
|
const ESM::ExteriorCellLocation cellIndex
|
||||||
= ESM::positionToCellIndex(x, y, player.getCell()->getCell()->getWorldSpace());
|
= ESM::positionToExteriorCellLocation(x, y, player.getCell()->getCell()->getWorldSpace());
|
||||||
store = &MWBase::Environment::get().getWorldModel()->getExterior(cellIndex);
|
store = &MWBase::Environment::get().getWorldModel()->getExterior(cellIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto cellPos = ESM::positionToCellIndex(ref.mDoorDest.pos[0], ref.mDoorDest.pos[1]);
|
const auto cellPos = ESM::positionToExteriorCellLocation(ref.mDoorDest.pos[0], ref.mDoorDest.pos[1]);
|
||||||
return ESM::RefId::esm3ExteriorCell(cellPos.mX, cellPos.mY);
|
return ESM::RefId::esm3ExteriorCell(cellPos.mX, cellPos.mY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -521,7 +521,7 @@ namespace MWWorld
|
||||||
if (distance <= maxDistance)
|
if (distance <= maxDistance)
|
||||||
return *currentGridCenter;
|
return *currentGridCenter;
|
||||||
}
|
}
|
||||||
ESM::ExteriorCellLocation cellPos = ESM::positionToCellIndex(pos.x(), pos.y(), worldspace);
|
ESM::ExteriorCellLocation cellPos = ESM::positionToExteriorCellLocation(pos.x(), pos.y(), worldspace);
|
||||||
return { cellPos.mX, cellPos.mY };
|
return { cellPos.mX, cellPos.mY };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1283,7 +1283,8 @@ namespace MWWorld
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::Vec3f pos = dest.mPos.asVec3();
|
osg::Vec3f pos = dest.mPos.asVec3();
|
||||||
const ESM::ExteriorCellLocation cellIndex = ESM::positionToCellIndex(pos.x(), pos.y(), extWorldspace);
|
const ESM::ExteriorCellLocation cellIndex
|
||||||
|
= ESM::positionToExteriorCellLocation(pos.x(), pos.y(), extWorldspace);
|
||||||
preloadCell(mWorld.getWorldModel().getExterior(cellIndex), true);
|
preloadCell(mWorld.getWorldModel().getExterior(cellIndex), true);
|
||||||
exteriorPositions.emplace_back(pos, gridCenterToBounds(getNewGridCenter(pos)));
|
exteriorPositions.emplace_back(pos, gridCenterToBounds(getNewGridCenter(pos)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1166,8 +1166,8 @@ namespace MWWorld
|
||||||
const ESM4::Cell* cell = cells.find(ref.mParent);
|
const ESM4::Cell* cell = cells.find(ref.mParent);
|
||||||
if (cell->isExterior() && (cell->mFlags & ESM4::Rec_Persistent))
|
if (cell->isExterior() && (cell->mFlags & ESM4::Rec_Persistent))
|
||||||
{
|
{
|
||||||
const ESM4::Cell* actualCell
|
const ESM4::Cell* actualCell = cells.searchExterior(
|
||||||
= cells.searchExterior(positionToCellIndex(ref.mPos.pos[0], ref.mPos.pos[1], cell->mParent));
|
positionToExteriorCellLocation(ref.mPos.pos[0], ref.mPos.pos[1], cell->mParent));
|
||||||
if (actualCell)
|
if (actualCell)
|
||||||
ref.mParent = actualCell->mId;
|
ref.mParent = actualCell->mId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,7 +380,7 @@ namespace MWWorld
|
||||||
pos.rot[1] = 0;
|
pos.rot[1] = 0;
|
||||||
pos.rot[2] = 0;
|
pos.rot[2] = 0;
|
||||||
|
|
||||||
ESM::ExteriorCellLocation exteriorCellPos = ESM::positionToCellIndex(pos.pos[0], pos.pos[1]);
|
ESM::ExteriorCellLocation exteriorCellPos = ESM::positionToExteriorCellLocation(pos.pos[0], pos.pos[1]);
|
||||||
ESM::RefId cellId = ESM::RefId::esm3ExteriorCell(exteriorCellPos.mX, exteriorCellPos.mY);
|
ESM::RefId cellId = ESM::RefId::esm3ExteriorCell(exteriorCellPos.mX, exteriorCellPos.mY);
|
||||||
mWorldScene->changeToExteriorCell(cellId, pos, true);
|
mWorldScene->changeToExteriorCell(cellId, pos, true);
|
||||||
}
|
}
|
||||||
|
@ -1248,7 +1248,8 @@ namespace MWWorld
|
||||||
CellStore* cell = ptr.getCell();
|
CellStore* cell = ptr.getCell();
|
||||||
ESM::RefId worldspaceId
|
ESM::RefId worldspaceId
|
||||||
= cell->isExterior() ? cell->getCell()->getWorldSpace() : ESM::Cell::sDefaultWorldspaceId;
|
= cell->isExterior() ? cell->getCell()->getWorldSpace() : ESM::Cell::sDefaultWorldspaceId;
|
||||||
const ESM::ExteriorCellLocation index = ESM::positionToCellIndex(position.x(), position.y(), worldspaceId);
|
const ESM::ExteriorCellLocation index
|
||||||
|
= ESM::positionToExteriorCellLocation(position.x(), position.y(), worldspaceId);
|
||||||
|
|
||||||
CellStore* newCell = cell->isExterior() ? &mWorldModel.getExterior(index) : nullptr;
|
CellStore* newCell = cell->isExterior() ? &mWorldModel.getExterior(index) : nullptr;
|
||||||
bool isCellActive = getPlayerPtr().isInCell() && getPlayerPtr().getCell()->isExterior()
|
bool isCellActive = getPlayerPtr().isInCell() && getPlayerPtr().getCell()->isExterior()
|
||||||
|
@ -2047,7 +2048,7 @@ namespace MWWorld
|
||||||
if (cell->isExterior())
|
if (cell->isExterior())
|
||||||
{
|
{
|
||||||
const ESM::ExteriorCellLocation index
|
const ESM::ExteriorCellLocation index
|
||||||
= ESM::positionToCellIndex(pos.pos[0], pos.pos[1], cell->getCell()->getWorldSpace());
|
= ESM::positionToExteriorCellLocation(pos.pos[0], pos.pos[1], cell->getCell()->getWorldSpace());
|
||||||
cell = &mWorldModel.getExterior(index);
|
cell = &mWorldModel.getExterior(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,8 @@ MWWorld::CellStore& MWWorld::WorldModel::getCellByPosition(
|
||||||
return *cellInSameWorldSpace;
|
return *cellInSameWorldSpace;
|
||||||
ESM::RefId exteriorWorldspace
|
ESM::RefId exteriorWorldspace
|
||||||
= cellInSameWorldSpace ? cellInSameWorldSpace->getCell()->getWorldSpace() : ESM::Cell::sDefaultWorldspaceId;
|
= cellInSameWorldSpace ? cellInSameWorldSpace->getCell()->getWorldSpace() : ESM::Cell::sDefaultWorldspaceId;
|
||||||
const ESM::ExteriorCellLocation cellIndex = ESM::positionToCellIndex(pos.x(), pos.y(), exteriorWorldspace);
|
const ESM::ExteriorCellLocation cellIndex
|
||||||
|
= ESM::positionToExteriorCellLocation(pos.x(), pos.y(), exteriorWorldspace);
|
||||||
|
|
||||||
return getExterior(cellIndex);
|
return getExterior(cellIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace ESM
|
||||||
return isEsm4Ext(worldspaceId) ? Constants::ESM4CellSizeInUnits : Constants::CellSizeInUnits;
|
return isEsm4Ext(worldspaceId) ? Constants::ESM4CellSizeInUnits : Constants::CellSizeInUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ESM::ExteriorCellLocation positionToCellIndex(
|
inline ESM::ExteriorCellLocation positionToExteriorCellLocation(
|
||||||
float x, float y, ESM::RefId worldspaceId = ESM::Cell::sDefaultWorldspaceId)
|
float x, float y, ESM::RefId worldspaceId = ESM::Cell::sDefaultWorldspaceId)
|
||||||
{
|
{
|
||||||
const float cellSize = getCellSize(worldspaceId);
|
const float cellSize = getCellSize(worldspaceId);
|
||||||
|
|
Loading…
Reference in a new issue