mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 06:55:54 -04:00
[Client] Don't crash when dying while inside a container
This commit is contained in:
parent
443c0ed309
commit
90275f777e
@ -70,15 +70,20 @@ void mwmp::WorldController::closeContainer(const MWWorld::Ptr &container)
|
|||||||
{
|
{
|
||||||
mwmp::Main::get().getLocalPlayer()->clearCurrentContainer();
|
mwmp::Main::get().getLocalPlayer()->clearCurrentContainer();
|
||||||
|
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is closed.",
|
// If the player died while in a container, the container's Ptr could be invalid now
|
||||||
container.getCellRef().getRefId().c_str(),
|
if (!container.isEmpty())
|
||||||
container.getCellRef().getRefNum().mIndex);
|
|
||||||
|
|
||||||
MWWorld::ContainerStore &cont = container.getClass().getContainerStore(container);
|
|
||||||
for (MWWorld::ContainerStoreIterator iter = cont.begin(); iter != cont.end(); iter++)
|
|
||||||
{
|
{
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d",
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is closed.",
|
||||||
iter->getCellRef().getRefId().c_str(), iter->getRefData().getCount());
|
container.getCellRef().getRefId().c_str(),
|
||||||
|
container.getCellRef().getRefNum().mIndex);
|
||||||
|
|
||||||
|
MWWorld::ContainerStore &cont = container.getClass().getContainerStore(container);
|
||||||
|
for (MWWorld::ContainerStoreIterator iter = cont.begin(); iter != cont.end(); iter++)
|
||||||
|
{
|
||||||
|
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d",
|
||||||
|
iter->getCellRef().getRefId().c_str(), iter->getRefData().getCount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mwmp::Main::get().getLocalPlayer()->updateInventory();
|
mwmp::Main::get().getLocalPlayer()->updateInventory();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user