1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Merge remote-tracking branch 'ragora/conjuredequipmentrmvalfix'

This commit is contained in:
Marc Zinnschlag 2014-09-12 14:22:24 +02:00
commit 560eae3f4d
4 changed files with 33 additions and 9 deletions

View File

@ -50,6 +50,13 @@ void CompanionWindow::onItemSelected(int index)
const ItemStack& item = mSortModel->getItem(index);
// We can't take conjured items from a companion NPC
if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
return;
}
MWWorld::Ptr object = item.mBase;
int count = item.mCount;
bool shift = MyGUI::InputManager::getInstance().isShiftPressed();

View File

@ -113,6 +113,13 @@ namespace MWGui
std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
// We can't drop a conjured item to the ground; the target container should always be the source container
if (mItem.mBase.getCellRef().getRefId().size() > 6 && mItem.mBase.getCellRef().getRefId().substr(0,6) == "bound_" && targetModel != mSourceModel)
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
return;
}
// If item is dropped where it was taken from, we don't need to do anything -
// otherwise, do the transfer
if (targetModel != mSourceModel)
@ -176,6 +183,13 @@ namespace MWGui
const ItemStack& item = mSortModel->getItem(index);
// We can't take a conjured item from a container (some NPC we're pickpocketing, a box, etc)
if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sContentsMessage1}");
return;
}
MWWorld::Ptr object = item.mBase;
int count = item.mCount;
bool shift = MyGUI::InputManager::getInstance().isShiftPressed();

View File

@ -61,6 +61,10 @@ void InventoryItemModel::removeItem (const ItemStack& item, size_t count)
MWWorld::Ptr InventoryItemModel::moveItem(const ItemStack &item, size_t count, ItemModel *otherModel)
{
// Can't move conjured items: This is a general fix that also takes care of issues with taking conjured items via the 'Take All' button.
if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
return MWWorld::Ptr();
bool setNewOwner = false;
// Are you dead? Then you wont need that anymore

View File

@ -183,21 +183,20 @@ namespace MWGui
MWWorld::Ptr object = item.mBase;
int count = item.mCount;
// Bound items may not be moved
if (item.mBase.getCellRef().getRefId().size() > 6
&& item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
{
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
return;
}
bool shift = MyGUI::InputManager::getInstance().isShiftPressed();
if (MyGUI::InputManager::getInstance().isControlPressed())
count = 1;
if (mTrading)
{
// Can't give cojured items to a merchant
if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
{
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog9}");
return;
}
// check if merchant accepts item
int services = MWBase::Environment::get().getWindowManager()->getTradeWindow()->getMerchantServices();
if (!object.getClass().canSell(object, services))