Fix major accessory duplication bug. Release Build 8666.
This commit is contained in:
@@ -491,9 +491,7 @@ uint32_t Inventory::GetItemCount(IT it){
|
|||||||
if(!_inventory.count(it)){
|
if(!_inventory.count(it)){
|
||||||
return 0;
|
return 0;
|
||||||
}else
|
}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);
|
auto inventory=_inventory.equal_range(it);
|
||||||
return std::accumulate(inventory.first,inventory.second,0,[](int val,std::pair<IT,std::shared_ptr<Item>>it){return val+(*it.second).Amt();});
|
return std::accumulate(inventory.first,inventory.second,0,[](int val,std::pair<IT,std::shared_ptr<Item>>it){return val+(*it.second).Amt();});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,9 +198,11 @@ void Menu::InitializeMerchantWindow(){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(item.lock()->GetItem().lock()->CanBeSold()){
|
if(item.lock()->GetItem().lock()->CanBeSold()){
|
||||||
|
int inventoryQty=item.lock()->GetItem().lock()->IsEquippable()?1:Inventory::GetItemCount(item.lock()->GetItem().lock()->ActualName());
|
||||||
|
|
||||||
Component<ItemMenuLabel>(SELL_ITEM,"Item Sell Header")->SetItem(item.lock()->GetItem());
|
Component<ItemMenuLabel>(SELL_ITEM,"Item Sell Header")->SetItem(item.lock()->GetItem());
|
||||||
Component<MenuLabel>(SELL_ITEM,"Price per item Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue()));
|
Component<MenuLabel>(SELL_ITEM,"Price per item Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue()));
|
||||||
Component<MenuLabel>(SELL_ITEM,"Amount to sell Amount Label")->SetLabel(std::format("{}/{}",1,Inventory::GetItemCount(item.lock()->GetItem().lock()->ActualName())));
|
Component<MenuLabel>(SELL_ITEM,"Amount to sell Amount Label")->SetLabel(std::format("{}/{}",1,inventoryQty));
|
||||||
Component<MenuLabel>(SELL_ITEM,"Total Price Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue()));
|
Component<MenuLabel>(SELL_ITEM,"Total Price Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue()));
|
||||||
Merchant&merchant=Merchant::GetCurrentTravelingMerchant();
|
Merchant&merchant=Merchant::GetCurrentTravelingMerchant();
|
||||||
bool canPurchase=merchant.CanSellItem(item.lock()->GetItem(),1);
|
bool canPurchase=merchant.CanSellItem(item.lock()->GetItem(),1);
|
||||||
@@ -213,7 +215,6 @@ void Menu::InitializeMerchantWindow(){
|
|||||||
Component<MenuComponent>(SELL_ITEM,"Decrease sell amount Button")->SetGrayedOut(true);
|
Component<MenuComponent>(SELL_ITEM,"Decrease sell amount Button")->SetGrayedOut(true);
|
||||||
|
|
||||||
int qty=1;
|
int qty=1;
|
||||||
int inventoryQty=Inventory::GetItemCount(item.lock()->GetItem().lock()->ActualName());
|
|
||||||
if(qty>=inventoryQty){
|
if(qty>=inventoryQty){
|
||||||
Component<MenuComponent>(SELL_ITEM,"Increase sell amount Button")->SetGrayedOut(true);
|
Component<MenuComponent>(SELL_ITEM,"Increase sell amount Button")->SetGrayedOut(true);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 1
|
#define VERSION_MINOR 1
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 8656
|
#define VERSION_BUILD 8666
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user