commit e35fb006
Simpler way to make an integer with minimum 2 digits
Changed files
| M | source/code/BlockGame.cpp before |
diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp
index 5db2cc9..b993d89 100644
--- a/source/code/BlockGame.cpp
+++ b/source/code/BlockGame.cpp
@@ -41,18 +41,11 @@ using std::stringstream;
using std::cerr;
using std::vector;
-
-static stringstream converter;
-
//Function to convert numbers to string (2 diget)
static string itoa2(int num) {
- converter.str(std::string());
- converter.clear();
- if (num<10) {
- converter << "0";
- }
- converter << num;
- return converter.str();
+ char buffer[20];
+ snprintf(buffer, sizeof(buffer), "%02i", num);
+ return buffer;
}
stageButton stageButtonStatus;