X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=eb2f8f0c54476a281939448b3a9bdfe5aba8e984;hb=2755bae650b89e72250cb11161ac210d18d39474;hp=78dddf8aac39dc4b4ca62e7136e8b1daff56a9f1;hpb=3ff2e8a0b5c27b99a9920bdf5ed82bc41bf40181;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 78dddf8a..eb2f8f0c 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -387,9 +387,9 @@ static char *get_corrected_real_name(char *real_name) if (*from_ptr == ',') break; - /* the user's real name may contain 'ß' characters (german sharp s), + /* the user's real name may contain 'german sharp s' characters, which have no equivalent in upper case letters (used by our fonts) */ - if (*from_ptr == 'ß') + if (*from_ptr == CHAR_BYTE_SHARP_S) { from_ptr++; *to_ptr++ = 's'; @@ -760,7 +760,6 @@ void GetOptions(char *argv[], options.network = FALSE; options.verbose = FALSE; options.debug = FALSE; - options.debug_x11_sync = FALSE; #if 1 options.verbose = TRUE; @@ -888,10 +887,6 @@ void GetOptions(char *argv[], { options.debug = TRUE; } - else if (strncmp(option, "-debug-x11-sync", option_len) == 0) - { - options.debug_x11_sync = TRUE; - } else if (strncmp(option, "-verbose", option_len) == 0) { options.verbose = TRUE; @@ -1010,6 +1005,9 @@ void Error(int mode, char *format, ...) if (mode & ERR_WARN) fprintf_nonewline(program.error_file, "warning: "); + if (mode & ERR_EXIT) + fprintf_nonewline(program.error_file, "fatal error: "); + va_start(ap, format); vfprintf_newline(program.error_file, format, ap); va_end(ap); @@ -1418,14 +1416,14 @@ void translate_keyname(Key *keysym, char **x11name, char **name, int mode) { KSYM_braceright, "XK_braceright", "brace right" }, { KSYM_asciitilde, "XK_asciitilde", "~" }, - /* special (non-ASCII) keys (ISO-Latin-1) */ - { KSYM_degree, "XK_degree", "°" }, - { KSYM_Adiaeresis, "XK_Adiaeresis", "Ä" }, - { KSYM_Odiaeresis, "XK_Odiaeresis", "Ö" }, - { KSYM_Udiaeresis, "XK_Udiaeresis", "Ü" }, - { KSYM_adiaeresis, "XK_adiaeresis", "ä" }, - { KSYM_odiaeresis, "XK_odiaeresis", "ö" }, - { KSYM_udiaeresis, "XK_udiaeresis", "ü" }, + /* special (non-ASCII) keys */ + { KSYM_degree, "XK_degree", "degree" }, + { KSYM_Adiaeresis, "XK_Adiaeresis", "A umlaut" }, + { KSYM_Odiaeresis, "XK_Odiaeresis", "O umlaut" }, + { KSYM_Udiaeresis, "XK_Udiaeresis", "U umlaut" }, + { KSYM_adiaeresis, "XK_adiaeresis", "a umlaut" }, + { KSYM_odiaeresis, "XK_odiaeresis", "o umlaut" }, + { KSYM_udiaeresis, "XK_udiaeresis", "u umlaut" }, { KSYM_ssharp, "XK_ssharp", "sharp s" }, #if defined(TARGET_SDL2) @@ -1699,6 +1697,26 @@ Key getKeyFromX11KeyName(char *x11name) char getCharFromKey(Key key) { + static struct + { + Key key; + byte key_char; + } translate_key_char[] = + { + /* special (non-ASCII) keys (ISO-8859-1) */ + { KSYM_degree, CHAR_BYTE_DEGREE }, + { KSYM_Adiaeresis, CHAR_BYTE_UMLAUT_A }, + { KSYM_Odiaeresis, CHAR_BYTE_UMLAUT_O }, + { KSYM_Udiaeresis, CHAR_BYTE_UMLAUT_U }, + { KSYM_adiaeresis, CHAR_BYTE_UMLAUT_a }, + { KSYM_odiaeresis, CHAR_BYTE_UMLAUT_o }, + { KSYM_udiaeresis, CHAR_BYTE_UMLAUT_u }, + { KSYM_ssharp, CHAR_BYTE_SHARP_S }, + + /* end-of-array identifier */ + { 0, 0 } + }; + char *keyname = getKeyNameFromKey(key); char c = 0; @@ -1706,6 +1724,21 @@ char getCharFromKey(Key key) c = keyname[0]; else if (strEqual(keyname, "space")) c = ' '; + else + { + int i = 0; + + do + { + if (key == translate_key_char[i].key) + { + c = translate_key_char[i].key_char; + + break; + } + } + while (translate_key_char[++i].key_char); + } return c; }