From 21f4213e0ccd23cf310646341531f8f5d45b2809 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 27 Jun 2017 16:45:33 +0200 Subject: [PATCH] Reduce expanded code of the macro QUICKMENU_ENTRY_TC --- qcsrc/client/hud/panel/quickmenu.qc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index 2048c329f..f17f30459 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -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"))) -- 2.39.2