Fix give money number parsing when input value is greater than INT32_MAX

See: https://github.com/OpenTTD/OpenTTD/issues/7750
This commit is contained in:
Jonathan G Rennison
2019-11-16 21:44:02 +00:00
parent ab3a373c73
commit b132272fb1

View File

@@ -2687,7 +2687,7 @@ struct CompanyWindow : Window
default: NOT_REACHED(); default: NOT_REACHED();
case WID_C_GIVE_MONEY: case WID_C_GIVE_MONEY:
DoCommandP(0, (atoi(str) / _currency->rate), this->window_number, CMD_GIVE_MONEY | CMD_MSG(STR_ERROR_INSUFFICIENT_FUNDS), CcGiveMoney, str); DoCommandP(0, (strtoull(str, nullptr, 10) / _currency->rate), this->window_number, CMD_GIVE_MONEY | CMD_MSG(STR_ERROR_INSUFFICIENT_FUNDS), CcGiveMoney, str);
break; break;
case WID_C_PRESIDENT_NAME: case WID_C_PRESIDENT_NAME: