mirror of https://github.com/OpenTTD/OpenTTD
(svn r17920) -Codechange: add a 'filter' for numbers+spaces and use it for the NewGRF parameter list
parent
70ebe13ee8
commit
a5d005dd53
|
@ -819,7 +819,7 @@ struct NewGRFWindow : public Window {
|
||||||
static char buff[512];
|
static char buff[512];
|
||||||
GRFBuildParamList(buff, this->sel, lastof(buff));
|
GRFBuildParamList(buff, this->sel, lastof(buff));
|
||||||
SetDParamStr(0, buff);
|
SetDParamStr(0, buff);
|
||||||
ShowQueryString(STR_JUST_RAW_STRING, STR_NEWGRF_SETTINGS_PARAMETER_QUERY, 63, 250, this, CS_ALPHANUMERAL, QSF_NONE);
|
ShowQueryString(STR_JUST_RAW_STRING, STR_NEWGRF_SETTINGS_PARAMETER_QUERY, 63, 250, this, CS_NUMERAL_SPACE, QSF_NONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,7 @@ bool IsValidChar(WChar key, CharSetFilter afilter)
|
||||||
switch (afilter) {
|
switch (afilter) {
|
||||||
case CS_ALPHANUMERAL: return IsPrintable(key);
|
case CS_ALPHANUMERAL: return IsPrintable(key);
|
||||||
case CS_NUMERAL: return (key >= '0' && key <= '9');
|
case CS_NUMERAL: return (key >= '0' && key <= '9');
|
||||||
|
case CS_NUMERAL_SPACE: return (key >= '0' && key <= '9') || key == ' ';
|
||||||
case CS_ALPHA: return IsPrintable(key) && !(key >= '0' && key <= '9');
|
case CS_ALPHA: return IsPrintable(key) && !(key >= '0' && key <= '9');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
enum CharSetFilter {
|
enum CharSetFilter {
|
||||||
CS_ALPHANUMERAL, ///< Both numeric and alphabetic and spaces and stuff
|
CS_ALPHANUMERAL, ///< Both numeric and alphabetic and spaces and stuff
|
||||||
CS_NUMERAL, ///< Only numeric ones
|
CS_NUMERAL, ///< Only numeric ones
|
||||||
|
CS_NUMERAL_SPACE, ///< Only numbers and spaces
|
||||||
CS_ALPHA, ///< Only alphabetic values
|
CS_ALPHA, ///< Only alphabetic values
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue