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