From e5cf632e1db4320e57c00492d72879e1fd3fa4a0 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 4 Apr 2017 06:01:48 +0300 Subject: [PATCH] [Client] Stop creating new reference numbers for placed/spawned objects --- apps/openmw/mwgui/hud.cpp | 8 -------- apps/openmw/mwmp/WorldEvent.cpp | 8 -------- apps/openmw/mwscript/transformationextensions.cpp | 8 -------- apps/openmw/mwworld/cellref.cpp | 7 ------- apps/openmw/mwworld/cellref.hpp | 4 ---- apps/openmw/mwworld/cellstore.cpp | 15 --------------- apps/openmw/mwworld/cellstore.hpp | 6 ------ 7 files changed, 56 deletions(-) diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 3d093eefa..54fc88799 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -58,14 +58,6 @@ namespace MWGui if (setNewOwner) dropped.getCellRef().setOwner(""); - // Major change done by tes3mp: - // When the object is dropped, generate a new RefNum index for it that follows the last one - // in the cell, so that packets can be sent and received specifically about it, instead - // of giving it a RefNum index of 0 as in regular OpenMW - MWWorld::CellStore *cellStore = dropped.getCell(); - cellStore->setLastRefNumIndex(cellStore->getLastRefNumIndex() + 1); - dropped.getCellRef().setRefNumIndex(cellStore->getLastRefNumIndex()); - /* Start of tes3mp addition diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/WorldEvent.cpp index df45453ca..4451afe8f 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/WorldEvent.cpp @@ -176,14 +176,6 @@ void WorldEvent::placeObjects(MWWorld::CellStore* cellStore) newPtr.getCellRef().setGoldValue(worldObject.goldValue); newPtr = MWBase::Environment::get().getWorld()->placeObject(newPtr, cellStore, worldObject.pos); - - // Change RefNum here because the line above unsets it - newPtr.getCellRef().setRefNumIndex(worldObject.refNumIndex); - - // If this RefNum is higher than the last we've recorded for this CellStore, - // start using it as our new last one - if (cellStore->getLastRefNumIndex() < worldObject.refNumIndex) - cellStore->setLastRefNumIndex(worldObject.refNumIndex); } } diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index 44f1a7d07..86bde76da 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -550,14 +550,6 @@ namespace MWScript MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(), actor, actor.getCell(), direction, distance); - // Major change done by tes3mp: - // When the object is dropped, generate a new RefNum index for it that follows the last one - // in the cell, so that packets can be sent and received specifically about it, instead - // of giving it a RefNum index of 0 as in regular OpenMW - MWWorld::CellStore *cellStore = ptr.getCell(); - cellStore->setLastRefNumIndex(cellStore->getLastRefNumIndex() + 1); - ptr.getCellRef().setRefNumIndex(cellStore->getLastRefNumIndex()); - /* Start of tes3mp addition diff --git a/apps/openmw/mwworld/cellref.cpp b/apps/openmw/mwworld/cellref.cpp index 0d3435dc5..72ee56e6a 100644 --- a/apps/openmw/mwworld/cellref.cpp +++ b/apps/openmw/mwworld/cellref.cpp @@ -20,13 +20,6 @@ namespace MWWorld mCellRef.mRefNum.unset(); } - // Added by tes3mp to allow creation of new items with RefNum indexes - // specific to them - void CellRef::setRefNumIndex(int index) - { - mCellRef.mRefNum.mIndex = index; - } - std::string CellRef::getRefId() const { return mCellRef.mRefID; diff --git a/apps/openmw/mwworld/cellref.hpp b/apps/openmw/mwworld/cellref.hpp index f0a6a4cb7..7e27e6ef3 100644 --- a/apps/openmw/mwworld/cellref.hpp +++ b/apps/openmw/mwworld/cellref.hpp @@ -28,10 +28,6 @@ namespace MWWorld // Set RefNum to its default state. void unsetRefNum(); - // Added by tes3mp to allow creation of new items with RefNum indexes - // specific to them - void setRefNumIndex(int index); - /// Does the RefNum have a content file? bool hasContentFile() const; diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 52af21954..297e752e1 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -479,18 +479,6 @@ namespace MWWorld return searchVisitor.mFound; } - // Added by tes3mp and used to get the last reference number in the cell - unsigned int CellStore::getLastRefNumIndex() const - { - return lastRefNumIndex; - } - - // Added by tes3mp and used to record the last reference number in the cell - void CellStore::setLastRefNumIndex(unsigned int value) - { - lastRefNumIndex = value; - } - // Added by tes3mp and used to get all the containers in the cell CellRefList *CellStore::getContainers() { @@ -650,9 +638,6 @@ namespace MWWorld loadRef (ref, deleted, refNumToID); } - if(refNumToID.size() != 0) - setLastRefNumIndex(refNumToID.rbegin()->first.mIndex); - updateMergedRefs(); } diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index d0667520d..adf43d946 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -237,12 +237,6 @@ namespace MWWorld Ptr searchExact (const std::string& id, unsigned int numIndex); ///< Added by tes3mp and used to find an object by both its ID and its reference number - unsigned int getLastRefNumIndex() const; - // Added by tes3mp and used to get the last reference number in the cell - - void setLastRefNumIndex(unsigned int value); - // Added by tes3mp and used to record the last reference number in the cell - CellRefList *getContainers(); // Added by tes3mp and used to get all the containers in the cell