Do not show duration for infinite light sources as -1

pull/1928/head
Andrei Kortunov 6 years ago
parent 07be9ae8ac
commit 989de05f80

@ -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}");

Loading…
Cancel
Save