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

See: https://github.com/OpenTTD/OpenTTD/issues/7750
pull/117/head
Jonathan G Rennison 5 years ago
parent ab3a373c73
commit b132272fb1

@ -2687,7 +2687,7 @@ struct CompanyWindow : Window
default: NOT_REACHED();
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;
case WID_C_PRESIDENT_NAME:

Loading…
Cancel
Save