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:
@@ -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:
|
||||
|
Reference in New Issue
Block a user