1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

fixed another item dropping bug

This commit is contained in:
scrawl 2012-05-15 23:28:04 +02:00
parent 0f811edb47
commit 477f1b42ab
5 changed files with 23 additions and 2 deletions

View file

@ -118,6 +118,17 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
containerStore.add(object);
object.getRefData().setCount (origCount - mDragAndDrop->mDraggedCount);
}
else
{
// check that we don't exceed the allowed weight (only for containers, not for inventory)
if (isInventory())
{
float curWeight = MWWorld::Class::get(mContainer).getEncumbrance(mContainer);
float capacity = MWWorld::Class::get(mContainer).getCapacity(mContainer);
}
}
mDragAndDrop->mIsOnDragAndDrop = false;
MyGUI::Gui::getInstance().destroyWidget(mDragAndDrop->mDraggedWidget);

View file

@ -77,7 +77,7 @@ namespace MWGui
void openContainer(MWWorld::Ptr container);
void setFilter(Filter filter); ///< set category filter
void Update();
virtual void Update();
void drawItems();
virtual void notifyContentChanged() { }

View file

@ -269,6 +269,9 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender)
float mouseX = cursorPosition.left / float(viewSize.width);
float mouseY = cursorPosition.top / float(viewSize.height);
int origCount = object.getRefData().getCount();
object.getRefData().setCount(mDragAndDrop->mDraggedCount);
if (world->canPlaceObject(mouseX, mouseY))
world->placeObject(object, mouseX, mouseY);
else
@ -280,7 +283,7 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender)
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
// remove object from the container it was coming from
object.getRefData().setCount(object.getRefData().getCount() - mDragAndDrop->mDraggedCount);
object.getRefData().setCount(origCount - mDragAndDrop->mDraggedCount);
mDragAndDrop->mDraggedFrom->notifyContentChanged();
mDragAndDrop->mIsOnDragAndDrop = false;

View file

@ -242,7 +242,13 @@ namespace MWGui
}
void InventoryWindow::notifyContentChanged()
{
}
void InventoryWindow::Update()
{
updateEncumbranceBar();
ContainerBase::Update();
}
}

View file

@ -30,6 +30,7 @@ namespace MWGui
void openInventory();
virtual void Update();
virtual void notifyContentChanged();
protected: