Fully implemented controller/keyboard controls for Inventory Consumable Window. Fix bug with loadout items that were set during file loads were not selected in consumable window. Release Build 6907.
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
}elseERR(std::format("WARNING! Could not find item {} in inventory while deselecting a loadout item from the consumables menu! THIS SHOULD NOT BE HAPPENING!",loadout[slot]->ActualName()));
}
loadout[slot]=Inventory::CopyItem(itemName)[0];
loadout[slot]=Inventory::CopyItem(itemName)[0];
GetLoadoutItem(slot).lock()->amt=std::min((uint32_t)"Player.Item Loadout Limit"_I,GetLoadoutItem(slot).lock()->Amt());//We are only allowed to have up to 10 maximum of an item on a journey.
GetLoadoutItem(slot).lock()->amt=std::min((uint32_t)"Player.Item Loadout Limit"_I,GetLoadoutItem(slot).lock()->Amt());//We are only allowed to have up to 10 maximum of an item on a journey.
}elseERR(std::format("WARNING! Could not find item {} in inventory while selecting a loadout item from the consumables menu! THIS SHOULD NOT BE HAPPENING!",loadout[slot]->ActualName()));
}else{
}else{
ERR("Trying to set item "+itemName+" in Loadout slot "+std::to_string(slot)+" when said item does not exist in our inventory!");
ERR("Trying to set item "+itemName+" in Loadout slot "+std::to_string(slot)+" when said item does not exist in our inventory!");
intnewRowIndex=selectedButton.lock()->inventoryIndex-invWidth;//Moving up moves the cursor up an entire row.
intnewRowIndex=selectedButton.lock()->inventoryIndex-invWidth;//Moving up moves the cursor up an entire row.
if(newRowIndex<0){
if(newRowIndex<0){
//This means we have to wrap around.
//This means we have to wrap around.
newRowIndex+=itemsList.size();
returnData="OK Button";
return;
}
}
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
//Select the component that matches this new number.
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
intnewRowIndex=std::clamp(selectedButton.lock()->inventoryIndex+1,(selectedButton.lock()->inventoryIndex/invWidth)*invWidth,std::min(itemsList.size(),(selectedButton.lock()->inventoryIndex/invWidth+1)*invWidth-1));//Moving right, we need to wrap around if we get to the edge.
intnewRowIndex=selectedButton.lock()->inventoryIndex+invWidth;//Moving down moves the cursor down an entire row.
if(newRowIndex>=itemsList.size()){
if(newRowIndex>=itemsList.size()){
//This means we have to wrap around.
//This means we have to wrap around.
newRowIndex-=itemsList.size();
returnData="OK Button";
return;
}
}
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
//Select the component that matches this new number.
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
//Select the component that matches this new number.
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
intnewRowIndex=std::clamp(selectedButton.lock()->inventoryIndex-1,(selectedButton.lock()->inventoryIndex/invWidth)*invWidth,std::min(itemsList.size(),(selectedButton.lock()->inventoryIndex/invWidth+1)*invWidth-1));//Moving left, we need to wrap around if we get to the edge.
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
//Select the component that matches this new number.
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));