diff options
author | Andrei Karas <akaras@inbox.ru> | 2010-01-10 17:19:24 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-01-10 17:20:33 +0100 |
commit | f5a394a5051384a930d635da22ccafc6beb1cb84 (patch) | |
tree | d28fc14408a6bb91170e05880b4d2af6a17fcc14 /src/units.cpp | |
parent | 5757066312cab082378dbc5d8df97dea3fe40af0 (diff) | |
download | mana-f5a394a5051384a930d635da22ccafc6beb1cb84.tar.gz mana-f5a394a5051384a930d635da22ccafc6beb1cb84.tar.bz2 mana-f5a394a5051384a930d635da22ccafc6beb1cb84.tar.xz mana-f5a394a5051384a930d635da22ccafc6beb1cb84.zip |
Change code style
Diffstat (limited to 'src/units.cpp')
-rw-r--r-- | src/units.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/units.cpp b/src/units.cpp index f865531a..ac252fcd 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -164,10 +164,13 @@ std::string formatUnit(int value, int type) struct UnitLevel ul; // Shortcut for 0; do the same for values less than 0 (for now) - if (value <= 0) { + if (value <= 0) + { ul = ud.levels[0]; return strprintf("0%s", ul.symbol.c_str()); - } else { + } + else + { double amount = ud.conversion * value; // If only the first level is needed, act like mix if false @@ -183,7 +186,8 @@ std::string formatUnit(int value, int type) amount -= levelAmount * ul.count; - if (amount > 0) { + if (amount > 0) + { output = strprintf("%.*f%s", pl.round, amount, pl.symbol.c_str()); } @@ -210,7 +214,8 @@ std::string formatUnit(int value, int type) for (unsigned int i = 0; i < ud.levels.size(); i++) { ul = ud.levels[i]; - if (amount < ul.count && ul.count > 0) { + if (amount < ul.count && ul.count > 0) + { ul = ud.levels[i - 1]; break; } |