From 203ee492c882349be194b13fde7e03e81b36ab4d Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Sun, 23 Jan 2022 20:55:17 +0100 Subject: [PATCH] Remove `getRefIdRef` because it is the same as `getRefId`. --- apps/openmw/mwlua/actions.cpp | 2 +- apps/openmw/mwlua/luamanagerimp.cpp | 2 +- apps/openmw/mwlua/object.cpp | 8 ++++---- apps/openmw/mwworld/cellref.hpp | 3 --- apps/openmw/mwworld/cells.cpp | 2 +- apps/openmw/mwworld/cellstore.cpp | 4 ++-- apps/openmw/mwworld/containerstore.cpp | 10 +++++----- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwlua/actions.cpp b/apps/openmw/mwlua/actions.cpp index 49bb5cfcb4..dda237fb4e 100644 --- a/apps/openmw/mwlua/actions.cpp +++ b/apps/openmw/mwlua/actions.cpp @@ -95,7 +95,7 @@ namespace MWLua else { const std::string& recordId = std::get(item); - if (old_it != store.end() && old_it->getCellRef().getRefIdRef() == recordId) + if (old_it != store.end() && old_it->getCellRef().getRefId() == recordId) return true; // already equipped itemPtr = store.search(recordId); if (itemPtr.isEmpty() || itemPtr.getRefData().getCount() == 0) diff --git a/apps/openmw/mwlua/luamanagerimp.cpp b/apps/openmw/mwlua/luamanagerimp.cpp index 8211c37abf..240a1b8627 100644 --- a/apps/openmw/mwlua/luamanagerimp.cpp +++ b/apps/openmw/mwlua/luamanagerimp.cpp @@ -374,7 +374,7 @@ namespace MWLua std::shared_ptr scripts; if (flag == ESM::LuaScriptCfg::sPlayer) { - assert(ptr.getCellRef().getRefIdRef() == "player"); + assert(ptr.getCellRef().getRefId() == "player"); scripts = std::make_shared(&mLua, LObject(getId(ptr), mWorldView.getObjectRegistry())); scripts->addPackage("openmw.ui", mUserInterfacePackage); scripts->addPackage("openmw.camera", mCameraPackage); diff --git a/apps/openmw/mwlua/object.cpp b/apps/openmw/mwlua/object.cpp index 69206e8c37..a9f09ad95d 100644 --- a/apps/openmw/mwlua/object.cpp +++ b/apps/openmw/mwlua/object.cpp @@ -44,7 +44,7 @@ namespace MWLua bool isMarker(const MWWorld::Ptr& ptr) { - std::string_view id = ptr.getCellRef().getRefIdRef(); + std::string_view id = ptr.getCellRef().getRefId(); return id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker"; } @@ -55,7 +55,7 @@ namespace MWLua // and can be accidentally changed. We use `ptr.getTypeDescription()` only as a fallback // for types that are not present in `luaObjectTypeInfo` (for such types result stability // is not necessary because they are not listed in OpenMW Lua documentation). - if (ptr.getCellRef().getRefIdRef() == "player") + if (ptr.getCellRef().getRefId() == "player") return "Player"; if (isMarker(ptr)) return "Marker"; @@ -64,7 +64,7 @@ namespace MWLua ESM::LuaScriptCfg::Flags getLuaScriptFlag(const MWWorld::Ptr& ptr) { - if (ptr.getCellRef().getRefIdRef() == "player") + if (ptr.getCellRef().getRefId() == "player") return ESM::LuaScriptCfg::sPlayer; if (isMarker(ptr)) return 0; @@ -82,7 +82,7 @@ namespace MWLua res.append(" ("); res.append(getLuaObjectTypeName(ptr)); res.append(", "); - res.append(ptr.getCellRef().getRefIdRef()); + res.append(ptr.getCellRef().getRefId()); res.append(")"); return res; } diff --git a/apps/openmw/mwworld/cellref.hpp b/apps/openmw/mwworld/cellref.hpp index b5e80930ed..455f2d077d 100644 --- a/apps/openmw/mwworld/cellref.hpp +++ b/apps/openmw/mwworld/cellref.hpp @@ -38,9 +38,6 @@ namespace MWWorld // Id of object being referenced const std::string& getRefId() const { return mCellRef.mRefID; } - // Reference to ID of the object being referenced - const std::string& getRefIdRef() const { return mCellRef.mRefID; } // TODO replace with getRefId - // For doors - true if this door teleports to somewhere else, false // if it should open through animation. bool getTeleport() const { return mCellRef.mTeleport; } diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index d020eace45..5f8706a740 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -36,7 +36,7 @@ namespace } bool cont = cell.second.forEach([&] (MWWorld::Ptr ptr) { - if (ptr.getCellRef().getRefIdRef() == id) + if (ptr.getCellRef().getRefId() == id) { return visitor(ptr); } diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 0c871e4f58..3fbfb4d440 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -190,7 +190,7 @@ namespace { for (typename MWWorld::CellRefList::List::iterator iter (collection.mList.begin()); iter!=collection.mList.end(); ++iter) - if (iter->mRef.getRefNum()==state.mRef.mRefNum && iter->mRef.getRefIdRef() == state.mRef.mRefID) + if (iter->mRef.getRefNum()==state.mRef.mRefNum && iter->mRef.getRefId() == state.mRef.mRefID) { // overwrite existing reference float oldscale = iter->mRef.getScale(); @@ -426,7 +426,7 @@ namespace MWWorld const std::string *mIdToFind; bool operator()(const PtrType& ptr) { - if (ptr.getCellRef().getRefIdRef() == *mIdToFind) + if (ptr.getCellRef().getRefId() == *mIdToFind) { mFound = ptr; return false; diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 112f56abfc..18a91707be 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -183,7 +183,7 @@ int MWWorld::ContainerStore::count(const std::string &id) const { int total=0; for (const auto&& iter : *this) - if (Misc::StringUtils::ciEqual(iter.getCellRef().getRefIdRef(), id)) + if (Misc::StringUtils::ciEqual(iter.getCellRef().getRefId(), id)) total += iter.getRefData().getCount(); return total; } @@ -248,7 +248,7 @@ bool MWWorld::ContainerStore::stacks(const ConstPtr& ptr1, const ConstPtr& ptr2) const MWWorld::Class& cls1 = ptr1.getClass(); const MWWorld::Class& cls2 = ptr2.getClass(); - if (!Misc::StringUtils::ciEqual(ptr1.getCellRef().getRefIdRef(), ptr2.getCellRef().getRefIdRef())) + if (!Misc::StringUtils::ciEqual(ptr1.getCellRef().getRefId(), ptr2.getCellRef().getRefId())) return false; // If it has an enchantment, don't stack when some of the charge is already used @@ -363,7 +363,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr, for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter) { - if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefIdRef(), MWWorld::ContainerStore::sGoldId)) + if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId)) { iter->getRefData().setCount(addItems(iter->getRefData().getCount(false), realCount)); flagAsModified(); @@ -464,7 +464,7 @@ int MWWorld::ContainerStore::remove(const std::string& itemId, int count, const int toRemove = count; for (ContainerStoreIterator iter(begin()); iter != end() && toRemove > 0; ++iter) - if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefIdRef(), itemId)) + if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefId(), itemId)) toRemove -= remove(*iter, toRemove, actor, equipReplacement, resolveFirst); flagAsModified(); @@ -739,7 +739,7 @@ MWWorld::Ptr MWWorld::ContainerStore::findReplacement(const std::string& id) for (auto&& iter : *this) { int iterHealth = iter.getClass().hasItemHealth(iter) ? iter.getClass().getItemHealth(iter) : 1; - if (Misc::StringUtils::ciEqual(iter.getCellRef().getRefIdRef(), id)) + if (Misc::StringUtils::ciEqual(iter.getCellRef().getRefId(), id)) { // Prefer the stack with the lowest remaining uses // Try to get item with zero durability only if there are no other items found