forked from mirror/openmw-tes3mp
[Client] Use mpNum in exact searches for objects
This commit is contained in:
parent
665fe09fd0
commit
4644235cf6
4 changed files with 32 additions and 29 deletions
|
@ -672,7 +672,8 @@ void LocalPlayer::addJournalItems()
|
||||||
|
|
||||||
if (!ptrCellStore) continue;
|
if (!ptrCellStore) continue;
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = ptrCellStore->searchExact(journalItem.actorCellRef.mRefID, journalItem.actorCellRef.mRefNum.mIndex);
|
MWWorld::Ptr ptrFound = ptrCellStore->searchExact(journalItem.actorCellRef.mRefID,
|
||||||
|
journalItem.actorCellRef.mRefNum.mIndex, journalItem.actorCellRef.mMpNum);
|
||||||
|
|
||||||
if (!ptrFound)
|
if (!ptrFound)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,9 +86,9 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -189,9 +189,9 @@ void WorldEvent::deleteObjects(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -211,9 +211,9 @@ void WorldEvent::lockObjects(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -233,9 +233,9 @@ void WorldEvent::unlockObjects(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -255,9 +255,9 @@ void WorldEvent::scaleObjects(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -277,9 +277,9 @@ void WorldEvent::moveObjects(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -300,9 +300,9 @@ void WorldEvent::rotateObjects(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -323,9 +323,9 @@ void WorldEvent::animateObjects(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -347,9 +347,9 @@ void WorldEvent::activateDoors(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i", worldObject.refId.c_str(), worldObject.refNumIndex);
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -399,10 +399,10 @@ void WorldEvent::setLocalShorts(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i\n- index: %i\n- shortVal: %i", worldObject.refId.c_str(),
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- index: %i\n- shortVal: %i", worldObject.refId.c_str(),
|
||||||
worldObject.refNumIndex, worldObject.index, worldObject.shortVal);
|
worldObject.refNumIndex, worldObject.mpNum, worldObject.index, worldObject.shortVal);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
@ -422,10 +422,10 @@ void WorldEvent::setLocalFloats(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
worldObject = objectChanges.objects.at(i);
|
worldObject = objectChanges.objects.at(i);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i\n- index: %i\n- floatVal: %f", worldObject.refId.c_str(),
|
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- index: %i\n- floatVal: %f", worldObject.refId.c_str(),
|
||||||
worldObject.refNumIndex, worldObject.index, worldObject.floatVal);
|
worldObject.refNumIndex, worldObject.mpNum, worldObject.index, worldObject.floatVal);
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||||
|
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
|
|
|
@ -454,10 +454,11 @@ namespace MWWorld
|
||||||
PtrType mFound;
|
PtrType mFound;
|
||||||
std::string mIdToFind;
|
std::string mIdToFind;
|
||||||
unsigned int mRefNumIndexToFind;
|
unsigned int mRefNumIndexToFind;
|
||||||
|
unsigned int mMpNumToFind;
|
||||||
|
|
||||||
bool operator()(const PtrType& ptr)
|
bool operator()(const PtrType& ptr)
|
||||||
{
|
{
|
||||||
if (ptr.getCellRef().getRefNum().mIndex == mRefNumIndexToFind)
|
if (ptr.getCellRef().getRefNum().mIndex == mRefNumIndexToFind && ptr.getCellRef().getMpNum() == mMpNumToFind)
|
||||||
{
|
{
|
||||||
if (ptr.getCellRef().getRefId() == mIdToFind)
|
if (ptr.getCellRef().getRefId() == mIdToFind)
|
||||||
{
|
{
|
||||||
|
@ -470,11 +471,12 @@ namespace MWWorld
|
||||||
};
|
};
|
||||||
|
|
||||||
///< Added by tes3mp and used to find an object by both its ID and its reference number
|
///< Added by tes3mp and used to find an object by both its ID and its reference number
|
||||||
Ptr CellStore::searchExact (const std::string& id, unsigned int numIndex)
|
Ptr CellStore::searchExact (const std::string& id, unsigned int refNumIndex, unsigned int mpNum)
|
||||||
{
|
{
|
||||||
SearchExactVisitor<MWWorld::Ptr> searchVisitor;
|
SearchExactVisitor<MWWorld::Ptr> searchVisitor;
|
||||||
searchVisitor.mIdToFind = id;
|
searchVisitor.mIdToFind = id;
|
||||||
searchVisitor.mRefNumIndexToFind = numIndex;
|
searchVisitor.mRefNumIndexToFind = refNumIndex;
|
||||||
|
searchVisitor.mMpNumToFind = mpNum;
|
||||||
forEach(searchVisitor);
|
forEach(searchVisitor);
|
||||||
return searchVisitor.mFound;
|
return searchVisitor.mFound;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,7 @@ namespace MWWorld
|
||||||
Ptr searchViaActorId (int id);
|
Ptr searchViaActorId (int id);
|
||||||
///< Will return an empty Ptr if cell is not loaded.
|
///< Will return an empty Ptr if cell is not loaded.
|
||||||
|
|
||||||
Ptr searchExact (const std::string& id, unsigned int numIndex);
|
Ptr searchExact (const std::string& id, unsigned int refNumIndex, unsigned int mpNum);
|
||||||
///< Added by tes3mp and used to find an object by both its ID and its reference number
|
///< Added by tes3mp and used to find an object by both its ID and its reference number
|
||||||
|
|
||||||
CellRefList<ESM::Container> *getContainers();
|
CellRefList<ESM::Container> *getContainers();
|
||||||
|
|
Loading…
Reference in a new issue