mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-22 07:21:26 +00:00
Exterior cell naming corrections
Use the ID for anonymous regions Try to use the name of the worldspace for ESM4
This commit is contained in:
parent
82bc6674dc
commit
24913687cd
@ -183,8 +183,6 @@ namespace MWBase
|
|||||||
/// generate a name.
|
/// generate a name.
|
||||||
virtual std::string_view getCellName(const MWWorld::Cell& cell) const = 0;
|
virtual std::string_view getCellName(const MWWorld::Cell& cell) const = 0;
|
||||||
|
|
||||||
virtual std::string_view getCellName(const ESM::Cell* cell) const = 0;
|
|
||||||
|
|
||||||
virtual void removeRefScript(const MWWorld::CellRef* ref) = 0;
|
virtual void removeRefScript(const MWWorld::CellRef* ref) = 0;
|
||||||
//< Remove the script attached to ref from mLocalScripts
|
//< Remove the script attached to ref from mLocalScripts
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <components/esm4/loadcell.hpp>
|
#include <components/esm4/loadcell.hpp>
|
||||||
#include <components/esm4/loaddoor.hpp>
|
#include <components/esm4/loaddoor.hpp>
|
||||||
#include <components/esm4/loadstat.hpp>
|
#include <components/esm4/loadstat.hpp>
|
||||||
|
#include <components/esm4/loadwrld.hpp>
|
||||||
|
|
||||||
#include <components/misc/constants.hpp>
|
#include <components/misc/constants.hpp>
|
||||||
#include <components/misc/convert.hpp>
|
#include <components/misc/convert.hpp>
|
||||||
@ -662,25 +663,29 @@ namespace MWWorld
|
|||||||
if (!cell.isExterior() || !cell.getDisplayName().empty())
|
if (!cell.isExterior() || !cell.getDisplayName().empty())
|
||||||
return cell.getDisplayName();
|
return cell.getDisplayName();
|
||||||
|
|
||||||
return ESM::visit(ESM::VisitOverload{
|
if (!cell.getRegion().empty())
|
||||||
[&](const ESM::Cell& cellIn) -> std::string_view { return getCellName(&cellIn); },
|
|
||||||
[&](const ESM4::Cell& cellIn) -> std::string_view {
|
|
||||||
return mStore.get<ESM::GameSetting>().find("sDefaultCellname")->mValue.getString();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
cell);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string_view World::getCellName(const ESM::Cell* cell) const
|
|
||||||
{
|
|
||||||
if (cell)
|
|
||||||
{
|
{
|
||||||
if (!cell->isExterior() || !cell->mName.empty())
|
std::string_view regionName
|
||||||
return cell->mName;
|
= ESM::visit(ESM::VisitOverload{
|
||||||
|
[&](const ESM::Cell& cellIn) -> std::string_view {
|
||||||
if (const ESM::Region* region = mStore.get<ESM::Region>().search(cell->mRegion))
|
if (const ESM::Region* region = mStore.get<ESM::Region>().search(cell.getRegion()))
|
||||||
return region->mName;
|
return !region->mName.empty() ? region->mName : region->mId.getRefIdString();
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
[&](const ESM4::Cell& cellIn) -> std::string_view { return {}; },
|
||||||
|
},
|
||||||
|
cell);
|
||||||
|
if (!regionName.empty())
|
||||||
|
return regionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cell.getWorldSpace().empty() && ESM::isEsm4Ext(cell.getWorldSpace()))
|
||||||
|
{
|
||||||
|
if (const ESM4::World* worldspace = mStore.get<ESM4::World>().search(cell.getWorldSpace()))
|
||||||
|
if (!worldspace->mFullName.empty())
|
||||||
|
return worldspace->mFullName;
|
||||||
|
}
|
||||||
|
|
||||||
return mStore.get<ESM::GameSetting>().find("sDefaultCellname")->mValue.getString();
|
return mStore.get<ESM::GameSetting>().find("sDefaultCellname")->mValue.getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,6 @@ namespace MWWorld
|
|||||||
/// \note If cell==0, the cell the player is currently in will be used instead to
|
/// \note If cell==0, the cell the player is currently in will be used instead to
|
||||||
/// generate a name.
|
/// generate a name.
|
||||||
std::string_view getCellName(const MWWorld::Cell& cell) const override;
|
std::string_view getCellName(const MWWorld::Cell& cell) const override;
|
||||||
std::string_view getCellName(const ESM::Cell* cell) const override;
|
|
||||||
|
|
||||||
void removeRefScript(const MWWorld::CellRef* ref) override;
|
void removeRefScript(const MWWorld::CellRef* ref) override;
|
||||||
//< Remove the script attached to ref from mLocalScripts
|
//< Remove the script attached to ref from mLocalScripts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user