mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 12:23:51 +00:00
Merge pull request #2214 from CyberShadow/pull-20190305-225227
DRY skill widget updates in stats window
This commit is contained in:
commit
7e5c7064af
1 changed files with 3 additions and 28 deletions
|
@ -438,9 +438,6 @@ namespace MWGui
|
||||||
if (skillId < 0 || skillId >= ESM::Skill::Length) // Skip unknown skill indexes
|
if (skillId < 0 || skillId >= ESM::Skill::Length) // Skip unknown skill indexes
|
||||||
continue;
|
continue;
|
||||||
const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
|
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 =
|
const MWWorld::ESMStore &esmStore =
|
||||||
MWBase::Environment::get().getWorld()->getStore();
|
MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
@ -452,13 +449,9 @@ namespace MWGui
|
||||||
const ESM::Attribute* attr =
|
const ESM::Attribute* attr =
|
||||||
esmStore.get<ESM::Attribute>().find(skill->mData.mAttribute);
|
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),
|
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)
|
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("Caption_SkillAttribute", "#{sGoverningAttribute}: #{" + attr->mName + "}");
|
||||||
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ImageTexture_SkillImage", icon);
|
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ImageTexture_SkillImage", icon);
|
||||||
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Range_SkillProgress", "100");
|
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…
Reference in a new issue