Fix Traveling Merchant inventory item references not updating when the traveling merchant is randomized.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
2b7ebb32cc
commit
1f62a0867a
@ -102,17 +102,10 @@ std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)>
|
|||||||
#pragma region Row Merchant Updates
|
#pragma region Row Merchant Updates
|
||||||
std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)> InventoryCreator::RowMerchant_InventorySlotsUpdate=
|
std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)> InventoryCreator::RowMerchant_InventorySlotsUpdate=
|
||||||
[](InventoryScrollableWindowComponent&component,ITCategory cat){
|
[](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.AddButtonOnSlotUpdate(cat);
|
|
||||||
}else
|
|
||||||
if(component.components.size()>merchantInv.size()){ //There are empty spots, so let's clean up.
|
|
||||||
component.RemoveAllComponents();
|
component.RemoveAllComponents();
|
||||||
for(std::shared_ptr<Item> item:merchantInv){
|
for(std::shared_ptr<Item> item:merchantInv){
|
||||||
component.AddButtonOnSlotUpdate(cat);
|
component.AddButtonOnSlotUpdate(cat);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)> InventoryCreator::RowMerchant_AddButtonOnSlotUpdate=
|
std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)> InventoryCreator::RowMerchant_AddButtonOnSlotUpdate=
|
||||||
[](InventoryScrollableWindowComponent&component,ITCategory cat){
|
[](InventoryScrollableWindowComponent&component,ITCategory cat){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user