Fix: Restore the behaviour when entering numbers in query windows: clamp integers out of range to the maximum valid value.

This commit is contained in:
frosch
2025-05-16 12:22:00 +02:00
committed by frosch
parent c1389c77b2
commit 2926179d02
14 changed files with 20 additions and 20 deletions

View File

@@ -1693,7 +1693,7 @@ public:
if (!str.has_value()) return;
/* Set a new company manager face number */
if (!str->empty()) {
auto val = ParseInteger(*str);
auto val = ParseInteger(*str, 10, true);
if (!val.has_value()) return;
this->face = *val;
ScaleAllCompanyManagerFaceBits(this->face);
@@ -2458,7 +2458,7 @@ struct CompanyWindow : Window
default: NOT_REACHED();
case WID_C_GIVE_MONEY: {
auto value = ParseInteger<uint64_t>(*str);
auto value = ParseInteger<uint64_t>(*str, 10, true);
if (!value.has_value()) return;
Money money = *value / GetCurrency().rate;
Command<CMD_GIVE_MONEY>::Post(STR_ERROR_CAN_T_GIVE_MONEY, money, this->window_number);