diff --git a/Adventures in Lestoria/Item.cpp b/Adventures in Lestoria/Item.cpp index 815770c6..ccf32d53 100644 --- a/Adventures in Lestoria/Item.cpp +++ b/Adventures in Lestoria/Item.cpp @@ -491,9 +491,7 @@ uint32_t Inventory::GetItemCount(IT it){ if(!_inventory.count(it)){ return 0; }else - if(ITEM_DATA.at(it).IsAccessory()){ - return 1; //We always only have 1 of any given accessory. - }else{ + { auto inventory=_inventory.equal_range(it); return std::accumulate(inventory.first,inventory.second,0,[](int val,std::pair>it){return val+(*it.second).Amt();}); } diff --git a/Adventures in Lestoria/MerchantWindow.cpp b/Adventures in Lestoria/MerchantWindow.cpp index e01be553..c303565e 100644 --- a/Adventures in Lestoria/MerchantWindow.cpp +++ b/Adventures in Lestoria/MerchantWindow.cpp @@ -198,9 +198,11 @@ void Menu::InitializeMerchantWindow(){ return true; } if(item.lock()->GetItem().lock()->CanBeSold()){ + int inventoryQty=item.lock()->GetItem().lock()->IsEquippable()?1:Inventory::GetItemCount(item.lock()->GetItem().lock()->ActualName()); + Component(SELL_ITEM,"Item Sell Header")->SetItem(item.lock()->GetItem()); Component(SELL_ITEM,"Price per item Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue())); - Component(SELL_ITEM,"Amount to sell Amount Label")->SetLabel(std::format("{}/{}",1,Inventory::GetItemCount(item.lock()->GetItem().lock()->ActualName()))); + Component(SELL_ITEM,"Amount to sell Amount Label")->SetLabel(std::format("{}/{}",1,inventoryQty)); Component(SELL_ITEM,"Total Price Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue())); Merchant&merchant=Merchant::GetCurrentTravelingMerchant(); bool canPurchase=merchant.CanSellItem(item.lock()->GetItem(),1); @@ -213,7 +215,6 @@ void Menu::InitializeMerchantWindow(){ Component(SELL_ITEM,"Decrease sell amount Button")->SetGrayedOut(true); int qty=1; - int inventoryQty=Inventory::GetItemCount(item.lock()->GetItem().lock()->ActualName()); if(qty>=inventoryQty){ Component(SELL_ITEM,"Increase sell amount Button")->SetGrayedOut(true); }else{ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 6d9ca67e..e646d042 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 1 #define VERSION_PATCH 0 -#define VERSION_BUILD 8656 +#define VERSION_BUILD 8666 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 2a0b3dcb..739f7af7 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ