Leave away unnecessary trailing zeros in script numeric values for menus

This commit is contained in:
Jan 2021-12-12 16:23:58 +01:00
parent 4ed8016110
commit 9c5c34b0c8

View File

@ -41,7 +41,11 @@ namespace menu
if (firstToken.m_type == SimpleParserValueType::INTEGER)
return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue())));
if (firstToken.m_type == SimpleParserValueType::FLOATING_POINT)
return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.FloatingPointValue())));
{
std::ostringstream ss;
ss << std::noshowpoint << firstToken.FloatingPointValue();
return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str()));
}
return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue()));
})
});