Corrected GetInventorySlot() to return actual slot when there are multiple unique instances of an item instead of just the first index.
This commit is contained in:
@@ -169,7 +169,12 @@ void Menu::InitializeCharacterMenuWindow(){
|
||||
for(const std::string&attribute:displayAttrs){
|
||||
statsBeforeEquip.push_back(game->GetPlayer()->GetStat(attribute));
|
||||
}
|
||||
|
||||
std::weak_ptr<Item>equippedItem=Inventory::GetEquip(slot);
|
||||
std::weak_ptr<Item>otherItem;
|
||||
if(slot==EquipSlot::RING1)otherItem=Inventory::GetEquip(EquipSlot::RING2);
|
||||
else
|
||||
if(slot==EquipSlot::RING2)otherItem=Inventory::GetEquip(EquipSlot::RING1);
|
||||
Inventory::EquipItem(buttonItem,slot);
|
||||
for(int counter=0;const std::string&attribute:displayAttrs){
|
||||
StatLabel*statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute).Name())+" Label");
|
||||
@@ -181,6 +186,11 @@ void Menu::InitializeCharacterMenuWindow(){
|
||||
if(!ISBLANK(equippedItem)){
|
||||
Inventory::EquipItem(equippedItem,slot);
|
||||
}
|
||||
if(!ISBLANK(otherItem)){
|
||||
if(slot==EquipSlot::RING1)Inventory::EquipItem(otherItem,EquipSlot::RING2);
|
||||
else
|
||||
if(slot==EquipSlot::RING2)Inventory::EquipItem(otherItem,EquipSlot::RING1);
|
||||
}
|
||||
}else{
|
||||
ERR("WARNING! Attempting to cast a button that isn't a RowItemDisplay!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user