1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-21 18:40:01 +00:00

Replaced some RefId* => RefId&

Rebase fix commit
This commit is contained in:
florent.teppe 2022-11-10 23:29:18 +01:00
parent d49f60d2d6
commit a7d0a8d9d1
4 changed files with 15 additions and 14 deletions

View File

@ -506,11 +506,11 @@ namespace MWClass
for (std::vector<ESM::PartReference>::const_iterator it = parts.begin(); it != parts.end(); ++it)
{
const ESM::RefId* partname = female ? &it->mFemale : &it->mMale;
if (partname->empty())
partname = female ? &it->mMale : &it->mFemale;
const ESM::RefId& partname
= (female && !it->mFemale.empty()) || (!female && it->mMale.empty()) ? it->mFemale : it->mMale;
const ESM::BodyPart* part
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(*partname);
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(partname);
if (part && !part->mModel.empty())
models.push_back(Misc::ResourceHelpers::correctMeshPath(part->mModel, vfs));
}

View File

@ -29,16 +29,17 @@ namespace
{
bool matchesStaticFilters(const MWDialogue::SelectWrapper& select, const MWWorld::Ptr& actor)
{
const ESM::RefId selectId = ESM::RefId::stringRefId(select.getName());
if (select.getFunction() == MWDialogue::SelectWrapper::Function_NotId)
return !Misc::StringUtils::ciEqual(actor.getCellRef().getRefId(), select.getName());
return actor.getCellRef().getRefId() != selectId;
if (actor.getClass().isNpc())
{
if (select.getFunction() == MWDialogue::SelectWrapper::Function_NotFaction)
return !Misc::StringUtils::ciEqual(actor.getClass().getPrimaryFaction(actor), select.getName());
return actor.getClass().getPrimaryFaction(actor) != selectId;
else if (select.getFunction() == MWDialogue::SelectWrapper::Function_NotClass)
return !Misc::StringUtils::ciEqual(actor.get<ESM::NPC>()->mBase->mClass, select.getName());
return actor.get<ESM::NPC>()->mBase->mClass != selectId;
else if (select.getFunction() == MWDialogue::SelectWrapper::Function_NotRace)
return !Misc::StringUtils::ciEqual(actor.get<ESM::NPC>()->mBase->mRace, select.getName());
return actor.get<ESM::NPC>()->mBase->mRace != selectId;
}
return true;
}
@ -62,7 +63,7 @@ namespace
{
if (wrapper.getFunction() == MWDialogue::SelectWrapper::Function_Local)
{
std::string_view scriptName = actor.getClass().getScript(actor);
const ESM::RefId& scriptName = actor.getClass().getScript(actor);
if (scriptName.empty())
return false;
const Compiler::Locals& localDefs
@ -196,7 +197,7 @@ bool MWDialogue::Filter::testPlayer(const ESM::DialInfo& info) const
{
// supports partial matches, just like getPcCell
std::string_view playerCell = MWBase::Environment::get().getWorld()->getCellName(player.getCell());
if (!Misc::StringUtils::ciStartsWith(playerCell, info.mCell))
if (!Misc::StringUtils::ciStartsWith(playerCell, info.mCell.getRefIdString()))
return false;
}

View File

@ -156,7 +156,7 @@ namespace MWDialogue
else
{
errorHandler.reset();
errorHandler.setContext(info.mId + " in " + topic.mId);
errorHandler.setContext(info.mId.getRefIdString() + " in " + topic.mId.getRefIdString());
if (!test(ptr, info, compiled, total, extensions, compilerContext, errorHandler))
Log(Debug::Error) << "Test failed for " << info.mId << " in " << topic.mId << '\n'
<< info.mResultScript;

View File

@ -194,11 +194,11 @@ namespace MWGui
if (_index == MyGUI::ITEM_NONE)
return;
const ESM::RefId* classId = mClassList->getItemDataAt<ESM::RefId>(_index);
if (mCurrentClassId == *classId)
const ESM::RefId& classId = *mClassList->getItemDataAt<ESM::RefId>(_index);
if (mCurrentClassId == classId)
return;
mCurrentClassId = *classId;
mCurrentClassId = classId;
updateStats();
}