diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 75965460a..b671600bc 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -672,7 +672,8 @@ void LocalPlayer::addJournalItems() 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) { diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/WorldEvent.cpp index a65cd3e8e..ce35070dc 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/WorldEvent.cpp @@ -86,9 +86,9 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore) { 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) { @@ -189,9 +189,9 @@ void WorldEvent::deleteObjects(MWWorld::CellStore* cellStore) { 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) { @@ -211,9 +211,9 @@ void WorldEvent::lockObjects(MWWorld::CellStore* cellStore) { 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) { @@ -233,9 +233,9 @@ void WorldEvent::unlockObjects(MWWorld::CellStore* cellStore) { 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) { @@ -255,9 +255,9 @@ void WorldEvent::scaleObjects(MWWorld::CellStore* cellStore) { 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) { @@ -277,9 +277,9 @@ void WorldEvent::moveObjects(MWWorld::CellStore* cellStore) { 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) { @@ -300,9 +300,9 @@ void WorldEvent::rotateObjects(MWWorld::CellStore* cellStore) { 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) { @@ -323,9 +323,9 @@ void WorldEvent::animateObjects(MWWorld::CellStore* cellStore) { 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) { @@ -347,9 +347,9 @@ void WorldEvent::activateDoors(MWWorld::CellStore* cellStore) { 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) { @@ -399,10 +399,10 @@ void WorldEvent::setLocalShorts(MWWorld::CellStore* cellStore) { worldObject = objectChanges.objects.at(i); - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i\n- index: %i\n- shortVal: %i", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.index, worldObject.shortVal); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- index: %i\n- shortVal: %i", worldObject.refId.c_str(), + 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) { @@ -422,10 +422,10 @@ void WorldEvent::setLocalFloats(MWWorld::CellStore* cellStore) { worldObject = objectChanges.objects.at(i); - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i\n- index: %i\n- floatVal: %f", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.index, worldObject.floatVal); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- index: %i\n- floatVal: %f", worldObject.refId.c_str(), + 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) { diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 297e752e1..1b1abeed6 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -454,10 +454,11 @@ namespace MWWorld PtrType mFound; std::string mIdToFind; unsigned int mRefNumIndexToFind; + unsigned int mMpNumToFind; 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) { @@ -470,11 +471,12 @@ namespace MWWorld }; ///< 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 searchVisitor; searchVisitor.mIdToFind = id; - searchVisitor.mRefNumIndexToFind = numIndex; + searchVisitor.mRefNumIndexToFind = refNumIndex; + searchVisitor.mMpNumToFind = mpNum; forEach(searchVisitor); return searchVisitor.mFound; } diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index adf43d946..63c30688a 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -234,7 +234,7 @@ namespace MWWorld Ptr searchViaActorId (int id); ///< 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 CellRefList *getContainers();