OpenMW
|
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>
Public Member Functions | |
TradeItemModel (ItemModel *sourceModel, const MWWorld::Ptr &merchant) | |
virtual ItemStack | getItem (ModelIndex index) |
throws for invalid index | |
virtual size_t | getItemCount () |
virtual void | update () |
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. | |
void | abort () |
Aborts trade. | |
std::vector< ItemStack > | getItemsBorrowedToUs () |
Private Member Functions | |
void | borrowImpl (const ItemStack &item, std::vector< ItemStack > &out) |
void | unborrowImpl (const ItemStack &item, size_t count, std::vector< ItemStack > &out) |
Private Attributes | |
std::vector< ItemStack > | mItems |
std::vector< ItemStack > | mBorrowedToUs |
std::vector< ItemStack > | mBorrowedFromUs |
MWWorld::Ptr | mMerchant |
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.
MWGui::TradeItemModel::TradeItemModel | ( | ItemModel * | sourceModel, |
const MWWorld::Ptr & | merchant | ||
) |
void MWGui::TradeItemModel::abort | ( | ) |
Aborts trade.
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 | ||
) |
ItemStack MWGui::TradeItemModel::getItem | ( | ModelIndex | index | ) | [virtual] |
throws for invalid index
Implements MWGui::ItemModel.
size_t MWGui::TradeItemModel::getItemCount | ( | ) | [virtual] |
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] |
Implements MWGui::ItemModel.
std::vector<ItemStack> MWGui::TradeItemModel::mBorrowedFromUs [private] |
std::vector<ItemStack> MWGui::TradeItemModel::mBorrowedToUs [private] |
std::vector<ItemStack> MWGui::TradeItemModel::mItems [private] |
MWWorld::Ptr MWGui::TradeItemModel::mMerchant [private] |