Add searchByRefNum method to OpenMW's CellStore

This commit is contained in:
David Cernat 2016-10-22 16:47:11 +03:00
parent 92463c4a03
commit cc98a25dcf
3 changed files with 17 additions and 2 deletions

View file

@ -654,9 +654,13 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum);
//MWWorld::Ptr object = ptrCellStore->search(event->cellRef.mRefID);
MWWorld::Ptr ptrFound = ptrCellStore->searchByRefNum(event->cellRef.mRefNum);
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Found %s, %i",
ptrFound.getCellRef().getRefId().c_str(),
ptrFound.getCellRef().getRefNum());
//MWBase::Environment::get().getWorld()->deleteObject(object);
break;
}

View file

@ -433,6 +433,14 @@ namespace MWWorld
return Ptr();
}
// Added by tes3mp
Ptr CellStore::searchByRefNum (ESM::RefNum refNum)
{
SearchByRefNumVisitor searchVisitor(refNum);
forEach(searchVisitor);
return searchVisitor.mFound;
}
float CellStore::getWaterLevel() const
{
if (isExterior())

View file

@ -228,6 +228,9 @@ namespace MWWorld
Ptr searchViaActorId (int id);
///< Will return an empty Ptr if cell is not loaded.
Ptr searchByRefNum (ESM::RefNum refNum);
///< Added by tes3mp
float getWaterLevel() const;
void setWaterLevel (float level);