Item reference system deprecated in favor of smart pointer system. Converted all items to use pointers instead, removed all reference wrappers for item system. Fixed buggy last item sorting when removing items from InventoryScrollableWindowComponents. Implemented proper inventory removal checks when items are completely removed from an inventory. Sorted inventories now copy the pointer as a shared pointer from the main inventory code instead of needlessly creating extra copies of the same item.
This commit is contained in:
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
|
||||
virtual inline void OnInventorySlotsUpdate(ITCategory cat)override{
|
||||
const std::vector<Item>&merchantInv=Merchant::GetCurrentTravelingMerchant().GetShopItems();
|
||||
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(components.size()<merchantInv.size()){//We need more space to display our items.
|
||||
AddButtonOnSlotUpdate(cat);
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
}
|
||||
|
||||
virtual inline void AddButtonOnSlotUpdate(ITCategory cat)override{
|
||||
const std::vector<Item>&merchantInv=Merchant::GetCurrentTravelingMerchant().GetShopItems();
|
||||
const std::vector<std::shared_ptr<Item>>&merchantInv=Merchant::GetCurrentTravelingMerchant().GetShopItems();
|
||||
size_t invSize=merchantInv.size();
|
||||
int invWidth=int(rect.size.x/(float(options.size.x)+options.padding));
|
||||
int x=int((invSize-1)%invWidth);
|
||||
|
||||
Reference in New Issue
Block a user