mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 07:45:36 +00:00
Applied review comments
getEditorName => getNameId restored cosntructor in CoordinateConverter
This commit is contained in:
parent
e6e27413d9
commit
216ca71149
15 changed files with 31 additions and 23 deletions
|
@ -705,7 +705,7 @@ namespace MWGui
|
|||
ESM::Position markedPosition;
|
||||
MWBase::Environment::get().getWorld()->getPlayer().getMarkedPosition(markedCell, markedPosition);
|
||||
if (markedCell && markedCell->isExterior() == !mInterior
|
||||
&& (!mInterior || Misc::StringUtils::ciEqual(markedCell->getCell()->getEditorName(), mPrefix)))
|
||||
&& (!mInterior || Misc::StringUtils::ciEqual(markedCell->getCell()->getNameId(), mPrefix)))
|
||||
{
|
||||
MarkerUserData markerPos(mLocalMapRender);
|
||||
MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||
|
|
|
@ -958,7 +958,7 @@ namespace MWGui
|
|||
|
||||
if (cellCommon->isExterior())
|
||||
{
|
||||
if (!cellCommon->getEditorName().empty())
|
||||
if (!cellCommon->getNameId().empty())
|
||||
mMap->addVisitedLocation(name, cellCommon->getGridX(), cellCommon->getGridY());
|
||||
|
||||
mMap->cellExplored(cellCommon->getGridX(), cellCommon->getGridY());
|
||||
|
@ -967,8 +967,8 @@ namespace MWGui
|
|||
}
|
||||
else
|
||||
{
|
||||
mMap->setCellPrefix(std::string(cellCommon->getEditorName()));
|
||||
mHud->setCellPrefix(std::string(cellCommon->getEditorName()));
|
||||
mMap->setCellPrefix(std::string(cellCommon->getNameId()));
|
||||
mHud->setCellPrefix(std::string(cellCommon->getNameId()));
|
||||
|
||||
osg::Vec3f worldPos;
|
||||
if (!MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(cell, worldPos))
|
||||
|
|
|
@ -35,11 +35,11 @@ namespace MWLua
|
|||
if (cell->isExterior())
|
||||
res << "exterior(" << cell->getGridX() << ", " << cell->getGridY() << ")";
|
||||
else
|
||||
res << "interior(" << cell->getEditorName() << ")";
|
||||
res << "interior(" << cell->getNameId() << ")";
|
||||
return res.str();
|
||||
};
|
||||
|
||||
cellT["name"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getEditorName(); });
|
||||
cellT["name"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getNameId(); });
|
||||
cellT["region"]
|
||||
= sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getRegion().getRefIdString(); });
|
||||
cellT["gridX"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getGridX(); });
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace MWLua
|
|||
ai.stack(MWMechanics::AiEscort(refId, gameHoursDuration, dest.x(), dest.y(), dest.z(), false), ptr);
|
||||
else
|
||||
ai.stack(MWMechanics::AiEscort(
|
||||
refId, esmCell->getEditorName(), gameHoursDuration, dest.x(), dest.y(), dest.z(), false),
|
||||
refId, esmCell->getNameId(), gameHoursDuration, dest.x(), dest.y(), dest.z(), false),
|
||||
ptr);
|
||||
};
|
||||
selfAPI["_startAiWander"] = [](SelfObject& self, int distance, float duration) {
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
else if (Misc::StringUtils::ciEqual(
|
||||
mCellId, actor.getCell()->getCell()->getEditorName())) // Cell to travel to
|
||||
mCellId, actor.getCell()->getCell()->getNameId())) // Cell to travel to
|
||||
{
|
||||
mRemainingDuration = mDuration;
|
||||
return true;
|
||||
|
|
|
@ -418,7 +418,7 @@ bool MWMechanics::AiPackage::isNearInactiveCell(osg::Vec3f position)
|
|||
if (playerCell->isExterior())
|
||||
{
|
||||
// get actor's distance from origin of center cell
|
||||
Misc::CoordinateConverter(ESM::CellVariant(*playerCell)).toLocal(position);
|
||||
Misc::CoordinateConverter(playerCell).toLocal(position);
|
||||
|
||||
// currently assumes 3 x 3 grid for exterior cells, with player at center cell.
|
||||
// AI shuts down actors before they reach edges of 3 x 3 grid.
|
||||
|
|
|
@ -839,7 +839,7 @@ namespace MWMechanics
|
|||
if (mDistance && storage.mCanWanderAlongPathGrid && !actor.getClass().isPureWaterCreature(actor))
|
||||
{
|
||||
// get NPC's position in local (i.e. cell) coordinates
|
||||
auto converter = Misc::CoordinateConverter(ESM::CellVariant(*cell));
|
||||
auto converter = Misc::CoordinateConverter(cell);
|
||||
const osg::Vec3f npcPos = converter.toLocalVec3(mInitialActorPosition);
|
||||
|
||||
// Find closest pathgrid point
|
||||
|
|
|
@ -489,7 +489,7 @@ namespace MWMechanics
|
|||
{
|
||||
std::string_view dest;
|
||||
if (!markedCell->isExterior())
|
||||
dest = markedCell->getCell()->getEditorName();
|
||||
dest = markedCell->getCell()->getNameId();
|
||||
MWWorld::ActionTeleport action(dest, markedPosition, false);
|
||||
action.execute(target);
|
||||
if (!caster.isEmpty())
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef OPENW_MWORLD_CELL
|
||||
#define OPENW_MWORLD_CELL
|
||||
|
||||
#include <osg/Vec2i>
|
||||
|
||||
#include <components/esm/esmbridge.hpp>
|
||||
#include <components/esm/refid.hpp>
|
||||
#include <components/esm3/cellid.hpp>
|
||||
|
@ -43,7 +45,8 @@ namespace MWWorld
|
|||
bool noSleep() const { return mFlags.noSleep; }
|
||||
const ESM::CellId& getCellId() const { return mCellId; }
|
||||
const ESM::RefId& getRegion() const { return mRegion; }
|
||||
std::string_view getEditorName() const { return mNameID; }
|
||||
std::string_view getNameId() const { return mNameID; }
|
||||
std::string_view getDisplayName() const { return mDisplayname; }
|
||||
std::string getDescription() const;
|
||||
const MoodData& getMood() const { return mMood; }
|
||||
|
||||
|
|
|
@ -747,7 +747,7 @@ namespace MWWorld
|
|||
{
|
||||
assert(!(*iter)->getCell()->isExterior());
|
||||
|
||||
if (it->mName == (*iter)->getCell()->getEditorName())
|
||||
if (it->mName == (*iter)->getCell()->getNameId())
|
||||
{
|
||||
unloadCell(*iter, navigatorUpdateGuard.get());
|
||||
break;
|
||||
|
|
|
@ -639,8 +639,8 @@ namespace MWWorld
|
|||
|
||||
std::string_view World::getCellName(const MWWorld::Cell& cell) const
|
||||
{
|
||||
if (!cell.isExterior() || !cell.getEditorName().empty())
|
||||
return cell.getEditorName();
|
||||
if (!cell.isExterior() || !cell.getNameId().empty())
|
||||
return cell.getNameId();
|
||||
|
||||
if (!cell.isEsm4())
|
||||
{
|
||||
|
@ -1139,7 +1139,7 @@ namespace MWWorld
|
|||
{
|
||||
if (!newCell->isExterior())
|
||||
{
|
||||
changeToInteriorCell(newCell->getCell()->getEditorName(), pos, false);
|
||||
changeToInteriorCell(newCell->getCell()->getNameId(), pos, false);
|
||||
removeContainerScripts(getPlayerPtr());
|
||||
}
|
||||
else
|
||||
|
@ -1400,7 +1400,7 @@ namespace MWWorld
|
|||
esmPos.pos[2] = traced.z();
|
||||
std::string_view cell;
|
||||
if (!actor.getCell()->isExterior())
|
||||
cell = actor.getCell()->getCell()->getEditorName();
|
||||
cell = actor.getCell()->getCell()->getNameId();
|
||||
MWWorld::ActionTeleport(cell, esmPos, false).execute(actor);
|
||||
}
|
||||
}
|
||||
|
@ -3270,7 +3270,7 @@ namespace MWWorld
|
|||
std::set<std::string_view> checkedCells;
|
||||
std::set<std::string_view> currentCells;
|
||||
std::set<std::string_view> nextCells;
|
||||
nextCells.insert(cell->getCell()->getEditorName());
|
||||
nextCells.insert(cell->getCell()->getNameId());
|
||||
|
||||
while (!nextCells.empty())
|
||||
{
|
||||
|
@ -3325,7 +3325,7 @@ namespace MWWorld
|
|||
std::set<std::string_view> nextCells;
|
||||
MWWorld::ConstPtr closestMarker;
|
||||
|
||||
nextCells.insert(ptr.getCell()->getCell()->getEditorName());
|
||||
nextCells.insert(ptr.getCell()->getCell()->getNameId());
|
||||
while (!nextCells.empty())
|
||||
{
|
||||
currentCells = nextCells;
|
||||
|
@ -3420,7 +3420,7 @@ namespace MWWorld
|
|||
|
||||
std::string_view cellName = "";
|
||||
if (!closestMarker.mCell->isExterior())
|
||||
cellName = closestMarker.mCell->getCell()->getEditorName();
|
||||
cellName = closestMarker.mCell->getCell()->getNameId();
|
||||
|
||||
MWWorld::ActionTeleport action(cellName, closestMarker.getRefData().getPosition(), false);
|
||||
action.execute(ptr);
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace DetourNavigator
|
|||
|
||||
void NavigatorImpl::addPathgrid(const ESM::Cell& cell, const ESM::Pathgrid& pathgrid)
|
||||
{
|
||||
Misc::CoordinateConverter converter = Misc::CoordinateConverter(ESM::CellVariant(cell));
|
||||
Misc::CoordinateConverter converter(&cell);
|
||||
for (const auto& edge : pathgrid.mEdges)
|
||||
{
|
||||
const auto src = Misc::Convert::makeOsgVec3f(converter.toWorldPoint(pathgrid.mPoints[edge.mV0]));
|
||||
|
|
|
@ -43,10 +43,8 @@ namespace ESM
|
|||
|
||||
struct ReferenceVariant
|
||||
{
|
||||
protected:
|
||||
std::variant<ESM::CellRef, ESM4::Reference> mVariant;
|
||||
|
||||
public:
|
||||
explicit ReferenceVariant(const ESM4::Reference& ref)
|
||||
: mVariant(ref)
|
||||
{
|
||||
|
|
|
@ -156,6 +156,8 @@ namespace ESM
|
|||
|
||||
int getGridY() const { return mData.mY; }
|
||||
|
||||
bool hasWater() const { return ((mData.mFlags & HasWater) != 0) || isExterior(); }
|
||||
|
||||
bool hasAmbient() const { return mHasAmbi; }
|
||||
|
||||
void setHasAmbient(bool hasAmbi) { mHasAmbi = hasAmbi; }
|
||||
|
|
|
@ -26,6 +26,11 @@ namespace Misc
|
|||
{
|
||||
}
|
||||
|
||||
explicit CoordinateConverter(const ESM::Cell* cell)
|
||||
: CoordinateConverter(cell->isExterior(), cell->getGridX(), cell->getGridY())
|
||||
{
|
||||
}
|
||||
|
||||
/// in-place conversion from local to world
|
||||
void toWorld(ESM::Pathgrid::Point& point) const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue