mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 03:39:14 +00:00
Fixed issue which may occur if there's no evidence chest nearby
This commit is contained in:
parent
f6deca7c80
commit
ee581f593b
@ -2695,6 +2695,7 @@ namespace MWWorld
|
||||
MWWorld::Ptr closestChest;
|
||||
float closestDistance = FLT_MAX;
|
||||
|
||||
//Find closest stolen_goods chest
|
||||
std::vector<MWWorld::Ptr> chests;
|
||||
mCells.getInteriorPtrs("stolen_goods", chests);
|
||||
|
||||
@ -2712,19 +2713,19 @@ namespace MWWorld
|
||||
}
|
||||
}
|
||||
|
||||
if (!closestChest.isEmpty())
|
||||
if (!closestChest.isEmpty()) //Found a close chest
|
||||
{
|
||||
ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
||||
for (ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||
for (ContainerStoreIterator it = store.begin(); it != store.end(); ++it) //Move all stolen stuff into chest
|
||||
{
|
||||
if (!it->getCellRef().mOwner.empty() && it->getCellRef().mOwner != "player")
|
||||
if (!it->getCellRef().mOwner.empty() && it->getCellRef().mOwner != "player") //Not owned by no one/player?
|
||||
{
|
||||
closestChest.getClass().getContainerStore(closestChest).add(*it, it->getRefData().getCount(), closestChest);
|
||||
store.remove(*it, it->getRefData().getCount(), ptr);
|
||||
}
|
||||
}
|
||||
closestChest.getCellRef().mLockLevel = abs(closestChest.getCellRef().mLockLevel);
|
||||
}
|
||||
closestChest.getCellRef().mLockLevel = abs(closestChest.getCellRef().mLockLevel);
|
||||
}
|
||||
|
||||
void World::goToJail()
|
||||
|
Loading…
Reference in New Issue
Block a user