From: terencehill Date: Sat, 12 Mar 2022 22:59:31 +0000 (+0100) Subject: Small cleanups X-Git-Tag: xonotic-v0.8.5~81^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=300c49c7d9c39ea247e1840827c02a16a7a434c5;p=xonotic%2Fxonotic-data.pk3dir.git Small cleanups --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 468878f83..8d35ecc7d 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1293,9 +1293,9 @@ NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew) if (!isdemo() && cvar("_menu_welcome_dialog_available") && autocvar_cl_welcome_in_menu_dialog) { string welcomedialog_args; - welcomedialog_args = strcat("name \"", hostname, "\""); + welcomedialog_args = strcat("HOSTNAME \"", hostname, "\""); msg = MakeConsoleSafe(strreplace("\n", "\\n", msg)); - welcomedialog_args = strcat(welcomedialog_args, " motd \"", msg, "\""); + welcomedialog_args = strcat(welcomedialog_args, " WELCOME \"", msg, "\""); localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n"); } else diff --git a/qcsrc/menu/command/menu_cmd.qc b/qcsrc/menu/command/menu_cmd.qc index 2587602fc..c8ddf726a 100644 --- a/qcsrc/menu/command/menu_cmd.qc +++ b/qcsrc/menu/command/menu_cmd.qc @@ -7,7 +7,7 @@ #include -.void(entity me, float argsbuf) readInputArgs; +.void(entity me, int argsbuf) readInputArgs; .entity firstChild, nextSibling; string _dumptree_space; diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index 252ff9322..691e7cbf9 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qc +++ b/qcsrc/menu/xonotic/dialog_welcome.qc @@ -9,13 +9,8 @@ void welcomeDialog_resetStrings(entity me) { - if(me.serverinfo_name) - strunzone(me.serverinfo_name); - me.serverinfo_name = strzone(_("")); - - if(me.serverinfo_MOTD) - strunzone(me.serverinfo_MOTD); - me.serverinfo_MOTD = strzone(_("")); + strcpy(me.serverinfo_name, ""); + strcpy(me.serverinfo_MOTD, ""); } float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shift) @@ -45,7 +40,7 @@ void XonoticWelcomeDialog_destroy(entity me) cvar_set("_menu_welcome_dialog_available", "0"); } -void XonoticWelcomeDialog_readInputArgs(entity me, float argsbuf) +void XonoticWelcomeDialog_readInputArgs(entity me, int argsbuf) { int i = 0; string s; @@ -53,20 +48,10 @@ void XonoticWelcomeDialog_readInputArgs(entity me, float argsbuf) if(argsbuf >= 0) while((s = bufstr_get(argsbuf, i)) != "") { - if(s == "name") - { - if(me.serverinfo_name) - strunzone(me.serverinfo_name); - me.serverinfo_name = strzone(bufstr_get(argsbuf, i + 1)); - ++i; - } - else if(s == "motd") - { - if(me.serverinfo_MOTD) - strunzone(me.serverinfo_MOTD); - me.serverinfo_MOTD = strzone(bufstr_get(argsbuf, i + 1)); - ++i; - } + if(s == "HOSTNAME") + strcpy(me.serverinfo_name, bufstr_get(argsbuf, ++i)); + else if(s == "WELCOME") + strcpy(me.serverinfo_MOTD, bufstr_get(argsbuf, ++i)); ++i; } //me.serverinfo_name_ent.setText(me.serverinfo_name_ent, me.serverinfo_name); diff --git a/qcsrc/menu/xonotic/dialog_welcome.qh b/qcsrc/menu/xonotic/dialog_welcome.qh index 05652cfaa..63f18cafa 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qh +++ b/qcsrc/menu/xonotic/dialog_welcome.qh @@ -13,7 +13,7 @@ CLASS(XonoticWelcomeDialog, XonoticRootDialog) METHOD(XonoticWelcomeDialog, keyDown, float(entity, float, float, float)); METHOD(XonoticWelcomeDialog, configureDialog, void(entity)); METHOD(XonoticWelcomeDialog, destroy, void(entity)); - METHOD(XonoticWelcomeDialog, readInputArgs, void(entity, float)); + METHOD(XonoticWelcomeDialog, readInputArgs, void(entity, int)); ATTRIB(XonoticWelcomeDialog, serverinfo_name, string, string_null); //ATTRIB(XonoticWelcomeDialog, serverinfo_name_ent, entity, world); ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD, string, string_null);