Merge branch 'door_to_nothingness' into 'master'

Fallback to default cell name for door destination

Closes #5838

See merge request OpenMW/openmw!591
symlink-ci
psi29a 3 years ago
commit 57fba8c070

@ -100,6 +100,7 @@
Bug #5821: NPCs from mods getting removed if mod order was changed
Bug #5835: OpenMW doesn't accept negative values for NPC's hello, alarm, fight, and flee
Bug #5836: OpenMW dialogue/greeting/voice filter doesn't accept negative Ai values for NPC's hello, alarm, fight, and flee
Bug #5838: Local map and other menus become blank in some locations while playing Wizards' Islands mod.
Bug #5840: GetSoundPlaying "Health Damage" doesn't play when NPC hits target with shield effect ( vanilla engine behavior )
Bug #5841: Can't Cast Zero Cost Spells When Magicka is < 0
Feature #390: 3rd person look "over the shoulder"

@ -185,6 +185,7 @@ namespace MWBase
///
/// \note If cell==0, the cell the player is currently in will be used instead to
/// generate a name.
virtual std::string getCellName(const ESM::Cell* cell) const = 0;
virtual void removeRefScript (MWWorld::RefData *ref) = 0;
//< Remove the script attached to ref from mLocalScripts

@ -302,30 +302,15 @@ namespace MWClass
std::string Door::getDestination (const MWWorld::LiveCellRef<ESM::Door>& door)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string dest;
if (door.mRef.getDestCell() != "")
{
// door leads to an interior, use interior name as tooltip
dest = door.mRef.getDestCell();
}
else
std::string dest = door.mRef.getDestCell();
if (dest.empty())
{
// door leads to exterior, use cell name (if any), otherwise translated region name
int x,y;
MWBase::Environment::get().getWorld()->positionToIndex (door.mRef.getDoorDest().pos[0], door.mRef.getDoorDest().pos[1], x, y);
const ESM::Cell* cell = store.get<ESM::Cell>().find(x,y);
if (cell->mName != "")
dest = cell->mName;
else
{
const ESM::Region* region =
store.get<ESM::Region>().find(cell->mRegion);
//name as is, not a token
return MyGUI::TextIterator::toTagsString(region->mName);
}
auto world = MWBase::Environment::get().getWorld();
world->positionToIndex (door.mRef.getDoorDest().pos[0], door.mRef.getDoorDest().pos[1], x, y);
const ESM::Cell* cell = world->getStore().get<ESM::Cell>().search(x,y);
dest = world->getCellName(cell);
}
return "#{sCell=" + dest + "}";

@ -656,13 +656,19 @@ namespace MWWorld
{
if (!cell)
cell = mWorldScene->getCurrentCell();
return getCellName(cell->getCell());
}
if (!cell->getCell()->isExterior() || !cell->getCell()->mName.empty())
return cell->getCell()->mName;
if (const ESM::Region* region = mStore.get<ESM::Region>().search (cell->getCell()->mRegion))
return region->mName;
std::string World::getCellName(const ESM::Cell* cell) const
{
if (cell)
{
if (!cell->isExterior() || !cell->mName.empty())
return cell->mName;
if (const ESM::Region* region = mStore.get<ESM::Region>().search (cell->mRegion))
return region->mName;
}
return mStore.get<ESM::GameSetting>().find ("sDefaultCellname")->mValue.getString();
}

@ -281,6 +281,7 @@ namespace MWWorld
///
/// \note If cell==0, the cell the player is currently in will be used instead to
/// generate a name.
std::string getCellName(const ESM::Cell* cell) const override;
void removeRefScript (MWWorld::RefData *ref) override;
//< Remove the script attached to ref from mLocalScripts

Loading…
Cancel
Save