mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 07:09:40 +00:00
Reverts Cell name to a string
This commit is contained in:
parent
1390c7ed7c
commit
3780033837
57 changed files with 195 additions and 185 deletions
|
@ -1342,7 +1342,7 @@ namespace EsmTool
|
|||
template <>
|
||||
std::string Record<ESM::Cell>::getId() const
|
||||
{
|
||||
return mData.mName.getRefIdString();
|
||||
return mData.mName;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
|
|
@ -202,7 +202,7 @@ namespace ESSImport
|
|||
}
|
||||
|
||||
// note if the player is in a nameless exterior cell, we will assign the cellId later based on player position
|
||||
if (cell.mName == ESM::RefId::stringRefId(mContext->mPlayerCellName))
|
||||
if (Misc::StringUtils::ciEqual(cell.mName, mContext->mPlayerCellName))
|
||||
{
|
||||
mContext->mPlayer.mCellId = cell.getCellId();
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ namespace ESSImport
|
|||
std::vector<unsigned int> mFogOfWar;
|
||||
};
|
||||
|
||||
std::map<ESM::RefId, Cell> mIntCells;
|
||||
std::map<std::string, Cell, Misc::StringUtils::CiComp> mIntCells;
|
||||
std::map<std::pair<int, int>, Cell> mExtCells;
|
||||
|
||||
std::vector<ESM::CustomMarker> mMarkers;
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace ESSImport
|
|||
// TODO: Figure out a better way to detect interiors. (0, 0) is a valid exterior cell.
|
||||
if (mark.mCellX == 0 && mark.mCellY == 0)
|
||||
{
|
||||
cell.mWorldspace = ESM::RefId::stringRefId(pcdt.mMNAM);
|
||||
cell.mWorldspace = pcdt.mMNAM;
|
||||
cell.mPaged = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,5 +49,5 @@ QString CellNameLoader::getCellName(ESM::ESMReader& esmReader)
|
|||
bool isDeleted = false;
|
||||
cell.loadNameAndData(esmReader, isDeleted);
|
||||
|
||||
return QString::fromStdString(cell.mName.getRefIdString());
|
||||
return QString::fromStdString(cell.mName);
|
||||
}
|
||||
|
|
|
@ -265,14 +265,16 @@ namespace NavMeshTool
|
|||
const osg::Vec2i cellPosition(cell.mData.mX, cell.mData.mY);
|
||||
const std::size_t cellObjectsBegin = data.mObjects.size();
|
||||
WorldspaceNavMeshInput& navMeshInput = [&]() -> WorldspaceNavMeshInput& {
|
||||
auto it = navMeshInputs.find(cell.mCellId.mWorldspace);
|
||||
auto it = navMeshInputs.find(ESM::RefId::stringRefId(cell.mCellId.mWorldspace));
|
||||
if (it == navMeshInputs.end())
|
||||
{
|
||||
it = navMeshInputs
|
||||
.emplace(cell.mCellId.mWorldspace,
|
||||
std::make_unique<WorldspaceNavMeshInput>(cell.mCellId.mWorldspace, settings.mRecast))
|
||||
.emplace(ESM::RefId::stringRefId(cell.mCellId.mWorldspace),
|
||||
std::make_unique<WorldspaceNavMeshInput>(
|
||||
ESM::RefId::stringRefId(cell.mCellId.mWorldspace), settings.mRecast))
|
||||
.first;
|
||||
it->second->mTileCachedRecastMeshManager.setWorldspace(cell.mCellId.mWorldspace, nullptr);
|
||||
it->second->mTileCachedRecastMeshManager.setWorldspace(
|
||||
ESM::RefId::stringRefId(cell.mCellId.mWorldspace), nullptr);
|
||||
}
|
||||
return *it->second;
|
||||
}();
|
||||
|
|
|
@ -88,8 +88,8 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages& message
|
|||
}
|
||||
|
||||
if (!cellRef.mDestCell.empty() && mCells.searchId(cellRef.mDestCell) == -1)
|
||||
messages.add(id, "Destination cell '" + cellRef.mDestCell.getRefIdString() + "' does not exist", "",
|
||||
CSMDoc::Message::Severity_Error);
|
||||
messages.add(
|
||||
id, "Destination cell '" + cellRef.mDestCell + "' does not exist", "", CSMDoc::Message::Severity_Error);
|
||||
|
||||
if (cellRef.mScale < 0)
|
||||
messages.add(id, "Negative scale", "", CSMDoc::Message::Severity_Error);
|
||||
|
|
|
@ -75,7 +75,7 @@ int CSMTools::TopicInfoCheckStage::setup()
|
|||
if (regionRecord.isDeleted())
|
||||
continue;
|
||||
|
||||
mCellNames.insert(ESM::RefId::stringRefId(regionRecord.get().mName));
|
||||
mCellNames.insert(regionRecord.get().mName);
|
||||
}
|
||||
// Default cell name
|
||||
int index = mGameSettings.searchId("sDefaultCellname");
|
||||
|
@ -85,7 +85,7 @@ int CSMTools::TopicInfoCheckStage::setup()
|
|||
|
||||
if (!gmstRecord.isDeleted() && gmstRecord.get().mValue.getType() == ESM::VT_String)
|
||||
{
|
||||
mCellNames.insert(ESM::RefId::stringRefId(gmstRecord.get().mValue.getString()));
|
||||
mCellNames.insert(gmstRecord.get().mValue.getString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ void CSMTools::TopicInfoCheckStage::perform(int stage, CSMDoc::Messages& message
|
|||
|
||||
if (!topicInfo.mCell.empty())
|
||||
{
|
||||
verifyCell(topicInfo.mCell, id, messages);
|
||||
verifyCell(topicInfo.mCell.getRefIdString(), id, messages);
|
||||
}
|
||||
|
||||
if (!topicInfo.mFaction.empty() && !topicInfo.mFactionLess)
|
||||
|
@ -211,11 +211,11 @@ bool CSMTools::TopicInfoCheckStage::verifyActor(
|
|||
}
|
||||
|
||||
bool CSMTools::TopicInfoCheckStage::verifyCell(
|
||||
const ESM::RefId& cell, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages)
|
||||
const std::string& cell, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages)
|
||||
{
|
||||
if (mCellNames.find(cell) == mCellNames.end())
|
||||
{
|
||||
messages.add(id, "Cell '" + cell.getRefIdString() + "' does not exist", "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, "Cell '" + cell + "' does not exist", "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ bool CSMTools::TopicInfoCheckStage::verifySelectStruct(
|
|||
return false;
|
||||
}
|
||||
else if (infoCondition.getFunctionName() == CSMWorld::ConstInfoSelectWrapper::Function_NotCell
|
||||
&& !verifyCell(ESM::RefId::stringRefId(infoCondition.getVariableName()), id, messages))
|
||||
&& !verifyCell(infoCondition.getVariableName(), id, messages))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <apps/opencs/model/world/universalid.hpp>
|
||||
|
||||
#include <components/esm3/loadinfo.hpp>
|
||||
#include <components/misc/algorithm.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
|
@ -72,13 +73,13 @@ namespace CSMTools
|
|||
const CSMWorld::RefIdData& mReferencables;
|
||||
const CSMWorld::Resources& mSoundFiles;
|
||||
|
||||
std::set<ESM::RefId> mCellNames;
|
||||
std::set<std::string, Misc::StringUtils::CiComp> mCellNames;
|
||||
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
// These return false when not successful and write an error
|
||||
bool verifyActor(const ESM::RefId& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
|
||||
bool verifyCell(const ESM::RefId& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
|
||||
bool verifyCell(const std::string& cell, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
|
||||
bool verifyFactionRank(
|
||||
const ESM::RefId& name, int rank, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
|
||||
bool verifyItem(const ESM::RefId& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
|
||||
|
|
|
@ -6,7 +6,7 @@ void CSMWorld::Cell::load(ESM::ESMReader& esm, bool& isDeleted)
|
|||
{
|
||||
ESM::Cell::load(esm, isDeleted, false);
|
||||
|
||||
mId = mName;
|
||||
mId = ESM::RefId::stringRefId(mName);
|
||||
if (isExterior())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
|
|
@ -344,14 +344,14 @@ namespace CSMWorld
|
|||
|
||||
QVariant get(const Record<CSMWorld::Cell>& record) const override
|
||||
{
|
||||
return QString::fromUtf8(record.get().mName.getRefIdString().c_str());
|
||||
return QString::fromUtf8(record.get().mName.c_str());
|
||||
}
|
||||
|
||||
void set(Record<CSMWorld::Cell>& record, const QVariant& data) override
|
||||
{
|
||||
CSMWorld::Cell record2 = record.get();
|
||||
|
||||
record2.mName = ESM::RefId::stringRefId(data.toString().toUtf8().constData());
|
||||
record2.mName = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
@ -1147,14 +1147,14 @@ namespace CSMWorld
|
|||
|
||||
QVariant get(const Record<ESXRecordT>& record) const override
|
||||
{
|
||||
return QString::fromUtf8(record.get().mDestCell.getRefIdString().c_str());
|
||||
return QString::fromUtf8(record.get().mDestCell.c_str());
|
||||
}
|
||||
|
||||
void set(Record<ESXRecordT>& record, const QVariant& data) override
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mDestCell = ESM::RefId::stringRefId(data.toString().toUtf8().constData());
|
||||
record2.mDestCell = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ std::pair<CSMWorld::UniversalId, std::string> CSMWorld::IdTable::view(int row) c
|
|||
return std::make_pair(UniversalId::Type_None, "");
|
||||
|
||||
if (id[0] == '#')
|
||||
id = ESM::CellId::sDefaultWorldspace.getRefIdString();
|
||||
id = ESM::CellId::sDefaultWorldspace;
|
||||
|
||||
return std::make_pair(UniversalId(UniversalId::Type_Scene, id), hint);
|
||||
}
|
||||
|
|
|
@ -1468,7 +1468,7 @@ namespace CSMWorld
|
|||
|
||||
ESM::Transport::Dest newRow;
|
||||
newRow.mPos = newPos;
|
||||
newRow.mCellName = ESM::RefId::sEmpty;
|
||||
newRow.mCellName.clear();
|
||||
|
||||
if (position >= (int)list.size())
|
||||
list.push_back(newRow);
|
||||
|
@ -1533,7 +1533,7 @@ namespace CSMWorld
|
|||
switch (subColIndex)
|
||||
{
|
||||
case 0:
|
||||
return QString::fromUtf8(content.mCellName.getRefIdString().c_str());
|
||||
return QString::fromUtf8(content.mCellName.c_str());
|
||||
case 1:
|
||||
return content.mPos.pos[0];
|
||||
case 2:
|
||||
|
@ -1565,7 +1565,7 @@ namespace CSMWorld
|
|||
switch (subColIndex)
|
||||
{
|
||||
case 0:
|
||||
list.at(subRowIndex).mCellName = ESM::RefId::stringRefId(value.toString().toUtf8().constData());
|
||||
list.at(subRowIndex).mCellName = value.toString().toUtf8().constData();
|
||||
break;
|
||||
case 1:
|
||||
list.at(subRowIndex).mPos.pos[0] = value.toFloat();
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace CSMWorld
|
|||
{
|
||||
bool mDeleted;
|
||||
ESM::RefId mRegion;
|
||||
ESM::RefId mName;
|
||||
std::string mName;
|
||||
|
||||
CellDescription();
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ CSVWorld::SceneSubView::SceneSubView(const CSMWorld::UniversalId& id, CSMDoc::Do
|
|||
CSVRender::WorldspaceWidget* worldspaceWidget = nullptr;
|
||||
widgetType whatWidget;
|
||||
|
||||
if (ESM::RefId::stringRefId(id.getId()) == ESM::CellId::sDefaultWorldspace)
|
||||
if (Misc::StringUtils::ciEqual(id.getId(), ESM::CellId::sDefaultWorldspace))
|
||||
{
|
||||
whatWidget = widget_Paged;
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ void OMW::Engine::setResourceDir(const std::filesystem::path& parResDir)
|
|||
// Set start cell name
|
||||
void OMW::Engine::setCell(const std::string& cellName)
|
||||
{
|
||||
mCellName = ESM::RefId::stringRefId(cellName);
|
||||
mCellName = cellName;
|
||||
}
|
||||
|
||||
void OMW::Engine::addContentFile(const std::string& file)
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace OMW
|
|||
osg::ref_ptr<SceneUtil::AsyncScreenCaptureOperation> mScreenCaptureOperation;
|
||||
osg::ref_ptr<SceneUtil::SelectDepthFormatOperation> mSelectDepthFormatOperation;
|
||||
osg::ref_ptr<SceneUtil::Color::SelectColorFormatOperation> mSelectColorFormatOperation;
|
||||
ESM::RefId mCellName;
|
||||
std::string mCellName;
|
||||
std::vector<std::string> mContentFiles;
|
||||
std::vector<std::string> mGroundcoverFiles;
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ namespace MWBase
|
|||
virtual void setSimulationTimeScale(float scale) = 0;
|
||||
|
||||
virtual void changeToInteriorCell(
|
||||
const ESM::RefId& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true)
|
||||
std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true)
|
||||
= 0;
|
||||
///< Move to interior cell.
|
||||
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
|
||||
|
@ -513,11 +513,11 @@ namespace MWBase
|
|||
|
||||
/// Find default position inside exterior cell specified by name
|
||||
/// \return false if exterior with given name not exists, true otherwise
|
||||
virtual bool findExteriorPosition(const ESM::RefId& name, ESM::Position& pos) = 0;
|
||||
virtual bool findExteriorPosition(std::string_view name, ESM::Position& pos) = 0;
|
||||
|
||||
/// Find default position inside interior cell specified by name
|
||||
/// \return false if interior with given name not exists, true otherwise
|
||||
virtual bool findInteriorPosition(const ESM::RefId& name, ESM::Position& pos) = 0;
|
||||
virtual bool findInteriorPosition(std::string_view name, ESM::Position& pos) = 0;
|
||||
|
||||
/// Enables or disables use of teleport spell effects (recall, intervention, etc).
|
||||
virtual void enableTeleporting(bool enable) = 0;
|
||||
|
|
|
@ -299,7 +299,7 @@ namespace MWClass
|
|||
|
||||
std::string Door::getDestination(const MWWorld::LiveCellRef<ESM::Door>& door)
|
||||
{
|
||||
std::string_view dest = door.mRef.getDestCell().getRefIdString();
|
||||
std::string_view dest = door.mRef.getDestCell();
|
||||
if (dest.empty())
|
||||
{
|
||||
// door leads to exterior, use cell name (if any), otherwise translated region name
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace MWGui
|
|||
it != store.get<ESM::Cell>().extEnd(); ++it)
|
||||
{
|
||||
if (!it->mName.empty())
|
||||
mNames.push_back(it->mName.getRefIdString());
|
||||
mNames.push_back(it->mName);
|
||||
}
|
||||
|
||||
// sort
|
||||
|
|
|
@ -353,7 +353,7 @@ namespace MWGui
|
|||
{
|
||||
ESM::CellId cellId;
|
||||
cellId.mPaged = !mInterior;
|
||||
cellId.mWorldspace = (mInterior ? ESM::RefId::stringRefId(mPrefix) : ESM::CellId::sDefaultWorldspace);
|
||||
cellId.mWorldspace = (mInterior ? mPrefix : ESM::CellId::sDefaultWorldspace);
|
||||
cellId.mIndex.mX = mCurX + dX;
|
||||
cellId.mIndex.mY = mCurY + dY;
|
||||
|
||||
|
@ -637,7 +637,7 @@ namespace MWGui
|
|||
for (MyGUI::Widget* widget : mExteriorDoorMarkerWidgets)
|
||||
widget->setVisible(false);
|
||||
|
||||
MWWorld::CellStore* cell = worldModel->getInterior(ESM::RefId::stringRefId(mPrefix));
|
||||
MWWorld::CellStore* cell = worldModel->getInterior(mPrefix);
|
||||
world->getDoorMarkers(cell, doors);
|
||||
}
|
||||
else
|
||||
|
@ -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()->mName.getRefIdString(), mPrefix)))
|
||||
&& (!mInterior || Misc::StringUtils::ciEqual(markedCell->getCell()->mName, mPrefix)))
|
||||
{
|
||||
MarkerUserData markerPos(mLocalMapRender);
|
||||
MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||
|
@ -888,7 +888,7 @@ namespace MWGui
|
|||
|
||||
mEditingMarker.mCell.mPaged = !mInterior;
|
||||
if (mInterior)
|
||||
mEditingMarker.mCell.mWorldspace = ESM::RefId::stringRefId(LocalMapBase::mPrefix);
|
||||
mEditingMarker.mCell.mWorldspace = LocalMapBase::mPrefix;
|
||||
else
|
||||
{
|
||||
mEditingMarker.mCell.mWorldspace = ESM::CellId::sDefaultWorldspace;
|
||||
|
@ -1333,7 +1333,7 @@ namespace MWGui
|
|||
const ESM::Cell* cell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Cell>().search(
|
||||
cellId.first, cellId.second);
|
||||
if (cell && !cell->mName.empty())
|
||||
addVisitedLocation(cell->mName.getRefIdString(), cellId.first, cellId.second);
|
||||
addVisitedLocation(cell->mName, cellId.first, cellId.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace MWGui
|
|||
|
||||
for (unsigned int i = 0; i < transport.size(); i++)
|
||||
{
|
||||
std::string_view cellname = transport[i].mCellName.getRefIdString();
|
||||
std::string_view cellname = transport[i].mCellName;
|
||||
bool interior = true;
|
||||
const osg::Vec2i cellIndex
|
||||
= MWWorld::positionToCellIndex(transport[i].mPos.pos[0], transport[i].mPos.pos[1]);
|
||||
|
@ -174,7 +174,7 @@ namespace MWGui
|
|||
|
||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(1);
|
||||
ESM::Position pos = *_sender->getUserData<ESM::Position>();
|
||||
const ESM::RefId& cellname = ESM::RefId::stringRefId(_sender->getUserString("Destination"));
|
||||
const std::string& cellname = _sender->getUserString("Destination");
|
||||
bool interior = _sender->getUserString("interior") == "y";
|
||||
if (mPtr.getCell()->isExterior())
|
||||
{
|
||||
|
@ -198,7 +198,7 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(1);
|
||||
|
||||
// Teleports any followers, too.
|
||||
MWWorld::ActionTeleport action(interior ? cellname : ESM::RefId::sEmpty, pos, true);
|
||||
MWWorld::ActionTeleport action(interior ? cellname : "", pos, true);
|
||||
action.execute(player);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0);
|
||||
|
|
|
@ -966,8 +966,8 @@ namespace MWGui
|
|||
}
|
||||
else
|
||||
{
|
||||
mMap->setCellPrefix(cell->getCell()->mName.getRefIdString());
|
||||
mHud->setCellPrefix(cell->getCell()->mName.getRefIdString());
|
||||
mMap->setCellPrefix(cell->getCell()->mName);
|
||||
mHud->setCellPrefix(cell->getCell()->mName);
|
||||
|
||||
osg::Vec3f worldPos;
|
||||
if (!MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(cell, worldPos))
|
||||
|
|
|
@ -38,8 +38,7 @@ namespace MWLua
|
|||
return res.str();
|
||||
};
|
||||
|
||||
cellT["name"]
|
||||
= sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->mName.getRefIdString(); });
|
||||
cellT["name"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->mName; });
|
||||
cellT["region"]
|
||||
= sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->mRegion.getRefIdString(); });
|
||||
cellT["gridX"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getGridX(); });
|
||||
|
|
|
@ -78,9 +78,8 @@ namespace MWLua
|
|||
sol::table api(context.mLua->sol(), sol::create);
|
||||
WorldView* worldView = context.mWorldView;
|
||||
addTimeBindings(api, context, true);
|
||||
api["getCellByName"] = [](std::string_view name) {
|
||||
return GCell{ MWBase::Environment::get().getWorldModel()->getCell(ESM::RefId::stringRefId(name)) };
|
||||
};
|
||||
api["getCellByName"]
|
||||
= [](std::string_view name) { return GCell{ MWBase::Environment::get().getWorldModel()->getCell(name) }; };
|
||||
api["getExteriorCell"]
|
||||
= [](int x, int y) { return GCell{ MWBase::Environment::get().getWorldModel()->getExterior(x, y) }; };
|
||||
api["activeActors"] = GObjectList{ worldView->getActorsInScene() };
|
||||
|
|
|
@ -51,11 +51,11 @@ namespace MWLua
|
|||
class TeleportAction final : public LuaManager::Action
|
||||
{
|
||||
public:
|
||||
TeleportAction(LuaUtil::LuaState* state, ObjectId object, ESM::RefId cell, const osg::Vec3f& pos,
|
||||
TeleportAction(LuaUtil::LuaState* state, ObjectId object, std::string_view cell, const osg::Vec3f& pos,
|
||||
const osg::Vec3f& rot)
|
||||
: Action(state)
|
||||
, mObject(object)
|
||||
, mCell(std::move(cell))
|
||||
, mCell(std::string(cell))
|
||||
, mPos(pos)
|
||||
, mRot(rot)
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ namespace MWLua
|
|||
|
||||
private:
|
||||
ObjectId mObject;
|
||||
ESM::RefId mCell;
|
||||
std::string mCell;
|
||||
osg::Vec3f mPos;
|
||||
osg::Vec3f mRot;
|
||||
};
|
||||
|
@ -247,8 +247,7 @@ namespace MWLua
|
|||
const sol::optional<osg::Vec3f>& optRot) {
|
||||
MWWorld::Ptr ptr = object.ptr();
|
||||
osg::Vec3f rot = optRot ? *optRot : ptr.getRefData().getPosition().asRotationVec3();
|
||||
auto action = std::make_unique<TeleportAction>(
|
||||
context.mLua, object.id(), ESM::RefId::stringRefId(cell), pos, rot);
|
||||
auto action = std::make_unique<TeleportAction>(context.mLua, object.id(), cell, pos, rot);
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
context.mLuaManager->addTeleportPlayerAction(std::move(action));
|
||||
else
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
AiEscort::AiEscort(
|
||||
const ESM::RefId& actorId, const ESM::RefId& cellId, int duration, float x, float y, float z, bool repeat)
|
||||
const ESM::RefId& actorId, std::string_view cellId, int duration, float x, float y, float z, bool repeat)
|
||||
: TypedAiPackage<AiEscort>(repeat)
|
||||
, mCellId(cellId)
|
||||
, mX(x)
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace MWMechanics
|
|||
/** The Actor will escort the specified actor to the cell position x, y, z until they reach their position, or
|
||||
they run out of time \implement AiEscortCell **/
|
||||
AiEscort(
|
||||
const ESM::RefId& actorId, const ESM::RefId& cellId, int duration, float x, float y, float z, bool repeat);
|
||||
const ESM::RefId& actorId, std::string_view cellId, int duration, float x, float y, float z, bool repeat);
|
||||
|
||||
AiEscort(const ESM::AiSequence::AiEscort* escort);
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace MWMechanics
|
|||
osg::Vec3f getDestination() const override { return osg::Vec3f(mX, mY, mZ); }
|
||||
|
||||
private:
|
||||
const ESM::RefId mCellId;
|
||||
const std::string mCellId;
|
||||
const float mX;
|
||||
const float mY;
|
||||
const float mZ;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <components/esm3/aisequence.hpp>
|
||||
#include <components/esm3/loadcell.hpp>
|
||||
#include <components/misc/algorithm.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
@ -35,7 +36,7 @@ namespace MWMechanics
|
|||
, mX(x)
|
||||
, mY(y)
|
||||
, mZ(z)
|
||||
, mCellId(ESM::RefId::sEmpty)
|
||||
, mCellId("")
|
||||
, mActive(false)
|
||||
, mFollowIndex(mFollowIndexCounter++)
|
||||
{
|
||||
|
@ -43,7 +44,7 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
AiFollow::AiFollow(
|
||||
const ESM::RefId& actorId, const ESM::RefId& cellId, float duration, float x, float y, float z, bool repeat)
|
||||
const ESM::RefId& actorId, std::string_view cellId, float duration, float x, float y, float z, bool repeat)
|
||||
: TypedAiPackage<AiFollow>(repeat)
|
||||
, mAlwaysFollow(false)
|
||||
, mDuration(duration)
|
||||
|
@ -66,7 +67,7 @@ namespace MWMechanics
|
|||
, mX(0)
|
||||
, mY(0)
|
||||
, mZ(0)
|
||||
, mCellId(ESM::RefId::sEmpty)
|
||||
, mCellId("")
|
||||
, mActive(false)
|
||||
, mFollowIndex(mFollowIndexCounter++)
|
||||
{
|
||||
|
@ -169,13 +170,13 @@ namespace MWMechanics
|
|||
{
|
||||
if (actor.getCell()->isExterior()) // Outside?
|
||||
{
|
||||
if (mCellId == ESM::RefId::sEmpty) // No cell to travel to
|
||||
if (mCellId == "") // No cell to travel to
|
||||
{
|
||||
mRemainingDuration = mDuration;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (mCellId == actor.getCell()->getCell()->mName) // Cell to travel to
|
||||
else if (Misc::StringUtils::ciEqual(mCellId, actor.getCell()->getCell()->mName)) // Cell to travel to
|
||||
{
|
||||
mRemainingDuration = mDuration;
|
||||
return true;
|
||||
|
|
|
@ -44,8 +44,8 @@ namespace MWMechanics
|
|||
/// Follow Actor for duration or until you arrive at a world position
|
||||
AiFollow(const ESM::RefId& actorId, float duration, float x, float y, float z, bool repeat);
|
||||
/// Follow Actor for duration or until you arrive at a position in a cell
|
||||
AiFollow(const ESM::RefId& actorId, const ESM::RefId& cellId, float duration, float x, float y, float z,
|
||||
bool repeat);
|
||||
AiFollow(
|
||||
const ESM::RefId& actorId, std::string_view cellId, float duration, float x, float y, float z, bool repeat);
|
||||
/// Follow Actor indefinitively
|
||||
AiFollow(const MWWorld::Ptr& actor, bool commanded = false);
|
||||
|
||||
|
@ -94,7 +94,7 @@ namespace MWMechanics
|
|||
const float mX;
|
||||
const float mY;
|
||||
const float mZ;
|
||||
const ESM::RefId mCellId;
|
||||
const std::string mCellId;
|
||||
bool mActive; // have we spotted the target?
|
||||
const int mFollowIndex;
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ namespace MWMechanics
|
|||
world->getPlayer().getMarkedPosition(markedCell, markedPosition);
|
||||
if (markedCell)
|
||||
{
|
||||
ESM::RefId dest;
|
||||
std::string_view dest;
|
||||
if (!markedCell->isExterior())
|
||||
dest = markedCell->getCell()->mName;
|
||||
MWWorld::ActionTeleport action(dest, markedPosition, false);
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace MWScript
|
|||
ESM::RefId actorID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||
runtime.pop();
|
||||
|
||||
ESM::RefId cellID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||
std::string_view cellID = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float duration = runtime[0].mFloat;
|
||||
|
@ -371,7 +371,7 @@ namespace MWScript
|
|||
ESM::RefId actorID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||
runtime.pop();
|
||||
|
||||
ESM::RefId cellID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||
std::string_view cellID = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float duration = runtime[0].mFloat;
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace MWScript
|
|||
public:
|
||||
void execute(Interpreter::Runtime& runtime) override
|
||||
{
|
||||
const ESM::RefId cell = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||
std::string_view cell = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
ESM::Position pos;
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace MWScript
|
|||
|
||||
for (auto it = cells.extBegin(); it != cells.extEnd(); ++it)
|
||||
{
|
||||
const auto& cellName = it->mName.getRefIdString();
|
||||
const auto& cellName = it->mName;
|
||||
if (Misc::StringUtils::ciStartsWith(cellName, cell))
|
||||
winMgr->addVisitedLocation(cellName, it->getGridX(), it->getGridY());
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ namespace MWScript
|
|||
|
||||
for (auto it = cells.extBegin(); it != cells.extEnd(); ++it)
|
||||
{
|
||||
const std::string& name = it->mName.getRefIdString();
|
||||
const std::string& name = it->mName;
|
||||
if (!name.empty())
|
||||
MWBase::Environment::get().getWindowManager()->addVisitedLocation(
|
||||
name, it->getGridX(), it->getGridY());
|
||||
|
|
|
@ -382,7 +382,7 @@ namespace MWScript
|
|||
runtime.pop();
|
||||
Interpreter::Type_Float zRot = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
const ESM::RefId cellID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||
std::string_view cellID = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
if (ptr.getContainerStore())
|
||||
|
@ -405,8 +405,7 @@ namespace MWScript
|
|||
{
|
||||
// cell not found, move to exterior instead if moving the player (vanilla PositionCell
|
||||
// compatibility)
|
||||
std::string error
|
||||
= "Warning: PositionCell: unknown interior cell (" + cellID.getRefIdString() + ")";
|
||||
std::string error = "Warning: PositionCell: unknown interior cell (" + std::string(cellID) + ")";
|
||||
if (isPlayer)
|
||||
error += ", moving to exterior instead";
|
||||
runtime.getContext().report(error);
|
||||
|
@ -500,7 +499,7 @@ namespace MWScript
|
|||
{
|
||||
const ESM::RefId itemID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||
runtime.pop();
|
||||
auto cellID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||
std::string_view cellName = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float x = runtime[0].mFloat;
|
||||
|
@ -515,12 +514,12 @@ namespace MWScript
|
|||
MWWorld::CellStore* store = nullptr;
|
||||
try
|
||||
{
|
||||
store = MWBase::Environment::get().getWorldModel()->getCell(cellID);
|
||||
store = MWBase::Environment::get().getWorldModel()->getCell(cellName);
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
runtime.getContext().report("unknown cell (" + cellID.getRefIdString() + ")");
|
||||
Log(Debug::Error) << "Error: unknown cell (" << cellID << ")";
|
||||
runtime.getContext().report("unknown cell (" + std::string(cellName) + ")");
|
||||
Log(Debug::Error) << "Error: unknown cell (" << cellName << ")";
|
||||
}
|
||||
if (store)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace MWWorld
|
||||
{
|
||||
ActionTeleport::ActionTeleport(const ESM::RefId& cellName, const ESM::Position& position, bool teleportFollowers)
|
||||
ActionTeleport::ActionTeleport(std::string_view cellName, const ESM::Position& position, bool teleportFollowers)
|
||||
: Action(true)
|
||||
, mCellName(cellName)
|
||||
, mPosition(position)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MWWorld
|
|||
{
|
||||
class ActionTeleport : public Action
|
||||
{
|
||||
ESM::RefId mCellName;
|
||||
std::string mCellName;
|
||||
ESM::Position mPosition;
|
||||
bool mTeleportFollowers;
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace MWWorld
|
|||
public:
|
||||
/// If cellName is empty, an exterior cell is assumed.
|
||||
/// @param teleportFollowers Whether to teleport any following actors of the target actor as well.
|
||||
ActionTeleport(const ESM::RefId& cellName, const ESM::Position& position, bool teleportFollowers);
|
||||
ActionTeleport(std::string_view cellName, const ESM::Position& position, bool teleportFollowers);
|
||||
|
||||
/// @param includeHostiles If true, include hostile followers (which won't actually be teleported) in the
|
||||
/// output,
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace MWWorld
|
|||
const ESM::Position& getDoorDest() const { return mCellRef.mDoorDest; }
|
||||
|
||||
// Destination cell for doors (optional)
|
||||
const ESM::RefId& getDestCell() const { return mCellRef.mDestCell; }
|
||||
const std::string& getDestCell() const { return mCellRef.mDestCell; }
|
||||
|
||||
// Scale applied to mesh
|
||||
float getScale() const { return mCellRef.mScale; }
|
||||
|
|
|
@ -541,7 +541,8 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
mNavigator.setWorldspace(
|
||||
mWorld.getWorldModel().getExterior(playerCellX, playerCellY)->getCell()->mCellId.mWorldspace,
|
||||
ESM::RefId::stringRefId(
|
||||
mWorld.getWorldModel().getExterior(playerCellX, playerCellY)->getCell()->mCellId.mWorldspace),
|
||||
navigatorUpdateGuard.get());
|
||||
mNavigator.updateBounds(pos, navigatorUpdateGuard.get());
|
||||
|
||||
|
@ -663,7 +664,8 @@ namespace MWWorld
|
|||
"Testing exterior cells (" + std::to_string(i) + "/" + std::to_string(cells.getExtSize()) + ")...");
|
||||
|
||||
CellStore* cell = mWorld.getWorldModel().getExterior(it->mData.mX, it->mData.mY);
|
||||
mNavigator.setWorldspace(cell->getCell()->mCellId.mWorldspace, navigatorUpdateGuard.get());
|
||||
mNavigator.setWorldspace(
|
||||
ESM::RefId::stringRefId(cell->getCell()->mCellId.mWorldspace), navigatorUpdateGuard.get());
|
||||
const osg::Vec3f position
|
||||
= osg::Vec3f(it->mData.mX + 0.5f, it->mData.mY + 0.5f, 0) * Constants::CellSizeInUnits;
|
||||
mNavigator.updateBounds(position, navigatorUpdateGuard.get());
|
||||
|
@ -720,7 +722,8 @@ namespace MWWorld
|
|||
"Testing interior cells (" + std::to_string(i) + "/" + std::to_string(cells.getIntSize()) + ")...");
|
||||
|
||||
CellStore* cell = mWorld.getWorldModel().getInterior(it->mName);
|
||||
mNavigator.setWorldspace(cell->getCell()->mCellId.mWorldspace, navigatorUpdateGuard.get());
|
||||
mNavigator.setWorldspace(
|
||||
ESM::RefId::stringRefId(cell->getCell()->mCellId.mWorldspace), navigatorUpdateGuard.get());
|
||||
ESM::Position position;
|
||||
mWorld.findInteriorPosition(it->mName, position);
|
||||
mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get());
|
||||
|
@ -839,7 +842,7 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
void Scene::changeToInteriorCell(
|
||||
const ESM::RefId& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||
std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||
{
|
||||
CellStore* cell = mWorld.getWorldModel().getInterior(cellName);
|
||||
bool useFading = (mCurrentCell != nullptr);
|
||||
|
@ -876,7 +879,8 @@ namespace MWWorld
|
|||
|
||||
loadingListener->setProgressRange(cell->count());
|
||||
|
||||
mNavigator.setWorldspace(cell->getCell()->mCellId.mWorldspace, navigatorUpdateGuard.get());
|
||||
mNavigator.setWorldspace(
|
||||
ESM::RefId::stringRefId(cell->getCell()->mCellId.mWorldspace), navigatorUpdateGuard.get());
|
||||
mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get());
|
||||
|
||||
// Load cell.
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace MWWorld
|
|||
void resetCellLoaded() { mCellLoaded = false; }
|
||||
|
||||
void changeToInteriorCell(
|
||||
const ESM::RefId& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true);
|
||||
std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true);
|
||||
///< Move to interior cell.
|
||||
/// @param changeEvent Set cellChanged flag?
|
||||
|
||||
|
|
|
@ -513,15 +513,16 @@ namespace MWWorld
|
|||
|
||||
esm.restoreContext(ctx);
|
||||
}
|
||||
const ESM::Cell* Store<ESM::Cell>::search(const ESM::RefId& id) const
|
||||
const ESM::Cell* Store<ESM::Cell>::search(std::string_view name) const
|
||||
{
|
||||
DynamicInt::const_iterator it = mInt.find(id);
|
||||
const std::string nameString = std::string(name);
|
||||
DynamicInt::const_iterator it = mInt.find(nameString);
|
||||
if (it != mInt.end())
|
||||
{
|
||||
return &(it->second);
|
||||
}
|
||||
|
||||
DynamicInt::const_iterator dit = mDynamicInt.find(id);
|
||||
DynamicInt::const_iterator dit = mDynamicInt.find(nameString);
|
||||
if (dit != mDynamicInt.end())
|
||||
{
|
||||
return &dit->second;
|
||||
|
@ -574,12 +575,12 @@ namespace MWWorld
|
|||
|
||||
return &mExt.insert(std::make_pair(key, newCell)).first->second;
|
||||
}
|
||||
const ESM::Cell* Store<ESM::Cell>::find(const ESM::RefId& id) const
|
||||
const ESM::Cell* Store<ESM::Cell>::find(std::string_view id) const
|
||||
{
|
||||
const ESM::Cell* ptr = search(id);
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
const std::string msg = "Cell '" + id.getRefIdString() + "' not found";
|
||||
const std::string msg = "Cell '" + std::string(id) + "' not found";
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
return ptr;
|
||||
|
@ -709,7 +710,7 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
return RecordId(cell.mName, isDeleted);
|
||||
return RecordId(ESM::RefId::stringRefId(cell.mName), isDeleted);
|
||||
}
|
||||
Store<ESM::Cell>::iterator Store<ESM::Cell>::intBegin() const
|
||||
{
|
||||
|
@ -727,12 +728,12 @@ namespace MWWorld
|
|||
{
|
||||
return iterator(mSharedExt.end());
|
||||
}
|
||||
const ESM::Cell* Store<ESM::Cell>::searchExtByName(const ESM::RefId& id) const
|
||||
const ESM::Cell* Store<ESM::Cell>::searchExtByName(std::string_view name) const
|
||||
{
|
||||
const ESM::Cell* cell = nullptr;
|
||||
for (const ESM::Cell* sharedCell : mSharedExt)
|
||||
{
|
||||
if (sharedCell->mName == id)
|
||||
if (sharedCell->mName == name)
|
||||
{
|
||||
if (cell == nullptr || (sharedCell->mData.mX > cell->mData.mX)
|
||||
|| (sharedCell->mData.mX == cell->mData.mX && sharedCell->mData.mY > cell->mData.mY))
|
||||
|
@ -777,7 +778,7 @@ namespace MWWorld
|
|||
|
||||
for (const ESM::Cell* sharedCell : mSharedInt)
|
||||
{
|
||||
list.push_back(sharedCell->mName);
|
||||
list.push_back(ESM::RefId::stringRefId(sharedCell->mName));
|
||||
}
|
||||
}
|
||||
ESM::Cell* Store<ESM::Cell>::insert(const ESM::Cell& cell)
|
||||
|
@ -812,9 +813,10 @@ namespace MWWorld
|
|||
}
|
||||
return erase(cell.mName);
|
||||
}
|
||||
bool Store<ESM::Cell>::erase(const ESM::RefId& id)
|
||||
bool Store<ESM::Cell>::erase(std::string_view name)
|
||||
{
|
||||
DynamicInt::iterator it = mDynamicInt.find(id);
|
||||
const std::string nameString = std::string(name);
|
||||
auto it = mDynamicInt.find(nameString);
|
||||
|
||||
if (it == mDynamicInt.end())
|
||||
{
|
||||
|
@ -875,7 +877,8 @@ namespace MWWorld
|
|||
// also an exterior cell with the coordinates of (0,0), so that doesn't help. Check whether mCell is an interior
|
||||
// cell. This isn't perfect, will break if a Region with the same name as an interior cell is created. A proper
|
||||
// fix should be made for future versions of the file format.
|
||||
bool interior = pathgrid.mData.mX == 0 && pathgrid.mData.mY == 0 && mCells->search(pathgrid.mCell) != nullptr;
|
||||
bool interior = pathgrid.mData.mX == 0 && pathgrid.mData.mY == 0
|
||||
&& mCells->search(pathgrid.mCell.getRefIdString()) != nullptr;
|
||||
|
||||
// deal with mods that have empty pathgrid records (Issue #6209)
|
||||
// we assume that these records are empty on purpose (i.e. to remove old pathgrid on an updated cell)
|
||||
|
@ -928,7 +931,7 @@ namespace MWWorld
|
|||
}
|
||||
const ESM::Pathgrid* Store<ESM::Pathgrid>::search(const ESM::RefId& name) const
|
||||
{
|
||||
Interior::const_iterator it = mInt.find(name);
|
||||
Interior::const_iterator it = mInt.find(ESM::RefId(name));
|
||||
if (it != mInt.end())
|
||||
return &(it->second);
|
||||
return nullptr;
|
||||
|
@ -958,14 +961,14 @@ namespace MWWorld
|
|||
if (!(cell.mData.mFlags & ESM::Cell::Interior))
|
||||
return search(cell.mData.mX, cell.mData.mY);
|
||||
else
|
||||
return search(cell.mName);
|
||||
return search(ESM::RefId::stringRefId(cell.mName));
|
||||
}
|
||||
const ESM::Pathgrid* Store<ESM::Pathgrid>::find(const ESM::Cell& cell) const
|
||||
{
|
||||
if (!(cell.mData.mFlags & ESM::Cell::Interior))
|
||||
return find(cell.mData.mX, cell.mData.mY);
|
||||
else
|
||||
return find(cell.mName);
|
||||
return find(ESM::RefId::stringRefId(cell.mName));
|
||||
}
|
||||
|
||||
// Skill
|
||||
|
|
|
@ -332,7 +332,8 @@ namespace MWWorld
|
|||
}
|
||||
};
|
||||
|
||||
typedef std::unordered_map<ESM::RefId, ESM::Cell> DynamicInt;
|
||||
typedef std::unordered_map<std::string, ESM::Cell, Misc::StringUtils::CiHash> DynamicInt;
|
||||
|
||||
typedef std::map<std::pair<int, int>, ESM::Cell, DynamicExtCmp> DynamicExt;
|
||||
|
||||
DynamicInt mInt;
|
||||
|
@ -350,12 +351,12 @@ namespace MWWorld
|
|||
public:
|
||||
typedef SharedIterator<ESM::Cell> iterator;
|
||||
|
||||
const ESM::Cell* search(const ESM::RefId& id) const;
|
||||
const ESM::Cell* search(std::string_view id) const;
|
||||
const ESM::Cell* search(int x, int y) const;
|
||||
const ESM::Cell* searchStatic(int x, int y) const;
|
||||
const ESM::Cell* searchOrCreate(int x, int y);
|
||||
|
||||
const ESM::Cell* find(const ESM::RefId& id) const;
|
||||
const ESM::Cell* find(std::string_view id) const;
|
||||
const ESM::Cell* find(int x, int y) const;
|
||||
|
||||
void clearDynamic() override;
|
||||
|
@ -369,7 +370,7 @@ namespace MWWorld
|
|||
iterator extEnd() const;
|
||||
|
||||
// Return the northernmost cell in the easternmost column.
|
||||
const ESM::Cell* searchExtByName(const ESM::RefId& id) const;
|
||||
const ESM::Cell* searchExtByName(std::string_view id) const;
|
||||
|
||||
// Return the northernmost cell in the easternmost column.
|
||||
const ESM::Cell* searchExtByRegion(const ESM::RefId& id) const;
|
||||
|
@ -383,7 +384,7 @@ namespace MWWorld
|
|||
ESM::Cell* insert(const ESM::Cell& cell);
|
||||
|
||||
bool erase(const ESM::Cell& cell);
|
||||
bool erase(const ESM::RefId& id);
|
||||
bool erase(std::string_view id);
|
||||
|
||||
bool erase(int x, int y);
|
||||
};
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace MWWorld
|
|||
World::World(osgViewer::Viewer* viewer, osg::ref_ptr<osg::Group> rootNode, Resource::ResourceSystem* resourceSystem,
|
||||
SceneUtil::WorkQueue* workQueue, SceneUtil::UnrefQueue& unrefQueue, const Files::Collections& fileCollections,
|
||||
const std::vector<std::string>& contentFiles, const std::vector<std::string>& groundcoverFiles,
|
||||
ToUTF8::Utf8Encoder* encoder, int activationDistanceOverride, const ESM::RefId& startCell,
|
||||
ToUTF8::Utf8Encoder* encoder, int activationDistanceOverride, const std::string& startCell,
|
||||
const std::string& startupScript, const std::filesystem::path& resourcePath,
|
||||
const std::filesystem::path& userDataPath)
|
||||
: mResourceSystem(resourceSystem)
|
||||
|
@ -640,7 +640,7 @@ namespace MWWorld
|
|||
if (cell)
|
||||
{
|
||||
if (!cell->isExterior() || !cell->mName.empty())
|
||||
return cell->mName.getRefIdString();
|
||||
return cell->mName;
|
||||
|
||||
if (const ESM::Region* region = mStore.get<ESM::Region>().search(cell->mRegion))
|
||||
return region->mName;
|
||||
|
@ -928,7 +928,7 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
void World::changeToInteriorCell(
|
||||
const ESM::RefId& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||
const std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||
{
|
||||
mPhysics->clearQueuedMovement();
|
||||
mDiscardMovements = true;
|
||||
|
@ -1399,10 +1399,10 @@ namespace MWWorld
|
|||
esmPos.pos[0] = traced.x();
|
||||
esmPos.pos[1] = traced.y();
|
||||
esmPos.pos[2] = traced.z();
|
||||
const ESM::RefId* cell = &ESM::RefId::sEmpty;
|
||||
std::string_view cell = "";
|
||||
if (!actor.getCell()->isExterior())
|
||||
cell = &actor.getCell()->getCell()->mName;
|
||||
MWWorld::ActionTeleport(*cell, esmPos, false).execute(actor);
|
||||
cell = actor.getCell()->getCell()->mName;
|
||||
MWWorld::ActionTeleport(cell, esmPos, false).execute(actor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2747,7 +2747,7 @@ namespace MWWorld
|
|||
physicActor->enableCollisionBody(enable);
|
||||
}
|
||||
|
||||
bool World::findInteriorPosition(const ESM::RefId& name, ESM::Position& pos)
|
||||
bool World::findInteriorPosition(std::string_view name, ESM::Position& pos)
|
||||
{
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
pos.pos[0] = pos.pos[1] = pos.pos[2] = 0;
|
||||
|
@ -2819,10 +2819,9 @@ namespace MWWorld
|
|||
return false;
|
||||
}
|
||||
|
||||
bool World::findExteriorPosition(const ESM::RefId& nameId, ESM::Position& pos)
|
||||
bool World::findExteriorPosition(std::string_view nameId, ESM::Position& pos)
|
||||
{
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
const std::string& name = nameId.getRefIdString();
|
||||
|
||||
const ESM::Cell* ext = nullptr;
|
||||
try
|
||||
|
@ -2836,12 +2835,13 @@ namespace MWWorld
|
|||
}
|
||||
if (!ext)
|
||||
{
|
||||
size_t comma = name.find(',');
|
||||
size_t comma = nameId.find(',');
|
||||
if (comma != std::string::npos)
|
||||
{
|
||||
int x, y;
|
||||
std::from_chars_result xResult = std::from_chars(name.data(), name.data() + comma, x);
|
||||
std::from_chars_result yResult = std::from_chars(name.data() + comma + 1, name.data() + name.size(), y);
|
||||
std::from_chars_result xResult = std::from_chars(nameId.data(), nameId.data() + comma, x);
|
||||
std::from_chars_result yResult
|
||||
= std::from_chars(nameId.data() + comma + 1, nameId.data() + nameId.size(), y);
|
||||
if (xResult.ec == std::errc::result_out_of_range || yResult.ec == std::errc::result_out_of_range)
|
||||
throw std::runtime_error("Cell coordinates out of range.");
|
||||
else if (xResult.ec == std::errc{} && yResult.ec == std::errc{})
|
||||
|
@ -3253,9 +3253,9 @@ namespace MWWorld
|
|||
|
||||
// Search for a 'nearest' exterior, counting each cell between the starting
|
||||
// cell and the exterior as a distance of 1. Will fail for isolated interiors.
|
||||
std::set<ESM::RefId> checkedCells;
|
||||
std::set<ESM::RefId> currentCells;
|
||||
std::set<ESM::RefId> nextCells;
|
||||
std::set<std::string_view> checkedCells;
|
||||
std::set<std::string_view> currentCells;
|
||||
std::set<std::string_view> nextCells;
|
||||
nextCells.insert(cell->getCell()->mName);
|
||||
|
||||
while (!nextCells.empty())
|
||||
|
@ -3282,7 +3282,7 @@ namespace MWWorld
|
|||
}
|
||||
else
|
||||
{
|
||||
const ESM::RefId& dest = ref.mRef.getDestCell();
|
||||
const std::string_view dest = ref.mRef.getDestCell();
|
||||
if (!checkedCells.count(dest) && !currentCells.count(dest))
|
||||
nextCells.insert(dest);
|
||||
}
|
||||
|
@ -3306,9 +3306,9 @@ namespace MWWorld
|
|||
// Search for a 'nearest' marker, counting each cell between the starting
|
||||
// cell and the exterior as a distance of 1. If an exterior is found, jump
|
||||
// to the nearest exterior marker, without further interior searching.
|
||||
std::set<ESM::RefId> checkedCells;
|
||||
std::set<ESM::RefId> currentCells;
|
||||
std::set<ESM::RefId> nextCells;
|
||||
std::set<std::string_view> checkedCells;
|
||||
std::set<std::string_view> currentCells;
|
||||
std::set<std::string_view> nextCells;
|
||||
MWWorld::ConstPtr closestMarker;
|
||||
|
||||
nextCells.insert(ptr.getCell()->getCell()->mName);
|
||||
|
@ -3404,11 +3404,11 @@ namespace MWWorld
|
|||
return;
|
||||
}
|
||||
|
||||
const ESM::RefId* cellName = &ESM::RefId::sEmpty;
|
||||
std::string_view cellName = "";
|
||||
if (!closestMarker.mCell->isExterior())
|
||||
cellName = &closestMarker.mCell->getCell()->mName;
|
||||
cellName = closestMarker.mCell->getCell()->mName;
|
||||
|
||||
MWWorld::ActionTeleport action(*cellName, closestMarker.getRefData().getPosition(), false);
|
||||
MWWorld::ActionTeleport action(cellName, closestMarker.getRefData().getPosition(), false);
|
||||
action.execute(ptr);
|
||||
}
|
||||
|
||||
|
@ -3610,7 +3610,7 @@ namespace MWWorld
|
|||
Log(Debug::Warning) << "Failed to confiscate items: no closest prison marker found.";
|
||||
return;
|
||||
}
|
||||
const ESM::RefId& prisonName = prisonMarker.getCellRef().getDestCell();
|
||||
std::string_view prisonName = prisonMarker.getCellRef().getDestCell();
|
||||
if (prisonName.empty())
|
||||
{
|
||||
Log(Debug::Warning) << "Failed to confiscate items: prison marker not linked to prison interior";
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace MWWorld
|
|||
WorldModel mWorldModel;
|
||||
std::vector<int> mESMVersions; // the versions of esm files
|
||||
|
||||
ESM::RefId mCurrentWorldSpace;
|
||||
std::string mCurrentWorldSpace;
|
||||
|
||||
std::unique_ptr<MWWorld::Player> mPlayer;
|
||||
std::unique_ptr<MWPhysics::PhysicsSystem> mPhysics;
|
||||
|
@ -118,7 +118,7 @@ namespace MWWorld
|
|||
|
||||
int mActivationDistanceOverride;
|
||||
|
||||
ESM::RefId mStartCell;
|
||||
std::string mStartCell;
|
||||
|
||||
float mSwimHeightScale;
|
||||
|
||||
|
@ -200,7 +200,7 @@ namespace MWWorld
|
|||
SceneUtil::WorkQueue* workQueue, SceneUtil::UnrefQueue& unrefQueue,
|
||||
const Files::Collections& fileCollections, const std::vector<std::string>& contentFiles,
|
||||
const std::vector<std::string>& groundcoverFiles, ToUTF8::Utf8Encoder* encoder,
|
||||
int activationDistanceOverride, const ESM::RefId& startCell, const std::string& startupScript,
|
||||
int activationDistanceOverride, const std::string& startCell, const std::string& startupScript,
|
||||
const std::filesystem::path& resourcePath, const std::filesystem::path& userDataPath);
|
||||
|
||||
virtual ~World();
|
||||
|
@ -341,7 +341,7 @@ namespace MWWorld
|
|||
|
||||
void setSimulationTimeScale(float scale) override;
|
||||
|
||||
void changeToInteriorCell(const ESM::RefId& cellName, const ESM::Position& position, bool adjustPlayerPos,
|
||||
void changeToInteriorCell(const std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos,
|
||||
bool changeEvent = true) override;
|
||||
///< Move to interior cell.
|
||||
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
|
||||
|
@ -603,11 +603,11 @@ namespace MWWorld
|
|||
|
||||
/// Find center of exterior cell above land surface
|
||||
/// \return false if exterior with given name not exists, true otherwise
|
||||
bool findExteriorPosition(const ESM::RefId& name, ESM::Position& pos) override;
|
||||
bool findExteriorPosition(std::string_view nameId, ESM::Position& pos) override;
|
||||
|
||||
/// Find position in interior cell near door entrance
|
||||
/// \return false if interior with given name not exists, true otherwise
|
||||
bool findInteriorPosition(const ESM::RefId& name, ESM::Position& pos) override;
|
||||
bool findInteriorPosition(std::string_view name, ESM::Position& pos) override;
|
||||
|
||||
/// Enables or disables use of teleport spell effects (recall, intervention, etc).
|
||||
void enableTeleporting(bool enable) override;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
template <class Visitor, class Key>
|
||||
bool forEachInStore(const ESM::RefId& id, Visitor&& visitor, std::map<Key, MWWorld::CellStore>& cellStore)
|
||||
template <class Visitor, class Key, class Comp>
|
||||
bool forEachInStore(const ESM::RefId& id, Visitor&& visitor, std::map<Key, MWWorld::CellStore, Comp>& cellStore)
|
||||
{
|
||||
for (auto& cell : cellStore)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ MWWorld::CellStore* MWWorld::WorldModel::getCellStore(const ESM::Cell* cell)
|
|||
{
|
||||
if (cell->mData.mFlags & ESM::Cell::Interior)
|
||||
{
|
||||
auto result = mInteriors.find(cell->mName);
|
||||
auto result = mInteriors.find(std::string(cell->mName));
|
||||
|
||||
if (result == mInteriors.end())
|
||||
result = mInteriors.emplace(cell->mName, CellStore(cell, mStore, mReaders)).first;
|
||||
|
@ -196,9 +196,9 @@ MWWorld::CellStore* MWWorld::WorldModel::getExterior(int x, int y)
|
|||
return &result->second;
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getInterior(const ESM::RefId& name)
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getInterior(std::string_view name)
|
||||
{
|
||||
auto result = mInteriors.find(name);
|
||||
auto result = mInteriors.find(std::string(name));
|
||||
|
||||
if (result == mInteriors.end())
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ MWWorld::CellStore* MWWorld::WorldModel::getCell(const ESM::CellId& id)
|
|||
return getInterior(id.mWorldspace);
|
||||
}
|
||||
|
||||
const ESM::Cell* MWWorld::WorldModel::getESMCellByName(const ESM::RefId& name)
|
||||
const ESM::Cell* MWWorld::WorldModel::getESMCellByName(std::string_view name)
|
||||
{
|
||||
const ESM::Cell* cell = mStore.get<ESM::Cell>().search(name); // first try interiors
|
||||
if (!cell) // try named exteriors
|
||||
|
@ -231,17 +231,17 @@ const ESM::Cell* MWWorld::WorldModel::getESMCellByName(const ESM::RefId& name)
|
|||
if (!cell)
|
||||
{
|
||||
// treat "Wilderness" like an empty string
|
||||
static const ESM::RefId defaultName
|
||||
= ESM::RefId::stringRefId(mStore.get<ESM::GameSetting>().find("sDefaultCellname")->mValue.getString());
|
||||
static const std::string& defaultName
|
||||
= mStore.get<ESM::GameSetting>().find("sDefaultCellname")->mValue.getString();
|
||||
if (name == defaultName)
|
||||
cell = mStore.get<ESM::Cell>().searchExtByName(ESM::RefId::sEmpty);
|
||||
cell = mStore.get<ESM::Cell>().searchExtByName("");
|
||||
}
|
||||
if (!cell)
|
||||
{
|
||||
// now check for regions
|
||||
for (const ESM::Region& region : mStore.get<ESM::Region>())
|
||||
{
|
||||
if (name == ESM::RefId::stringRefId(region.mName))
|
||||
if (name == region.mName)
|
||||
{
|
||||
cell = mStore.get<ESM::Cell>().searchExtByRegion(region.mId);
|
||||
break;
|
||||
|
@ -249,11 +249,11 @@ const ESM::Cell* MWWorld::WorldModel::getESMCellByName(const ESM::RefId& name)
|
|||
}
|
||||
}
|
||||
if (!cell)
|
||||
throw std::runtime_error(std::string("Can't find cell with name ") + name.getRefIdString());
|
||||
throw std::runtime_error(std::string("Can't find cell with name ") + std::string(name));
|
||||
return cell;
|
||||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getCell(const ESM::RefId& name)
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getCell(std::string_view name)
|
||||
{
|
||||
const ESM::Cell* cell = getESMCellByName(name);
|
||||
if (cell->isExterior())
|
||||
|
@ -263,7 +263,7 @@ MWWorld::CellStore* MWWorld::WorldModel::getCell(const ESM::RefId& name)
|
|||
}
|
||||
|
||||
MWWorld::CellStore* MWWorld::WorldModel::getCellByPosition(
|
||||
const osg::Vec3f& pos, const ESM::RefId& cellNameInSameWorldSpace)
|
||||
const osg::Vec3f& pos, std::string_view cellNameInSameWorldSpace)
|
||||
{
|
||||
if (cellNameInSameWorldSpace.empty() || getESMCellByName(cellNameInSameWorldSpace)->isExterior())
|
||||
{
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <components/misc/algorithm.hpp>
|
||||
|
||||
#include "cellstore.hpp"
|
||||
#include "ptr.hpp"
|
||||
|
||||
|
@ -34,7 +36,7 @@ namespace MWWorld
|
|||
typedef std::vector<std::pair<ESM::RefId, CellStore*>> IdCache;
|
||||
const MWWorld::ESMStore& mStore;
|
||||
ESM::ReadersCache& mReaders;
|
||||
mutable std::map<ESM::RefId, CellStore> mInteriors;
|
||||
mutable std::map<std::string, CellStore, Misc::StringUtils::CiComp> mInteriors;
|
||||
mutable std::map<std::pair<int, int>, CellStore> mExteriors;
|
||||
IdCache mIdCache;
|
||||
std::size_t mIdCacheIndex;
|
||||
|
@ -42,7 +44,7 @@ namespace MWWorld
|
|||
WorldModel(const WorldModel&);
|
||||
WorldModel& operator=(const WorldModel&);
|
||||
|
||||
const ESM::Cell* getESMCellByName(const ESM::RefId& name);
|
||||
const ESM::Cell* getESMCellByName(std::string_view name);
|
||||
CellStore* getCellStore(const ESM::Cell* cell);
|
||||
|
||||
Ptr getPtrAndCache(const ESM::RefId& name, CellStore& cellStore);
|
||||
|
@ -61,14 +63,14 @@ namespace MWWorld
|
|||
explicit WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCache& reader);
|
||||
|
||||
CellStore* getExterior(int x, int y);
|
||||
CellStore* getInterior(const ESM::RefId& name);
|
||||
CellStore* getCell(const ESM::RefId& name); // interior or named exterior
|
||||
CellStore* getCell(const ESM::CellId& id);
|
||||
CellStore* getInterior(std::string_view name);
|
||||
CellStore* getCell(std::string_view name); // interior or named exterior
|
||||
CellStore* getCell(const ESM::CellId& Id);
|
||||
|
||||
// If cellNameInSameWorldSpace is an interior - returns this interior.
|
||||
// Otherwise returns exterior cell for given position in the same world space.
|
||||
// At the moment multiple world spaces are not supported, so all exteriors are in one world space.
|
||||
CellStore* getCellByPosition(const osg::Vec3f& pos, const ESM::RefId& cellNameInSameWorldSpace);
|
||||
CellStore* getCellByPosition(const osg::Vec3f& pos, std::string_view cellNameInSameWorldSpace);
|
||||
|
||||
void registerPtr(const MWWorld::Ptr& ptr);
|
||||
void deregisterPtr(const MWWorld::Ptr& ptr);
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace ESM
|
|||
mTargetActorId = -1;
|
||||
esm.getHNOT(mTargetActorId, "TAID");
|
||||
esm.getHNT(mRemainingDuration, "DURA");
|
||||
mCellId = ESM::RefId::stringRefId(esm.getHNOString("CELL"));
|
||||
mCellId = esm.getHNOString("CELL");
|
||||
mRepeat = false;
|
||||
esm.getHNOT(mRepeat, "REPT");
|
||||
if (esm.getFormat() < 18)
|
||||
|
@ -74,7 +74,7 @@ namespace ESM
|
|||
esm.writeHNT("TAID", mTargetActorId);
|
||||
esm.writeHNT("DURA", mRemainingDuration);
|
||||
if (!mCellId.empty())
|
||||
esm.writeHNString("CELL", mCellId.getRefIdString());
|
||||
esm.writeHNString("CELL", mCellId);
|
||||
if (mRepeat)
|
||||
esm.writeHNT("REPT", mRepeat);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace ESM
|
|||
mTargetActorId = -1;
|
||||
esm.getHNOT(mTargetActorId, "TAID");
|
||||
esm.getHNT(mRemainingDuration, "DURA");
|
||||
mCellId = ESM::RefId::stringRefId(esm.getHNOString("CELL"));
|
||||
mCellId = esm.getHNOString("CELL");
|
||||
esm.getHNT(mAlwaysFollow, "ALWY");
|
||||
mCommanded = false;
|
||||
esm.getHNOT(mCommanded, "CMND");
|
||||
|
@ -111,7 +111,7 @@ namespace ESM
|
|||
esm.writeHNT("TAID", mTargetActorId);
|
||||
esm.writeHNT("DURA", mRemainingDuration);
|
||||
if (!mCellId.empty())
|
||||
esm.writeHNString("CELL", mCellId.getRefIdString());
|
||||
esm.writeHNString("CELL", mCellId);
|
||||
esm.writeHNT("ALWY", mAlwaysFollow);
|
||||
esm.writeHNT("CMND", mCommanded);
|
||||
if (mActive)
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace ESM
|
|||
|
||||
int mTargetActorId;
|
||||
ESM::RefId mTargetId;
|
||||
ESM::RefId mCellId;
|
||||
std::string mCellId;
|
||||
float mRemainingDuration;
|
||||
bool mRepeat;
|
||||
|
||||
|
@ -106,7 +106,7 @@ namespace ESM
|
|||
|
||||
int mTargetActorId;
|
||||
ESM::RefId mTargetId;
|
||||
ESM::RefId mCellId;
|
||||
std::string mCellId;
|
||||
float mRemainingDuration;
|
||||
|
||||
bool mAlwaysFollow;
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
namespace ESM
|
||||
{
|
||||
|
||||
const ESM::RefId CellId::sDefaultWorldspace = ESM::RefId::stringRefId("sys::default");
|
||||
const std::string CellId::sDefaultWorldspace = "sys::default";
|
||||
|
||||
void CellId::load(ESMReader& esm)
|
||||
{
|
||||
mWorldspace = ESM::RefId::stringRefId(esm.getHNString("SPAC"));
|
||||
mWorldspace = esm.getHNString("SPAC");
|
||||
|
||||
if (esm.isNextSub("CIDX"))
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ namespace ESM
|
|||
|
||||
void CellId::save(ESMWriter& esm) const
|
||||
{
|
||||
esm.writeHNString("SPAC", mWorldspace.getRefIdString());
|
||||
esm.writeHNString("SPAC", mWorldspace);
|
||||
|
||||
if (mPaged)
|
||||
esm.writeHNT("CIDX", mIndex, 8);
|
||||
|
|
|
@ -17,11 +17,11 @@ namespace ESM
|
|||
int mY;
|
||||
};
|
||||
|
||||
ESM::RefId mWorldspace;
|
||||
std::string mWorldspace;
|
||||
CellIndex mIndex;
|
||||
bool mPaged;
|
||||
|
||||
static const ESM::RefId sDefaultWorldspace;
|
||||
static const std::string sDefaultWorldspace;
|
||||
|
||||
void load(ESMReader& esm);
|
||||
void save(ESMWriter& esm) const;
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace ESM
|
|||
cellRef.mTeleport = true;
|
||||
break;
|
||||
case fourCC("DNAM"):
|
||||
getRefIdOrSkip(cellRef.mDestCell);
|
||||
getHStringOrSkip(cellRef.mDestCell);
|
||||
break;
|
||||
case fourCC("FLTV"):
|
||||
getHTOrSkip(cellRef.mLockLevel);
|
||||
|
@ -235,7 +235,7 @@ namespace ESM
|
|||
if (!inInventory && mTeleport)
|
||||
{
|
||||
esm.writeHNT("DODT", mDoorDest);
|
||||
esm.writeHNOCString("DNAM", mDestCell.getRefIdString());
|
||||
esm.writeHNOCString("DNAM", mDestCell);
|
||||
}
|
||||
|
||||
if (!inInventory && mLockLevel != 0)
|
||||
|
@ -270,7 +270,7 @@ namespace ESM
|
|||
mChargeIntRemainder = 0.0f;
|
||||
mEnchantmentCharge = -1;
|
||||
mGoldValue = 1;
|
||||
mDestCell = ESM::RefId::sEmpty;
|
||||
mDestCell.clear();
|
||||
mLockLevel = 0;
|
||||
mKey = ESM::RefId::sEmpty;
|
||||
mTrap = ESM::RefId::sEmpty;
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace ESM
|
|||
Position mDoorDest;
|
||||
|
||||
// Destination cell for doors (optional)
|
||||
ESM::RefId mDestCell;
|
||||
std::string mDestCell;
|
||||
|
||||
// Lock level for doors and containers
|
||||
int mLockLevel;
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace ESM
|
|||
switch (esm.retSubName().toInt())
|
||||
{
|
||||
case SREC_NAME:
|
||||
mName = esm.getRefId();
|
||||
mName = esm.getHString();
|
||||
break;
|
||||
case fourCC("DATA"):
|
||||
esm.getHTSized<12>(mData);
|
||||
|
@ -101,7 +101,7 @@ namespace ESM
|
|||
}
|
||||
else
|
||||
{
|
||||
mCellId.mWorldspace = mName;
|
||||
mCellId.mWorldspace = Misc::StringUtils::lowerCase(mName);
|
||||
mCellId.mIndex.mX = 0;
|
||||
mCellId.mIndex.mY = 0;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ namespace ESM
|
|||
|
||||
void Cell::save(ESMWriter& esm, bool isDeleted) const
|
||||
{
|
||||
esm.writeHNCString("NAME", mName.getRefIdString());
|
||||
esm.writeHNCString("NAME", mName);
|
||||
esm.writeHNT("DATA", mData, 12);
|
||||
|
||||
if (isDeleted)
|
||||
|
@ -225,7 +225,7 @@ namespace ESM
|
|||
|
||||
std::string Cell::getDescription() const
|
||||
{
|
||||
const auto& nameString = mName.getRefIdString();
|
||||
const auto& nameString = mName;
|
||||
if (mData.mFlags & Interior)
|
||||
return nameString;
|
||||
|
||||
|
@ -315,7 +315,7 @@ namespace ESM
|
|||
|
||||
void Cell::blank()
|
||||
{
|
||||
mName = ESM::RefId::sEmpty;
|
||||
mName = "";
|
||||
mRegion = ESM::RefId::sEmpty;
|
||||
mWater = 0;
|
||||
mWaterInt = false;
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace ESM
|
|||
};
|
||||
|
||||
Cell()
|
||||
: mName(ESM::RefId::sEmpty)
|
||||
: mName("")
|
||||
, mRegion(ESM::RefId())
|
||||
, mHasAmbi(true)
|
||||
, mWater(0)
|
||||
|
@ -113,7 +113,7 @@ namespace ESM
|
|||
|
||||
// Interior cells are indexed by this (it's the 'id'), for exterior
|
||||
// cells it is optional.
|
||||
ESM::RefId mName;
|
||||
std::string mName;
|
||||
|
||||
// Optional region name for exterior and quasi-exterior cells.
|
||||
RefId mRegion;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace ESM
|
|||
}
|
||||
else if (esm.retSubName().toInt() == fourCC("DNAM"))
|
||||
{
|
||||
const ESM::RefId name = esm.getRefId();
|
||||
std::string name = esm.getHString();
|
||||
if (mList.empty())
|
||||
Log(Debug::Warning) << "Encountered DNAM record without DODT record, skipped.";
|
||||
else
|
||||
|
@ -32,7 +32,7 @@ namespace ESM
|
|||
for (DestIter it = mList.begin(); it != mList.end(); ++it)
|
||||
{
|
||||
esm.writeHNT("DODT", it->mPos, sizeof(it->mPos));
|
||||
esm.writeHNOCString("DNAM", it->mCellName.getRefIdString());
|
||||
esm.writeHNOCString("DNAM", it->mCellName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace ESM
|
|||
struct Dest
|
||||
{
|
||||
Position mPos;
|
||||
ESM::RefId mCellName;
|
||||
std::string mCellName;
|
||||
};
|
||||
|
||||
std::vector<Dest> mList;
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace EsmLoader
|
|||
struct CellRecords
|
||||
{
|
||||
Records<ESM::Cell> mValues;
|
||||
std::map<ESM::RefId, std::size_t> mByName;
|
||||
std::map<std::string, std::size_t> mByName;
|
||||
std::map<std::pair<int, int>, std::size_t> mByPosition;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue