diff --git a/Adventures in Lestoria/InventoryCreator.cpp b/Adventures in Lestoria/InventoryCreator.cpp index dd45d6e7..edc88a95 100644 --- a/Adventures in Lestoria/InventoryCreator.cpp +++ b/Adventures in Lestoria/InventoryCreator.cpp @@ -139,15 +139,13 @@ std::function #pragma region Row Player Weapons Updates std::function InventoryCreator::RowPlayerWeapons_InventorySlotsUpdate= [](InventoryScrollableWindowComponent&component,ITCategory cat){ - std::vector>weapons; - std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(weapons),[](std::weak_ptr item){return item.lock()->IsWeapon();}); component.RemoveAllComponents(); component.AddButtonOnSlotUpdate(cat); }; std::function InventoryCreator::RowPlayerWeapons_AddButtonOnSlotUpdate= [](InventoryScrollableWindowComponent&component,ITCategory cat){ std::vector>weapons; - std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(weapons),[](std::weak_ptr item){return item.lock()->IsWeapon();}); + std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(weapons),[](std::shared_ptritem){return item->IsWeapon();}); RowInventoryScrollableWindowComponent*c=DYNAMIC_CAST(&component); @@ -173,15 +171,13 @@ std::function #pragma region Row Player Armor Updates std::function InventoryCreator::RowPlayerArmor_InventorySlotsUpdate= [](InventoryScrollableWindowComponent&component,ITCategory cat){ - std::vector>armor; - std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(armor),[](std::weak_ptr item){return item.lock()->IsArmor();}); component.RemoveAllComponents(); component.AddButtonOnSlotUpdate(cat); }; std::function InventoryCreator::RowPlayerArmor_AddButtonOnSlotUpdate= [](InventoryScrollableWindowComponent&component,ITCategory cat){ std::vector>armor; - std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(armor),[](std::weak_ptr item){return item.lock()->IsArmor();}); + std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(armor),[](std::shared_ptritem){return item->IsArmor();}); RowInventoryScrollableWindowComponent*c=DYNAMIC_CAST(&component); diff --git a/Adventures in Lestoria/Menu.h b/Adventures in Lestoria/Menu.h index 0b69440e..90282157 100644 --- a/Adventures in Lestoria/Menu.h +++ b/Adventures in Lestoria/Menu.h @@ -142,7 +142,6 @@ public: component->name=componentKey; components.Unlock(); //It's possible we can add a component later on, so we will make sure we remove the lock first. components[componentKey]=component; - std::cout<ptr){return &*ptr.lock()==&*button.lock();}); if(componentSearchResults==components.end())ERR("Could not find Component"<GetName())<<" inside the component list!"); components.erase(componentSearchResults); - Menu::menus[button.lock()->parentMenu]->RecalculateComponentCount(); + size_t removedCount=0; + + MenuType parentMenu=button.lock()->parentMenu; + + removedCount+=Menu::menus[parentMenu]->components.erase(button.lock()->GetName()); + if(removedCount!=1){ + std::cout<<"WARNING! Attempted to remove buttons from button listing, but not found!"; + } + Menu::menus[parentMenu]->RecalculateComponentCount(); CalculateBounds(); } virtual inline void SetScrollAmount(vf2d scrollOffset){ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index e4027efa..e12e6f73 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 5939 +#define VERSION_BUILD 5944 #define stringify(a) stringify_(a) #define stringify_(a) #a