An item model that allows 'borrowing' items from another item model. Used for previewing barter offers. Also filters items that the merchant does not sell.
More...
#include <tradeitemmodel.hpp>
|
| TradeItemModel (ItemModel *sourceModel, const MWWorld::Ptr &merchant) |
|
virtual ItemStack | getItem (ModelIndex index) |
| Throws for invalid index or out of range index. More...
|
|
virtual size_t | getItemCount () |
|
virtual void | update () |
| Rebuild the item model, this will invalidate existing model indices. More...
|
|
void | borrowItemFromUs (ModelIndex itemIndex, size_t count) |
|
void | borrowItemToUs (ModelIndex itemIndex, ItemModel *source, size_t count) |
|
void | returnItemBorrowedToUs (ModelIndex itemIndex, size_t count) |
|
void | returnItemBorrowedFromUs (ModelIndex itemIndex, ItemModel *source, size_t count) |
|
void | transferItems () |
| Permanently transfers items that were borrowed to us from another model to this model. More...
|
|
void | abort () |
| Aborts trade. More...
|
|
void | adjustEncumbrance (float &encumbrance) |
|
std::vector< ItemStack > | getItemsBorrowedToUs () |
|
| ProxyItemModel () |
|
virtual | ~ProxyItemModel () |
|
virtual MWWorld::Ptr | copyItem (const ItemStack &item, size_t count, bool setNewOwner=false) |
|
virtual void | removeItem (const ItemStack &item, size_t count) |
|
virtual ModelIndex | getIndex (ItemStack item) |
| Returns an invalid index if the item was not found. More...
|
|
void | setSourceModel (ItemModel *sourceModel) |
|
ModelIndex | mapToSource (ModelIndex index) |
|
ModelIndex | mapFromSource (ModelIndex index) |
|
| ItemModel () |
|
virtual | ~ItemModel () |
|
virtual MWWorld::Ptr | moveItem (const ItemStack &item, size_t count, ItemModel *otherModel) |
|
virtual bool | allowedToInsertItems () const |
| Is the player allowed to insert items into this model? (default true) More...
|
|
An item model that allows 'borrowing' items from another item model. Used for previewing barter offers. Also filters items that the merchant does not sell.
void MWGui::TradeItemModel::abort |
( |
| ) |
|
void MWGui::TradeItemModel::adjustEncumbrance |
( |
float & |
encumbrance | ) |
|
Adjusts the given encumbrance by adding weight for items that have been lent to us, and removing weight for items we've lent to someone else.
void MWGui::TradeItemModel::borrowImpl |
( |
const ItemStack & |
item, |
|
|
std::vector< ItemStack > & |
out |
|
) |
| |
|
private |
void MWGui::TradeItemModel::borrowItemFromUs |
( |
ModelIndex |
itemIndex, |
|
|
size_t |
count |
|
) |
| |
void MWGui::TradeItemModel::borrowItemToUs |
( |
ModelIndex |
itemIndex, |
|
|
ItemModel * |
source, |
|
|
size_t |
count |
|
) |
| |
- Note
- itemIndex points to an item in source
size_t MWGui::TradeItemModel::getItemCount |
( |
| ) |
|
|
virtual |
The number of items in the model, this specifies the range of indices you can pass to the getItem function (but this range is only valid until the next call to update())
Implements MWGui::ItemModel.
std::vector< ItemStack > MWGui::TradeItemModel::getItemsBorrowedToUs |
( |
| ) |
|
void MWGui::TradeItemModel::returnItemBorrowedFromUs |
( |
ModelIndex |
itemIndex, |
|
|
ItemModel * |
source, |
|
|
size_t |
count |
|
) |
| |
void MWGui::TradeItemModel::returnItemBorrowedToUs |
( |
ModelIndex |
itemIndex, |
|
|
size_t |
count |
|
) |
| |
void MWGui::TradeItemModel::transferItems |
( |
| ) |
|
Permanently transfers items that were borrowed to us from another model to this model.
void MWGui::TradeItemModel::unborrowImpl |
( |
const ItemStack & |
item, |
|
|
size_t |
count, |
|
|
std::vector< ItemStack > & |
out |
|
) |
| |
|
private |
void MWGui::TradeItemModel::update |
( |
| ) |
|
|
virtual |
Rebuild the item model, this will invalidate existing model indices.
Implements MWGui::ItemModel.
std::vector<ItemStack> MWGui::TradeItemModel::mBorrowedFromUs |
|
private |
std::vector<ItemStack> MWGui::TradeItemModel::mBorrowedToUs |
|
private |
std::vector<ItemStack> MWGui::TradeItemModel::mItems |
|
private |
The documentation for this class was generated from the following files: