|
|
|
@ -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= |
|
|
|
|