diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index c3f2dca42..6be2075c4 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -168,6 +168,30 @@ namespace return true; } }; + + // Added by tes3mp + template + struct SearchByRefNumCustomVisitor + { + PtrType mFound; + ESM::RefNum mRefNumToFind; + + SearchByRefNumCustomVisitor(const ESM::RefNum& toFind) + : mFound(NULL) + , mRefNumToFind(toFind) + { + } + + bool operator()(const PtrType& ptr) + { + if (ptr.getCellRef().getRefNum() == mRefNumToFind) + { + mFound = ptr; + return false; + } + return true; + } + }; } namespace MWWorld @@ -436,7 +460,7 @@ namespace MWWorld // Added by tes3mp Ptr CellStore::searchByRefNum (ESM::RefNum refNum) { - SearchByRefNumVisitor searchVisitor(refNum); + SearchByRefNumCustomVisitor searchVisitor(refNum); forEach(searchVisitor); return searchVisitor.mFound; }