Fix bug with reading an enhanced ability's config value from a location that is not the ability's settings group (was not returning false to jump to the next check). Release Build 12227.

This commit is contained in:
sigonasr2 2025-06-04 15:04:42 -05:00
parent 83317bacb6
commit 7f4e6282b7
4 changed files with 25 additions and 6 deletions

View File

@ -176,6 +176,7 @@ const std::string Ability::GetDescriptionWithPlayerModifiers()const{
std::string separatorVal{variableName.substr(separatorMarker+1)};
if(!specialPrefixes.count(separatorKey))ERR(std::format("Could not find translation function for key {} inside special prefixes map!",separatorKey))
else {
if(!data.HasProperty(separatorVal))return false; //Could not be found in this section, will need to seek in another location.
finalText+=specialValCol.toHTMLColorCode()+specialPrefixes[separatorKey](data,separatorVal)+WHITE.toHTMLColorCode();
bracesFound=false;
return true;

View File

@ -343,7 +343,7 @@ void Menu::InitializeCharacterMenuWindow(){
auto abilityDescriptionLabel{characterMenuWindow->ADD("Ability Description Text",MenuLabel)(geom2d::rect<float>{{125,30+16},{116,windowSize.y-39-16}},"",1.f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW)END};
#pragma region Skill Selection Boxes
std::array abilityBoxes{
const std::array abilityBoxes{
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility1(),AbilitySlot::ABILITY1},
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility2(),AbilitySlot::ABILITY2},
std::pair<std::reference_wrapper<Ability>,AbilitySlot>{game->GetPlayer()->GetAbility3(),AbilitySlot::ABILITY3},
@ -357,11 +357,13 @@ void Menu::InitializeCharacterMenuWindow(){
float labelY=24+i*28+36;
auto skillBox{characterMenuWindow->ADD(std::format("Skill Icon Label {}",i),MenuIconButton)(geom2d::rect<float>{{x,y+28},{24,24}},GFX[ability.get().icon].Decal(),DO_NOTHING)END};
auto skillNameLabel{characterMenuWindow->ADD(std::format("Skill Name Label {}",i),MenuLabel)(geom2d::rect<float>{{labelX,labelY},{96,24}},ability.get().GetNameWithPlayerModifiers())END};
skillBox->SetHoverFunc([&abilityNameLabel,&abilityDescriptionLabel,&ability](MenuFuncData data){
abilityNameLabel->SetLabel(ability.get().GetNameWithPlayerModifiers());
abilityDescriptionLabel->SetLabel(ability.get().GetDescriptionWithPlayerModifiers());
skillBox->SetHoverFunc([slot](MenuFuncData data){
const auto&ability{game->GetPlayer()->GetAbility(slot)};
Component<MenuLabel>(data.menu.GetType(),"Ability Name Text")->SetLabel(ability.GetNameWithPlayerModifiers());
Component<MenuLabel>(data.menu.GetType(),"Ability Description Text")->SetLabel(ability.GetDescriptionWithPlayerModifiers());
return true;
});
skillBox->Disable(); //Hide these by default.
i++;
}
#pragma endregion
@ -372,10 +374,12 @@ void Menu::InitializeCharacterMenuWindow(){
};
//Used in conjunction with the onClick events of MenuComponents tab.
auto OnTabClick=[&abilityBoxes,&abilityNameLabel,&abilityDescriptionLabel](const ClickedTab tabClicked,const MenuFuncData&data){
auto OnTabClick=[&abilityBoxes](const ClickedTab tabClicked,const MenuFuncData&data){
using enum ClickedTab;
auto abilityNameLabel{Component<MenuLabel>(data.menu.GetType(),"Ability Name Text")};
auto abilityDescriptionLabel{Component<MenuLabel>(data.menu.GetType(),"Ability Description Text")};
for(int i=0;i<8;i++){
auto slot{Component<EquipSlotButton>(data.menu.GetType(),CharacterMenuWindow::slotNames[i])};
auto slot{Component<EquipSlotButton>(data.menu.GetType(),std::format("Equip Slot {}",CharacterMenuWindow::slotNames[i]))};
if(tabClicked==EQUIPMENT)slot->Enable();
else slot->Disable();
}

View File

@ -2326,4 +2326,17 @@ const vf2d&Player::GetPreviousPos()const{
const std::unordered_set<std::string>&Player::GetEnchants()const{
return enchantList;
}
const Ability&Player::GetAbility(AbilitySlot slot){
using enum AbilitySlot;
switch(slot){
case ABILITY1:return GetAbility1();
case ABILITY2:return GetAbility2();
case ABILITY3:return GetAbility3();
case ABILITY4:return GetAbility4();
case DEFENSIVE:return GetRightClickAbility();
}
ERR(std::format("WARNING! Unknown ability slot {} specified when attempting to retrieve Ability! THIS SHOULD NOT BE HAPPENING!",int(slot)));
return GetAbility1(); //THIS SHOULD NEVER BE HIT!!!
}

View File

@ -230,6 +230,7 @@ public:
virtual Ability&GetAbility2()=0;
virtual Ability&GetAbility3()=0;
virtual Ability&GetAbility4()=0;
const Ability&GetAbility(AbilitySlot slot);
virtual void SetAbility4(const Ability&originalAbility)=0; //NOTE: Make sure to provide the original ability and not a current ability!
virtual std::string&GetWalkNAnimation()=0;
virtual std::string&GetWalkEAnimation()=0;