mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Do not display negative stat values
Display zero instead of negative values. Also remove useless for loops and some unused attributes.
This commit is contained in:
parent
fc8bd1aacb
commit
357ecd92b2
4 changed files with 45 additions and 90 deletions
|
@ -174,38 +174,32 @@ namespace MWGui
|
||||||
|
|
||||||
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
static const char *ids[] =
|
int current = std::max(0, static_cast<int>(value.getCurrent()));
|
||||||
{
|
int modified = static_cast<int>(value.getModified());
|
||||||
"HBar", "MBar", "FBar", 0
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int i=0; ids[i]; ++i)
|
MyGUI::Widget* w;
|
||||||
if (ids[i]==id)
|
std::string valStr = boost::lexical_cast<std::string>(current) + "/" + boost::lexical_cast<std::string>(modified);
|
||||||
{
|
if (id == "HBar")
|
||||||
MyGUI::Widget* w;
|
{
|
||||||
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
|
mHealth->setProgressRange(modified);
|
||||||
switch (i)
|
mHealth->setProgressPosition(current);
|
||||||
{
|
getWidget(w, "HealthFrame");
|
||||||
case 0:
|
w->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
||||||
mHealth->setProgressRange (value.getModified());
|
}
|
||||||
mHealth->setProgressPosition (value.getCurrent());
|
else if (id == "MBar")
|
||||||
getWidget(w, "HealthFrame");
|
{
|
||||||
w->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
mMagicka->setProgressRange (modified);
|
||||||
break;
|
mMagicka->setProgressPosition (current);
|
||||||
case 1:
|
getWidget(w, "MagickaFrame");
|
||||||
mMagicka->setProgressRange (value.getModified());
|
w->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
||||||
mMagicka->setProgressPosition (value.getCurrent());
|
}
|
||||||
getWidget(w, "MagickaFrame");
|
else if (id == "FBar")
|
||||||
w->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
{
|
||||||
break;
|
mStamina->setProgressRange (modified);
|
||||||
case 2:
|
mStamina->setProgressPosition (current);
|
||||||
mStamina->setProgressRange (value.getModified());
|
getWidget(w, "FatigueFrame");
|
||||||
mStamina->setProgressPosition (value.getCurrent());
|
w->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
|
||||||
getWidget(w, "FatigueFrame");
|
}
|
||||||
w->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUD::setDrowningTimeLeft(float time)
|
void HUD::setDrowningTimeLeft(float time)
|
||||||
|
|
|
@ -134,38 +134,28 @@ namespace MWGui
|
||||||
|
|
||||||
void StatsWindow::setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
void StatsWindow::setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
static const char *ids[] =
|
int current = std::max(0, static_cast<int>(value.getCurrent()));
|
||||||
{
|
int modified = static_cast<int>(value.getModified());
|
||||||
"HBar", "MBar", "FBar",
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int i=0; ids[i]; ++i)
|
setBar (id, id + "T", current, modified);
|
||||||
{
|
|
||||||
if (ids[i]==id)
|
|
||||||
{
|
|
||||||
std::string id (ids[i]);
|
|
||||||
setBar (id, id + "T", static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
|
|
||||||
|
|
||||||
// health, magicka, fatigue tooltip
|
// health, magicka, fatigue tooltip
|
||||||
MyGUI::Widget* w;
|
MyGUI::Widget* w;
|
||||||
std::string valStr = boost::lexical_cast<std::string>(int(value.getCurrent())) + "/" + boost::lexical_cast<std::string>(int(value.getModified()));
|
std::string valStr = boost::lexical_cast<std::string>(current) + "/" + boost::lexical_cast<std::string>(modified);
|
||||||
if (i==0)
|
if (id == "HBar")
|
||||||
{
|
{
|
||||||
getWidget(w, "Health");
|
getWidget(w, "Health");
|
||||||
w->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
w->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
||||||
}
|
}
|
||||||
else if (i==1)
|
else if (id == "MBar")
|
||||||
{
|
{
|
||||||
getWidget(w, "Magicka");
|
getWidget(w, "Magicka");
|
||||||
w->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
w->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
||||||
}
|
}
|
||||||
else if (i==2)
|
else if (id == "FBar")
|
||||||
{
|
{
|
||||||
getWidget(w, "Fatigue");
|
getWidget(w, "Fatigue");
|
||||||
w->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
|
w->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,9 +112,6 @@ namespace MWGui
|
||||||
, mPlayerMinorSkills()
|
, mPlayerMinorSkills()
|
||||||
, mPlayerMajorSkills()
|
, mPlayerMajorSkills()
|
||||||
, mPlayerSkillValues()
|
, mPlayerSkillValues()
|
||||||
, mPlayerHealth()
|
|
||||||
, mPlayerMagicka()
|
|
||||||
, mPlayerFatigue()
|
|
||||||
, mGui(NULL)
|
, mGui(NULL)
|
||||||
, mGuiModes()
|
, mGuiModes()
|
||||||
, mCursorManager(NULL)
|
, mCursorManager(NULL)
|
||||||
|
@ -590,32 +587,8 @@ namespace MWGui
|
||||||
mStatsWindow->setValue (id, value);
|
mStatsWindow->setValue (id, value);
|
||||||
mHud->setValue (id, value);
|
mHud->setValue (id, value);
|
||||||
mCharGen->setValue(id, value);
|
mCharGen->setValue(id, value);
|
||||||
if (id == "HBar")
|
|
||||||
{
|
|
||||||
mPlayerHealth = value;
|
|
||||||
}
|
|
||||||
else if (id == "MBar")
|
|
||||||
{
|
|
||||||
mPlayerMagicka = value;
|
|
||||||
}
|
|
||||||
else if (id == "FBar")
|
|
||||||
{
|
|
||||||
mPlayerFatigue = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
MWMechanics::DynamicStat<int> WindowManager::getValue(const std::string& id)
|
|
||||||
{
|
|
||||||
if(id == "HBar")
|
|
||||||
return mPlayerHealth;
|
|
||||||
else if (id == "MBar")
|
|
||||||
return mPlayerMagicka;
|
|
||||||
else if (id == "FBar")
|
|
||||||
return mPlayerFatigue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WindowManager::setValue (const std::string& id, const std::string& value)
|
void WindowManager::setValue (const std::string& id, const std::string& value)
|
||||||
{
|
{
|
||||||
mStatsWindow->setValue (id, value);
|
mStatsWindow->setValue (id, value);
|
||||||
|
|
|
@ -346,8 +346,6 @@ namespace MWGui
|
||||||
std::map<int, MWMechanics::Stat<int> > mPlayerAttributes;
|
std::map<int, MWMechanics::Stat<int> > mPlayerAttributes;
|
||||||
SkillList mPlayerMajorSkills, mPlayerMinorSkills;
|
SkillList mPlayerMajorSkills, mPlayerMinorSkills;
|
||||||
std::map<int, MWMechanics::Stat<float> > mPlayerSkillValues;
|
std::map<int, MWMechanics::Stat<float> > mPlayerSkillValues;
|
||||||
MWMechanics::DynamicStat<float> mPlayerHealth, mPlayerMagicka, mPlayerFatigue;
|
|
||||||
|
|
||||||
|
|
||||||
MyGUI::Gui *mGui; // Gui
|
MyGUI::Gui *mGui; // Gui
|
||||||
std::vector<GuiMode> mGuiModes;
|
std::vector<GuiMode> mGuiModes;
|
||||||
|
|
Loading…
Reference in a new issue