]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reduce expanded code of the macro QUICKMENU_ENTRY_TC
authorterencehill <piuntn@gmail.com>
Tue, 27 Jun 2017 14:45:33 +0000 (16:45 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 27 Jun 2017 14:45:33 +0000 (16:45 +0200)
qcsrc/client/hud/panel/quickmenu.qc

index 2048c329f615cc2f27d2655a12ac69b7b964052e..f17f3045941741796ed400629350a020f8020a8e 100644 (file)
@@ -740,12 +740,19 @@ void HUD_QuickMenu()
 
 // useful to Translate a string inside the Command
 #define QUICKMENU_ENTRY_TC(title,command,text,translated_text) {\
-       if(prvm_language == "en") \
-               QUICKMENU_ENTRY(title, sprintf(command, text)) \
-       else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) \
-               QUICKMENU_ENTRY(strcat("(en)", title), sprintf(command, text)) \
-       else \
-               QUICKMENU_ENTRY(strcat("(", prvm_language, ")", title), sprintf(command, translated_text)) \
+       if(prvm_language == "en") { \
+               tc_title = title; \
+               tc_cmd = sprintf(command, text); \
+       } \
+       else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) { \
+               tc_title = strcat("(en)", title); \
+               tc_cmd = sprintf(command, text); \
+       } \
+       else { \
+               tc_title = strcat("(", prvm_language, ")", title); \
+               tc_cmd = sprintf(command, translated_text); \
+       } \
+       QUICKMENU_ENTRY(tc_title, tc_cmd) \
 }
 
 void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me)
@@ -781,6 +788,9 @@ void QuickMenu_Default(string target_submenu)
        if(target_submenu != "")
                QuickMenu_Buffer_Size = QUICKMENU_BUFFER_MAXENTRIES; // forbids load of next entries until target_submenu
 
+       string tc_title;
+       string tc_cmd;
+
        QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
                QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
                QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))