Changeset - r25283:6dcfc744b37a
[Not reviewed]
master
0 4 0
rubidium42 - 4 years ago 2021-04-27 16:14:44
rubidium@openttd.org
Feature: allow non-ASCII currency separators
4 files changed with 5 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/settings.cpp
Show inline comments
 
@@ -563,8 +563,6 @@ static void IniLoadSettings(IniFile *ini
 
						*(char**)ptr = p == nullptr ? nullptr : stredup((const char*)p);
 
						break;
 

	
 
					case SLE_VAR_CHAR: if (p != nullptr) *(char *)ptr = *(const char *)p; break;
 

	
 
					default: NOT_REACHED();
 
				}
 
				break;
 
@@ -716,7 +714,6 @@ static void IniSaveSettings(IniFile *ini
 
						}
 
						break;
 

	
 
					case SLE_VAR_CHAR: buf[0] = *(char*)ptr; buf[1] = '\0'; break;
 
					default: NOT_REACHED();
 
				}
 
				break;
src/settings_gui.cpp
Show inline comments
 
@@ -2676,7 +2676,7 @@ struct CustomCurrencyWindow : Window {
 
			case WID_CC_SEPARATOR:
 
				SetDParamStr(0, _custom_currency.separator);
 
				str = STR_JUST_RAW_STRING;
 
				len = 1;
 
				len = sizeof(_custom_currency.separator) - 1; // Number of characters excluding '\0' termination
 
				line = WID_CC_SEPARATOR;
 
				break;
 

	
 
@@ -2684,7 +2684,7 @@ struct CustomCurrencyWindow : Window {
 
			case WID_CC_PREFIX:
 
				SetDParamStr(0, _custom_currency.prefix);
 
				str = STR_JUST_RAW_STRING;
 
				len = 12;
 
				len = sizeof(_custom_currency.prefix) - 1; // Number of characters excluding '\0' termination
 
				line = WID_CC_PREFIX;
 
				break;
 

	
 
@@ -2692,7 +2692,7 @@ struct CustomCurrencyWindow : Window {
 
			case WID_CC_SUFFIX:
 
				SetDParamStr(0, _custom_currency.suffix);
 
				str = STR_JUST_RAW_STRING;
 
				len = 12;
 
				len = sizeof(_custom_currency.suffix) - 1; // Number of characters excluding '\0' termination
 
				line = WID_CC_SUFFIX;
 
				break;
 

	
src/table/currency_settings.ini
Show inline comments
 
@@ -10,7 +10,6 @@ static const SettingDesc _currency_setti
 
};
 
[templates]
 
SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
 
SDT_CHR = SDT_CHR($base, $var,        $flags, $guiflags, $def,                        $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
 
SDT_STR = SDT_STR($base, $var, $type, $flags, $guiflags, $def,                        $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
 
SDT_END = SDT_END()
 

	
 
@@ -42,9 +41,10 @@ def      = 1
 
min      = 0
 
max      = UINT16_MAX
 

	
 
[SDT_CHR]
 
[SDT_STR]
 
base     = CurrencySpec
 
var      = separator
 
type     = SLE_STRBQ
 
def      = "".""
 
cat      = SC_BASIC
 

	
src/table/settings.h.preamble
Show inline comments
 
@@ -107,9 +107,6 @@ static size_t ConvertLandscape(const cha
 
#define SDT_STR(base, var, type, flags, guiflags, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
 
	SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, base, var, sizeof(((base*)8)->var), def, 0, 0, 0, nullptr, str, strhelp, strval, proc, nullptr, from, to, cat, extra, startup)
 

	
 
#define SDT_CHR(base, var, flags, guiflags, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
 
	SDT_GENERAL(#var, SDT_STRING, SL_VAR, SLE_CHAR, flags, guiflags, base, var, 1, def, 0, 0, 0, nullptr, str, strhelp, strval, proc, nullptr, from, to, cat, extra, startup)
 

	
 
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, strhelp, strval, proc, from, to, load, cat, extra, startup)\
 
	SDT_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, max, 0, full, str, strhelp, strval, proc, load, from, to, cat, extra, startup)
 

	
0 comments (0 inline, 0 general)