1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 09:45:36 +00:00

Rename positionToCellIndex to match return type

This commit is contained in:
elsid 2023-05-27 01:18:17 +02:00
parent 98e80d65b0
commit 235eb65c97
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
9 changed files with 20 additions and 17 deletions

View file

@ -275,7 +275,7 @@ namespace MWGui
if (!mInterior)
{
ESM::ExteriorCellLocation cellPos = ESM::positionToCellIndex(worldX, worldY);
ESM::ExteriorCellLocation cellPos = ESM::positionToExteriorCellLocation(worldX, worldY);
cellIndex.x() = cellPos.mX;
cellIndex.y() = cellPos.mY;

View file

@ -126,7 +126,7 @@ namespace MWGui
std::string_view cellname = transport[i].mCellName;
bool interior = true;
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())
{
MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getExterior(cellIndex);
@ -192,7 +192,7 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
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);
// Teleports any followers, too.

View file

@ -402,7 +402,7 @@ namespace MWScript
if (store->isExterior())
{
const ESM::ExteriorCellLocation cellIndex
= ESM::positionToCellIndex(x, y, store->getCell()->getWorldSpace());
= ESM::positionToExteriorCellLocation(x, y, store->getCell()->getWorldSpace());
store = &worldModel->getExterior(cellIndex);
}
}
@ -418,7 +418,7 @@ namespace MWScript
if (!isPlayer)
return;
const ESM::ExteriorCellLocation cellIndex
= ESM::positionToCellIndex(x, y, store->getCell()->getWorldSpace());
= ESM::positionToExteriorCellLocation(x, y, store->getCell()->getWorldSpace());
store = &worldModel->getExterior(cellIndex);
}
if (store)
@ -469,7 +469,7 @@ namespace MWScript
if (isPlayer)
world->getPlayer().setTeleported(true);
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,
// non-player actors will move within the cell they are in.
@ -570,7 +570,7 @@ namespace MWScript
if (player.getCell()->isExterior())
{
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);
}
else

View file

@ -88,7 +88,7 @@ namespace MWWorld
}
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);
}
};

View file

@ -521,7 +521,7 @@ namespace MWWorld
if (distance <= maxDistance)
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 };
}
@ -1283,7 +1283,8 @@ namespace MWWorld
else
{
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);
exteriorPositions.emplace_back(pos, gridCenterToBounds(getNewGridCenter(pos)));
}

View file

@ -1166,8 +1166,8 @@ namespace MWWorld
const ESM4::Cell* cell = cells.find(ref.mParent);
if (cell->isExterior() && (cell->mFlags & ESM4::Rec_Persistent))
{
const ESM4::Cell* actualCell
= cells.searchExterior(positionToCellIndex(ref.mPos.pos[0], ref.mPos.pos[1], cell->mParent));
const ESM4::Cell* actualCell = cells.searchExterior(
positionToExteriorCellLocation(ref.mPos.pos[0], ref.mPos.pos[1], cell->mParent));
if (actualCell)
ref.mParent = actualCell->mId;
}

View file

@ -380,7 +380,7 @@ namespace MWWorld
pos.rot[1] = 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);
mWorldScene->changeToExteriorCell(cellId, pos, true);
}
@ -1248,7 +1248,8 @@ namespace MWWorld
CellStore* cell = ptr.getCell();
ESM::RefId worldspaceId
= 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;
bool isCellActive = getPlayerPtr().isInCell() && getPlayerPtr().getCell()->isExterior()
@ -2047,7 +2048,7 @@ namespace MWWorld
if (cell->isExterior())
{
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);
}

View file

@ -326,7 +326,8 @@ MWWorld::CellStore& MWWorld::WorldModel::getCellByPosition(
return *cellInSameWorldSpace;
ESM::RefId exteriorWorldspace
= 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);
}

View file

@ -83,7 +83,7 @@ namespace ESM
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)
{
const float cellSize = getCellSize(worldspaceId);