Fix Traveling Merchant inventory item references not updating when the traveling merchant is randomized.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/35/head
Nic0Nic0Nii 10 months ago
parent 2b7ebb32cc
commit 1f62a0867a
  1. 11
      Adventures in Lestoria/InventoryCreator.cpp

@ -102,16 +102,9 @@ std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)>
#pragma region Row Merchant Updates
std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)> InventoryCreator::RowMerchant_InventorySlotsUpdate=
[](InventoryScrollableWindowComponent&component,ITCategory cat){
const std::vector<std::shared_ptr<Item>>&merchantInv=Merchant::GetCurrentTravelingMerchant().GetShopItems();
//We only want to refresh the inventory slots if the component count no longer matches what's actually in our inventory.
if(component.components.size()<merchantInv.size()){//We need more space to display our items.
component.RemoveAllComponents();
for(std::shared_ptr<Item> item:merchantInv){
component.AddButtonOnSlotUpdate(cat);
}else
if(component.components.size()>merchantInv.size()){ //There are empty spots, so let's clean up.
component.RemoveAllComponents();
for(std::shared_ptr<Item> item:merchantInv){
component.AddButtonOnSlotUpdate(cat);
}
}
};
std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)> InventoryCreator::RowMerchant_AddButtonOnSlotUpdate=

Loading…
Cancel
Save