MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / maxBuyCount

Method maxBuyCount

source/frontend/StarMerchantInterface.cpp:360–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360int MerchantPane::maxBuyCount() {
361 if (auto selected = m_itemGuiList->selectedWidget()) {
362 auto assets = Root::singleton().assets();
363 auto unitPrice = selected->data().toUInt();
364 if (unitPrice == 0)
365 return m_maxBuyCount;
366 return min(m_maxBuyCount, (int)floor(m_player->currency("money") / unitPrice));
367 } else {
368 return 0;
369 }
370}
371
372void MerchantPane::countChanged() {
373 m_countTextBox->setText(strf("x{}", m_buyCount));

Callers

nothing calls this directly

Calls 6

singletonClass · 0.85
selectedWidgetMethod · 0.80
assetsMethod · 0.80
toUIntMethod · 0.80
dataMethod · 0.45
currencyMethod · 0.45

Tested by

no test coverage detected