You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
#ifndef MWGUI_CONTAINER_ITEM_MODEL_H
|
|
#define MWGUI_CONTAINER_ITEM_MODEL_H
|
|
|
|
#include "itemmodel.hpp"
|
|
|
|
namespace MWGui
|
|
{
|
|
|
|
/// @brief The container item model supports multiple item sources, which are needed for
|
|
/// making NPCs sell items from containers owned by them
|
|
class ContainerItemModel : public ItemModel
|
|
{
|
|
public:
|
|
ContainerItemModel (const std::vector<MWWorld::Ptr>& itemSources, const std::vector<MWWorld::Ptr>& worldItems);
|
|
///< @note The order of elements \a itemSources matters here. The first element has the highest priority for removal,
|
|
/// while the last element will be used to add new items to.
|
|
|
|
ContainerItemModel (const MWWorld::Ptr& source);
|
|
|
|
virtual ItemStack getItem (ModelIndex index);
|
|
virtual ModelIndex getIndex (ItemStack item);
|
|
virtual size_t getItemCount();
|
|
|
|
virtual MWWorld::Ptr copyItem (const ItemStack& item, size_t count, bool setNewOwner=false);
|
|
virtual void removeItem (const ItemStack& item, size_t count);
|
|
|
|
virtual void update();
|
|
|
|
private:
|
|
std::vector<MWWorld::Ptr> mItemSources;
|
|
std::vector<MWWorld::Ptr> mWorldItems;
|
|
|
|
std::vector<ItemStack> mItems;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|