40 instArr->removeAll(
this);
43 if(instArr->empty()) {
66 instArr->append(
this);
139 _isMoneyCurrency =
true;
146 return _isMoneyCurrency && _isBuyMode;
172 if(el->whichType() == myType)
173 ret += el->stackCount();
194 ret += el->cartSignVal * el->cartWorth();
204 const int start = (*isMoneyCurrency) ? (int)
player->money : (int)
player->coins;
224 if(el->canCheckout())
257 QHash<QString, QVector<ItemMarketEntry*>*>();
260 QVector<ItemMarketEntry*>();
virtual QString _name()=0
Subtype: compute the display name.
ItemMarketEntry(int compatMoneyCurrency=CompatEither, int compatBuyMode=CompatEither)
int totalStackCount()
Stacks across all rows of this type.
int moneyLeftover()
Money remaining if this checks out.
static QVector< ItemMarketEntry * > * activeList
Current model's live rows.
void reUpdateConstants()
Clear the cached mode-stable values.
bool requestFilter()
Helper: does this row pass the current mode filter?
QString name()
Cached display name.
virtual QString _whichType()=0
Subtype: report the type label.
static QHash< QString, QVector< ItemMarketEntry * > * > instances
All rows, grouped by type.
int compatBuyMode
Buy/sell compatibility.
QString whichType()
Cached type label.
static bool * isMoneyCurrency
Shared: current currency mode.
int itemWorth()
Cached unit value.
static PlayerBasics * player
Shared: player money/coins.
QHash< int, QVariant > cache
Memoised mode-stable values (see HashKey* enum).
void setCartCount(int val)
Set the cart quantity (backs onCart).
int totalWorth()
Signed worth across ALL rows (sell +, buy -).
void finishConstruction()
Finalise construction (register the instance).
int inStockCount()
Cached owned/sellable count.
virtual int _itemWorth()=0
Subtype: compute the unit value.
virtual int _inStockCount()=0
Subtype: compute the owned/sellable count.
static QVector< ItemMarketEntry * > instancesCombined
All rows, flat.
virtual ~ItemMarketEntry()
virtual bool _canSell()=0
Subtype: compute sellability.
void doReUpdateConstants()
Force a refresh of the "mode-stable" values.
int onCart
Backing cart quantity.
int compatMoneyCurrency
Money/coins compatibility.
virtual void initOnce()
One-time setup for the first instance of a type.
bool canAnyCheckout()
Can any row check out?
int cartWorth()
Value of the cart quantity.
static bool * isBuyMode
Shared: current buy/sell mode.
bool canSell()
Cached sellable flag.
int getCartCount()
Current cart quantity (backs onCart).
virtual int onCartLeft()=0
Subtype: how many more may be added.
virtual bool canCheckout()
Can this row alone check out?
The trainer's headline values: name, ID, money, coins, badges, starter.