Allow changing maxBuyCount
This commit is contained in:
parent
de642ab8bf
commit
e875d5fccd
@ -38,6 +38,8 @@ MerchantPane::MerchantPane(
|
|||||||
|
|
||||||
m_itemBag = make_shared<ItemBag>(m_settings.getUInt("sellContainerSize"));
|
m_itemBag = make_shared<ItemBag>(m_settings.getUInt("sellContainerSize"));
|
||||||
|
|
||||||
|
m_maxBuyCount = m_settings.getUInt("maxBuyCount");
|
||||||
|
|
||||||
GuiReader reader;
|
GuiReader reader;
|
||||||
reader.registerCallback("spinCount.up", [=](Widget*) {
|
reader.registerCallback("spinCount.up", [=](Widget*) {
|
||||||
if (m_selectedIndex != NPos) {
|
if (m_selectedIndex != NPos) {
|
||||||
@ -360,8 +362,8 @@ int MerchantPane::maxBuyCount() {
|
|||||||
auto assets = Root::singleton().assets();
|
auto assets = Root::singleton().assets();
|
||||||
auto unitPrice = selected->data().toUInt();
|
auto unitPrice = selected->data().toUInt();
|
||||||
if (unitPrice == 0)
|
if (unitPrice == 0)
|
||||||
return 1000;
|
return m_maxBuyCount;
|
||||||
return min(1000, (int)floor(m_player->currency("money") / unitPrice));
|
return min(m_maxBuyCount, (int)floor(m_player->currency("money") / unitPrice));
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user