Merge pull request #2214 from CyberShadow/pull-20190305-225227

DRY skill widget updates in stats window
pull/541/head
Bret Curtis 6 years ago committed by GitHub
commit 7e5c7064af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -438,9 +438,6 @@ namespace MWGui
if (skillId < 0 || skillId >= ESM::Skill::Length) // Skip unknown skill indexes
continue;
const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
const MWMechanics::SkillValue &stat = mSkillValues.find(skillId)->second;
int base = stat.getBase();
int modified = stat.getModified();
const MWWorld::ESMStore &esmStore =
MWBase::Environment::get().getWorld()->getStore();
@ -452,13 +449,9 @@ namespace MWGui
const ESM::Attribute* attr =
esmStore.get<ESM::Attribute>().find(skill->mData.mAttribute);
std::string state = "normal";
if (modified > base)
state = "increased";
else if (modified < base)
state = "decreased";
std::pair<MyGUI::TextBox*, MyGUI::TextBox*> widgets = addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString(skillNameId, skillNameId),
MyGUI::utility::toString(static_cast<int>(modified)), state, coord1, coord2);
"", "normal", coord1, coord2);
mSkillWidgetMap[skillId] = widgets;
for (int i=0; i<2; ++i)
{
@ -469,27 +462,9 @@ namespace MWGui
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillAttribute", "#{sGoverningAttribute}: #{" + attr->mName + "}");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ImageTexture_SkillImage", icon);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Range_SkillProgress", "100");
if (base < 100)
{
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Visible_SkillMaxed", "false");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("UserData^Hidden_SkillMaxed", "true");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Visible_SkillProgressVBox", "true");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("UserData^Hidden_SkillProgressVBox", "false");
setSkillProgress(mSkillWidgets[mSkillWidgets.size()-1-i], stat.getProgress(), skillId);
}
else
{
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Visible_SkillMaxed", "true");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("UserData^Hidden_SkillMaxed", "false");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Visible_SkillProgressVBox", "false");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("UserData^Hidden_SkillProgressVBox", "true");
}
}
mSkillWidgetMap[skillId] = widgets;
setValue(static_cast<ESM::Skill::SkillEnum>(skillId), mSkillValues.find(skillId)->second);
}
}

Loading…
Cancel
Save