1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:53:52 +00:00

Do not show duration for infinite light sources as -1

This commit is contained in:
Andrei Kortunov 2018-09-18 15:23:16 +04:00
parent 07be9ae8ac
commit 989de05f80

View file

@ -161,7 +161,12 @@ namespace MWClass
std::string text;
if (Settings::Manager::getBool("show effect duration","Game"))
text += "\n#{sDuration}: " + MWGui::ToolTips::toString(ptr.getClass().getRemainingUsageTime(ptr));
{
// -1 is infinite light source, so duration makes no sense here. Other negative values are treated as 0.
float remainingTime = ptr.getClass().getRemainingUsageTime(ptr);
if (remainingTime != -1.0f)
text += "\n#{sDuration}: " + MWGui::ToolTips::toString(std::max(0.f, remainingTime));
}
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");