mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-07 13:20:25 +00:00
NPC now doesn't buy items of types that he shouldn't accept.
This commit is contained in:
parent
50a8eb05d9
commit
342a244e31
@ -123,6 +123,18 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
|
|||||||
MWWorld::Ptr object = (*_sender->getUserData<MWWorld::Ptr>());
|
MWWorld::Ptr object = (*_sender->getUserData<MWWorld::Ptr>());
|
||||||
int count = object.getRefData().getCount();
|
int count = object.getRefData().getCount();
|
||||||
|
|
||||||
|
if (isInventory())
|
||||||
|
{
|
||||||
|
// the player is trying to sell an item, check if the merchant accepts it
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object))
|
||||||
|
{
|
||||||
|
// user notification "i don't buy this item"
|
||||||
|
MWBase::Environment::get().getWindowManager()->
|
||||||
|
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog4")->str, std::vector<std::string>());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (std::find(mBoughtItems.begin(), mBoughtItems.end(), object) != mBoughtItems.end())
|
if (std::find(mBoughtItems.begin(), mBoughtItems.end(), object) != mBoughtItems.end())
|
||||||
{
|
{
|
||||||
if (MyGUI::InputManager::getInstance().isShiftPressed() || count == 1)
|
if (MyGUI::InputManager::getInstance().isShiftPressed() || count == 1)
|
||||||
|
@ -92,11 +92,14 @@ namespace MWGui
|
|||||||
|
|
||||||
void InventoryWindow::openInventory()
|
void InventoryWindow::openInventory()
|
||||||
{
|
{
|
||||||
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
|
|
||||||
|
|
||||||
updateEncumbranceBar();
|
updateEncumbranceBar();
|
||||||
|
|
||||||
mTrading = false;
|
mTrading = false;
|
||||||
|
|
||||||
|
mBoughtItems.clear();
|
||||||
|
mSoldItems.clear();
|
||||||
|
|
||||||
|
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::onWindowResize(MyGUI::Window* _sender)
|
void InventoryWindow::onWindowResize(MyGUI::Window* _sender)
|
||||||
@ -252,7 +255,5 @@ namespace MWGui
|
|||||||
void InventoryWindow::startTrade()
|
void InventoryWindow::startTrade()
|
||||||
{
|
{
|
||||||
mTrading = true;
|
mTrading = true;
|
||||||
mBoughtItems.clear();
|
|
||||||
mSoldItems.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user