mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Add ItemModel::allowedToInsertItems
This commit is contained in:
parent
373c1e7602
commit
763f647412
5 changed files with 17 additions and 2 deletions
|
@ -57,7 +57,7 @@ namespace MWGui
|
|||
{
|
||||
if (mDragAndDrop->mIsOnDragAndDrop)
|
||||
{
|
||||
if (!dynamic_cast<PickpocketItemModel*>(mModel))
|
||||
if (mModel && mModel->allowedToInsertItems())
|
||||
dropItem();
|
||||
return;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ namespace MWGui
|
|||
|
||||
void ContainerWindow::onBackgroundSelected()
|
||||
{
|
||||
if (mDragAndDrop->mIsOnDragAndDrop && !dynamic_cast<PickpocketItemModel*>(mModel))
|
||||
if (mDragAndDrop->mIsOnDragAndDrop && mModel && mModel->allowedToInsertItems())
|
||||
dropItem();
|
||||
}
|
||||
|
||||
|
|
|
@ -119,6 +119,11 @@ namespace MWGui
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool ItemModel::allowedToInsertItems() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
ProxyItemModel::ProxyItemModel()
|
||||
: mSourceModel(NULL)
|
||||
|
|
|
@ -70,6 +70,9 @@ namespace MWGui
|
|||
virtual MWWorld::Ptr copyItem (const ItemStack& item, size_t count, bool setNewOwner=false) = 0;
|
||||
virtual void removeItem (const ItemStack& item, size_t count) = 0;
|
||||
|
||||
/// Is the player allowed to insert items into this model? (default true)
|
||||
virtual bool allowedToInsertItems() const;
|
||||
|
||||
private:
|
||||
ItemModel(const ItemModel&);
|
||||
ItemModel& operator=(const ItemModel&);
|
||||
|
|
|
@ -64,4 +64,10 @@ namespace MWGui
|
|||
/// \todo check if player is detected
|
||||
}
|
||||
|
||||
bool PickpocketItemModel::allowedToInsertItems() const
|
||||
{
|
||||
// don't allow "reverse pickpocket" (yet)
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace MWGui
|
|||
virtual size_t getItemCount();
|
||||
virtual void update();
|
||||
virtual void removeItem (const ItemStack& item, size_t count);
|
||||
virtual bool allowedToInsertItems() const;
|
||||
|
||||
private:
|
||||
std::vector<ItemStack> mHiddenItems;
|
||||
|
|
Loading…
Reference in a new issue