mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 10:29:45 +01:00
Don't mutate the decimal place in ss_toi()
This fixes a bug where "12" gets properly evaluated as 12, but "148" gets evaluated as 1408. It's because `place` gets multiplied by `radix` again, so `retval` gets multipled by 100 instead of 10. There's no reason to have a `place` variable, so I've removed it entirely. This simplifies the function a little bit.
This commit is contained in:
parent
adbae16666
commit
09841ef3a5
1 changed files with 1 additions and 3 deletions
|
@ -39,7 +39,6 @@ static const char* GCChar(const SDL_GameControllerButton button)
|
|||
int ss_toi(const std::string& str)
|
||||
{
|
||||
int retval = 0;
|
||||
int place = 1;
|
||||
bool negative = false;
|
||||
const int radix = 10;
|
||||
|
||||
|
@ -55,9 +54,8 @@ int ss_toi(const std::string& str)
|
|||
|
||||
if (SDL_isdigit(chr))
|
||||
{
|
||||
retval *= place;
|
||||
retval *= radix;
|
||||
retval += chr - '0';
|
||||
place *= radix;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue