mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-24 05:00:31 -04:00
[Client] Add actorsOnly argument to CellStore's exact object search
This commit is contained in:
parent
a6dd76776f
commit
17715933b5
@ -606,14 +606,18 @@ namespace MWWorld
|
|||||||
const unsigned int mRefNumToFind;
|
const unsigned int mRefNumToFind;
|
||||||
const unsigned int mMpNumToFind;
|
const unsigned int mMpNumToFind;
|
||||||
const std::string mRefIdToFind;
|
const std::string mRefIdToFind;
|
||||||
|
const bool mActorsOnly;
|
||||||
public:
|
public:
|
||||||
SearchExactVisitor(const unsigned int refNum, const unsigned int mpNum, const std::string refId) : mRefNumToFind(refNum), mMpNumToFind(mpNum), mRefIdToFind(refId) {}
|
SearchExactVisitor(const unsigned int refNum, const unsigned int mpNum, const std::string refId, const bool actorsOnly) :
|
||||||
|
mRefNumToFind(refNum), mMpNumToFind(mpNum), mRefIdToFind(refId), mActorsOnly(actorsOnly) {}
|
||||||
|
|
||||||
Ptr mFound;
|
Ptr mFound;
|
||||||
|
|
||||||
bool operator()(const Ptr& ptr)
|
bool operator()(const Ptr& ptr)
|
||||||
{
|
{
|
||||||
if (ptr.getCellRef().getRefNum().mIndex == mRefNumToFind && ptr.getCellRef().getMpNum() == mMpNumToFind)
|
if (ptr.getCellRef().getRefNum().mIndex == mRefNumToFind && ptr.getCellRef().getMpNum() == mMpNumToFind)
|
||||||
|
{
|
||||||
|
if (!mActorsOnly || ptr.getClass().isActor())
|
||||||
{
|
{
|
||||||
if (mRefIdToFind.empty() || Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), mRefIdToFind))
|
if (mRefIdToFind.empty() || Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), mRefIdToFind))
|
||||||
{
|
{
|
||||||
@ -621,6 +625,7 @@ namespace MWWorld
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -633,13 +638,13 @@ namespace MWWorld
|
|||||||
|
|
||||||
Allow the searching of objects by their reference numbers
|
Allow the searching of objects by their reference numbers
|
||||||
*/
|
*/
|
||||||
Ptr CellStore::searchExact (const unsigned int refNum, const unsigned int mpNum, const std::string refId)
|
Ptr CellStore::searchExact (const unsigned int refNum, const unsigned int mpNum, const std::string refId, bool actorsOnly)
|
||||||
{
|
{
|
||||||
// Ensure that all objects searched for have a valid reference number
|
// Ensure that all objects searched for have a valid reference number
|
||||||
if (refNum == 0 && mpNum == 0)
|
if (refNum == 0 && mpNum == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
SearchExactVisitor searchVisitor(refNum, mpNum, refId);
|
SearchExactVisitor searchVisitor(refNum, mpNum, refId, actorsOnly);
|
||||||
forEach(searchVisitor);
|
forEach(searchVisitor);
|
||||||
return searchVisitor.mFound;
|
return searchVisitor.mFound;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ namespace MWWorld
|
|||||||
Allow the searching of objects by their reference numbers and, optionally,
|
Allow the searching of objects by their reference numbers and, optionally,
|
||||||
their refIds
|
their refIds
|
||||||
*/
|
*/
|
||||||
Ptr searchExact (unsigned int refNum, unsigned int mpNum, std::string refId = "");
|
Ptr searchExact (unsigned int refNum, unsigned int mpNum, std::string refId = "", bool actorsOnly = false);
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user