forked from mirror/openmw-tes3mp
replaced getCurrentCellName function with a more general getCellName function
This commit is contained in:
parent
eea433f141
commit
bc6fe682c9
4 changed files with 20 additions and 33 deletions
|
@ -149,7 +149,11 @@ namespace MWBase
|
|||
|
||||
virtual std::vector<std::string> getGlobals () const = 0;
|
||||
|
||||
virtual std::string getCurrentCellName() const = 0;
|
||||
virtual std::string getCellName (const MWWorld::CellStore *cell = 0) const = 0;
|
||||
///< Return name of the cell.
|
||||
///
|
||||
/// \note If cell==0, the cell the player is currently in will be used instead to
|
||||
/// generate a name.
|
||||
|
||||
virtual void removeRefScript (MWWorld::RefData *ref) = 0;
|
||||
//< Remove the script attached to ref from mLocalScripts
|
||||
|
|
|
@ -322,8 +322,7 @@ namespace MWScript
|
|||
|
||||
std::string InterpreterContext::getCurrentCellName() const
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
return world->getCurrentCellName();
|
||||
return MWBase::Environment::get().getWorld()->getCellName();
|
||||
}
|
||||
|
||||
bool InterpreterContext::isScriptRunning (const std::string& name) const
|
||||
|
|
|
@ -442,40 +442,20 @@ namespace MWWorld
|
|||
return mGlobalVariables->getGlobals();
|
||||
}
|
||||
|
||||
std::string World::getCurrentCellName () const
|
||||
std::string World::getCellName (const MWWorld::CellStore *cell) const
|
||||
{
|
||||
std::string name;
|
||||
if (!cell)
|
||||
cell = mWorldScene->getCurrentCell();
|
||||
|
||||
Ptr::CellStore *cell = mWorldScene->getCurrentCell();
|
||||
if (cell->mCell->isExterior())
|
||||
{
|
||||
if (cell->mCell->mName != "")
|
||||
{
|
||||
name = cell->mCell->mName;
|
||||
}
|
||||
else
|
||||
{
|
||||
const ESM::Region* region =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().search(cell->mCell->mRegion);
|
||||
if (region)
|
||||
name = region->mName;
|
||||
else
|
||||
{
|
||||
const ESM::GameSetting *setting =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().search("sDefaultCellname");
|
||||
if (!cell->mCell->isExterior() || !cell->mCell->mName.empty())
|
||||
return cell->mCell->mName;
|
||||
|
||||
if (setting && setting->mValue.getType()==ESM::VT_String)
|
||||
name = setting->mValue.getString();
|
||||
}
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = cell->mCell->mName;
|
||||
}
|
||||
if (const ESM::Region* region = store.get<ESM::Region>().search (cell->mCell->mRegion))
|
||||
return region->mName;
|
||||
|
||||
return name;
|
||||
return store.get<ESM::GameSetting>().find ("sDefaultCellname")->mValue.getString();
|
||||
}
|
||||
|
||||
void World::removeRefScript (MWWorld::RefData *ref)
|
||||
|
|
|
@ -213,7 +213,11 @@ namespace MWWorld
|
|||
|
||||
virtual std::vector<std::string> getGlobals () const;
|
||||
|
||||
virtual std::string getCurrentCellName () const;
|
||||
virtual std::string getCellName (const MWWorld::CellStore *cell = 0) const;
|
||||
///< Return name of the cell.
|
||||
///
|
||||
/// \note If cell==0, the cell the player is currently in will be used instead to
|
||||
/// generate a name.
|
||||
|
||||
virtual void removeRefScript (MWWorld::RefData *ref);
|
||||
//< Remove the script attached to ref from mLocalScripts
|
||||
|
|
Loading…
Reference in a new issue