Change: extend the allowed range for max loan setting (#8386)
(cherry picked from commit b2895dfcd0
)
This commit is contained in:

committed by
Jonathan G Rennison

parent
e94656b5a5
commit
b623d6f2ee
@@ -2451,16 +2451,18 @@ struct GameSettingsWindow : Window {
|
||||
} else {
|
||||
/* Only open editbox if clicked for the second time, and only for types where it is sensible for. */
|
||||
if (this->last_clicked == pe && sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & (SGF_MULTISTRING | SGF_ENUM))) {
|
||||
int64 value64 = value;
|
||||
/* Show the correct currency-translated value */
|
||||
if (sd->desc.flags & SGF_CURRENCY) value *= _currency->rate;
|
||||
if (sd->desc.flags & SGF_CURRENCY) value64 *= _currency->rate;
|
||||
|
||||
this->valuewindow_entry = pe;
|
||||
if (sd->desc.flags & SGF_DECIMAL1) {
|
||||
SetDParam(0, value);
|
||||
SetDParam(0, value64);
|
||||
ShowQueryString(STR_JUST_DECIMAL1, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL_DECIMAL, QSF_ENABLE_DEFAULT);
|
||||
} else {
|
||||
SetDParam(0, value);
|
||||
ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
|
||||
SetDParam(0, value64);
|
||||
/* Limit string length to 14 so that MAX_INT32 * max currency rate doesn't exceed MAX_INT64. */
|
||||
ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 15, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
|
||||
}
|
||||
}
|
||||
this->SetDisplayedHelpText(pe);
|
||||
@@ -2486,14 +2488,17 @@ struct GameSettingsWindow : Window {
|
||||
|
||||
int32 value;
|
||||
if (!StrEmpty(str)) {
|
||||
long long llvalue;
|
||||
if (sd->desc.flags & SGF_DECIMAL1) {
|
||||
value = atof(str) * 10;
|
||||
llvalue = atof(str) * 10;
|
||||
} else {
|
||||
value = atoi(str);
|
||||
llvalue = atoll(str);
|
||||
}
|
||||
|
||||
/* Save the correct currency-translated value */
|
||||
if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate;
|
||||
if (sd->desc.flags & SGF_CURRENCY) llvalue /= _currency->rate;
|
||||
|
||||
value = (int32)ClampToI32(llvalue);
|
||||
} else {
|
||||
value = (int32)(size_t)sd->desc.def;
|
||||
}
|
||||
|
Reference in New Issue
Block a user