mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Support region names in cell dialogue filter (Fixes #2113)
This commit is contained in:
parent
105f0f8716
commit
4aed5158cc
2 changed files with 5 additions and 13 deletions
|
@ -126,7 +126,7 @@ bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const
|
|||
if (!info.mCell.empty())
|
||||
{
|
||||
// supports partial matches, just like getPcCell
|
||||
const std::string& playerCell = player.getCell()->getCell()->mName;
|
||||
const std::string& playerCell = MWBase::Environment::get().getWorld()->getCellName(player.getCell());
|
||||
bool match = playerCell.length()>=info.mCell.length() &&
|
||||
Misc::StringUtils::ciEqual(playerCell.substr (0, info.mCell.length()), info.mCell);
|
||||
if (!match)
|
||||
|
@ -451,7 +451,8 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_NotCell:
|
||||
|
||||
return !Misc::StringUtils::ciEqual(mActor.getCell()->getCell()->mName, select.getName());
|
||||
return !Misc::StringUtils::ciEqual(MWBase::Environment::get().getWorld()->getCellName(mActor.getCell())
|
||||
, select.getName());
|
||||
|
||||
case SelectWrapper::Function_NotLocal:
|
||||
{
|
||||
|
|
|
@ -117,18 +117,9 @@ namespace MWScript
|
|||
runtime.push(0);
|
||||
return;
|
||||
}
|
||||
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->getCell();
|
||||
const MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
|
||||
std::string current = cell->mName;
|
||||
|
||||
if (!(cell->mData.mFlags & ESM::Cell::Interior) && current.empty()
|
||||
&& !cell->mRegion.empty())
|
||||
{
|
||||
const ESM::Region *region =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().find (cell->mRegion);
|
||||
|
||||
current = region->mName;
|
||||
}
|
||||
std::string current = MWBase::Environment::get().getWorld()->getCellName(cell);
|
||||
Misc::StringUtils::toLower(current);
|
||||
|
||||
bool match = current.length()>=name.length() &&
|
||||
|
|
Loading…
Reference in a new issue