summaryrefslogtreecommitdiff
path: root/src/interface/Textbox.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-07-29 19:34:20 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-07-29 19:34:20 (GMT)
commit9c67d41ad657de4d1cec21cfd43f1990d30cfc35 (patch)
tree7f107ad60c64fd2874538fe95753ccb28f11290b /src/interface/Textbox.cpp
parentf36dafd9d32a95dc4b569590fa8999a7acb8cc68 (diff)
downloadpowder-9c67d41ad657de4d1cec21cfd43f1990d30cfc35.zip
powder-9c67d41ad657de4d1cec21cfd43f1990d30cfc35.tar.gz
Neaten a little bit of code
Diffstat (limited to 'src/interface/Textbox.cpp')
-rw-r--r--src/interface/Textbox.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp
index 29e36a3..d53ebeb 100644
--- a/src/interface/Textbox.cpp
+++ b/src/interface/Textbox.cpp
@@ -348,11 +348,11 @@ void Textbox::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
}
if(inputType == Number)
{
- if(backingText.length()>1)
- {
- while(backingText[0] == '0')
- backingText.erase(backingText.begin());
- }
+ //Remove extra preceding 0's
+ while(backingText[0] == '0' && backingText.length()>1)
+ backingText.erase(backingText.begin());
+
+ //If there is no content, replace with 0
if(!backingText.length())
backingText = "0";
}