| 358 | } |
| 359 | |
| 360 | int 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 | |
| 372 | void MerchantPane::countChanged() { |
| 373 | m_countTextBox->setText(strf("x{}", m_buyCount)); |