diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-23 02:46:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-23 02:48:43 +0300 |
commit | a69a87c5a81ddbf25a25c5549259da550d207bda (patch) | |
tree | 59f1a919b327912395ab84bab1684118bf0379be /src/guichan/font.cpp | |
parent | e646f2fae3f323b7faa26aa9540524d1765211ee (diff) | |
download | mv-a69a87c5a81ddbf25a25c5549259da550d207bda.tar.gz mv-a69a87c5a81ddbf25a25c5549259da550d207bda.tar.bz2 mv-a69a87c5a81ddbf25a25c5549259da550d207bda.tar.xz mv-a69a87c5a81ddbf25a25c5549259da550d207bda.zip |
Improve a bit iterators again.
Diffstat (limited to 'src/guichan/font.cpp')
-rw-r--r-- | src/guichan/font.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/guichan/font.cpp b/src/guichan/font.cpp index e2485eb0d..598b1610b 100644 --- a/src/guichan/font.cpp +++ b/src/guichan/font.cpp @@ -56,14 +56,9 @@ namespace gcn { int Font::getStringIndexAt(const std::string& text, int x) const { - unsigned int i; - int size = 0; - - for (i = 0; i < text.size(); ++i) + for (unsigned int i = 0; i < text.size(); ++i) { - size = getWidth(text.substr(0, i)); - - if (size > x) + if (getWidth(text.substr(0, i)) > x) return i; } |