]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/keybinder.qc
Don't even try to translate keys if game isn't translated
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / keybinder.qc
index 4546a62b109503192359c91904ac49bae9b4053c..36b134478cf0a8317c5e928f3fa29ee8eef071cc 100644 (file)
@@ -51,11 +51,11 @@ void Xonotic_KeyBinds_Read()
        int i;
 
        #define ADD_TO_W_LIST(pred) \
-               FOREACH(Weapons, it != WEP_Null, LAMBDA( \
+               FOREACH(Weapons, it != WEP_Null, { \
                        if (it.impulse != imp) continue; \
                        if (!(pred)) continue; \
                        w_list = strcat(w_list, it.m_name, " / "); \
-               ))
+               })
 
        for(int imp = 1; imp <= 9; ++imp)
        {
@@ -246,12 +246,8 @@ void XonoticKeyBinder_destroy(entity me)
 
        for(int i = 0; i < MAX_KEYBINDS; ++i)
        {
-               if(Xonotic_KeyBinds_Functions[i])
-                       strunzone(Xonotic_KeyBinds_Functions[i]);
-               Xonotic_KeyBinds_Functions[i] = string_null;
-               if(Xonotic_KeyBinds_Descriptions[i])
-                       strunzone(Xonotic_KeyBinds_Descriptions[i]);
-               Xonotic_KeyBinds_Descriptions[i] = string_null;
+               strfree(Xonotic_KeyBinds_Functions[i]);
+               strfree(Xonotic_KeyBinds_Descriptions[i]);
        }
        Xonotic_KeyBinds_Count = 0;
 }
@@ -377,6 +373,7 @@ float XonoticKeyBinder_keyDown(entity me, int key, bool ascii, float shift)
        }
        return r;
 }
+
 void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
@@ -441,7 +438,7 @@ void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isS
                        {
                                if(s != "")
                                        s = strcat(s, ", ");
-                               s = strcat(s, keynumtostring(k));
+                               s = strcat(s, translate_key(keynumtostring(k)));
                        }
                }
                s = draw_TextShortenToWidth(s, me.columnKeysSize, 0, me.realFontSize);