forked from teamnwah/openmw-tes3coop
[Client] Prevent players from getting stuck in drag and drop when their opened containers are deleted
This commit is contained in:
parent
20a72ec807
commit
ec921eefc8
1 changed files with 14 additions and 1 deletions
|
@ -115,7 +115,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
|
|||
CurrentContainer *currentContainer = &mwmp::Main::get().getLocalPlayer()->currentContainer;
|
||||
|
||||
if (currentContainer->refNumIndex == ptrFound.getCellRef().getRefNum().mIndex &&
|
||||
Misc::StringUtils::ciEqual(currentContainer->refId, ptrFound.getCellRef().getRefId()))
|
||||
currentContainer->mpNum == ptrFound.getCellRef().getMpNum())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container);
|
||||
MWBase::Environment::get().getWindowManager()->openContainer(ptrFound, currentContainer->loot);
|
||||
|
@ -179,6 +179,19 @@ void WorldEvent::deleteObjects(MWWorld::CellStore* cellStore)
|
|||
LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum());
|
||||
|
||||
// If we are in a container, and it happens to be this object, exit it
|
||||
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Container))
|
||||
{
|
||||
CurrentContainer *currentContainer = &mwmp::Main::get().getLocalPlayer()->currentContainer;
|
||||
|
||||
if (currentContainer->refNumIndex == ptrFound.getCellRef().getRefNum().mIndex &&
|
||||
currentContainer->mpNum == ptrFound.getCellRef().getMpNum())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container);
|
||||
MWBase::Environment::get().getWindowManager()->setDragDrop(false);
|
||||
}
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getWorld()->deleteObject(ptrFound);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue