1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00

Use default 0 precision in the float formatting (bug #4096)

This commit is contained in:
Andrei Kortunov 2017-09-17 14:34:27 +04:00
parent f594eda574
commit 4bb349a525

View File

@ -34,21 +34,19 @@ namespace Misc
if (i < m.size()) if (i < m.size())
{ {
int precision = 0; int precision = -1;
bool precisionSet = false;
if (m[i] == '.') if (m[i] == '.')
{ {
precision = 0;
while (++i < m.size() && m[i] >= '0' && m[i] <= '9') while (++i < m.size() && m[i] >= '0' && m[i] <= '9')
{ {
precision = precision * 10 + (m[i] - '0'); precision = precision * 10 + (m[i] - '0');
precisionSet = true;
} }
} }
if (i < m.size()) if (i < m.size())
{ {
width = (widthSet) ? width : -1; width = (widthSet) ? width : -1;
precision = (precisionSet) ? precision : -1;
if (m[i] == 'S' || m[i] == 's') if (m[i] == 'S' || m[i] == 's')
visitedPlaceholder(StringPlaceholder, pad, width, precision); visitedPlaceholder(StringPlaceholder, pad, width, precision);