]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow translating version message
authorterencehill <piuntn@gmail.com>
Thu, 24 Mar 2022 22:47:43 +0000 (23:47 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 24 Mar 2022 23:42:22 +0000 (00:42 +0100)
qcsrc/client/main.qc
qcsrc/server/client.qc

index cefd2c47134b9e234f5c70bd860766525c6913d0..0864208991a63263ba06eb0c2f4e963b2d7dd557 100644 (file)
@@ -1314,11 +1314,34 @@ string translate_weaponarena(string s)
        return sprintf(_("%s Arena"), wpn_list);
 }
 
+string GetVersionMessage(string hostversion, bool version_mismatch, bool version_check)
+{
+       string xonotic_hostversion = strcat("Xonotic ", hostversion);
+       if (version_mismatch)
+       {
+               if(!version_check)
+                       return strcat(sprintf(_("This is %s"), xonotic_hostversion), "\n^3",
+                               _("Your client version is outdated."), "\n\n\n",
+                               _("### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###"), "\n\n\n",
+                               _("Please update!"));
+               else
+                       return strcat(sprintf(_("This is %s"), xonotic_hostversion), "\n^3",
+                               _("This server is using an outdated Xonotic version."), "\n\n\n",
+                               _("### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###"));
+       }
+       return sprintf(_("Welcome to %s"), xonotic_hostversion);
+}
+
 NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew)
 {
        bool force_centerprint = ReadByte();
        string hostname = ReadString();
-       string ver = ReadString();
+
+       string hostversion = ReadString();
+       bool version_mismatch = ReadByte();
+       bool version_check = ReadByte();
+       string ver = GetVersionMessage(hostversion, version_mismatch, version_check);
+
        string modifications = translate_modifications(ReadString());
        string weaponarena_list = translate_weaponarena(ReadString());
        string cache_mutatormsg = ReadString();
index c46c151f23c561769d120ea7dee619f75021d615..15cac948a7d3a655b2a6790637c9b3ef9151f900 100644 (file)
@@ -1018,28 +1018,15 @@ void ClientPreConnect(entity this)
 }
 #endif
 
-string GetClientVersionMessage(entity this)
-{
-       if (CS(this).version_mismatch) {
-               if(CS(this).version < autocvar_gameversion) {
-                       return strcat("This is Xonotic ", autocvar_g_xonoticversion,
-                               "\n^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8");
-               } else {
-                       return strcat("This is Xonotic ", autocvar_g_xonoticversion,
-                               "\n^3This server is using an outdated Xonotic version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8");
-               }
-       } else {
-               return strcat("Welcome to Xonotic ", autocvar_g_xonoticversion);
-       }
-}
-
 void SendWelcomemessage(entity this, bool force_centerprint)
 {
        msg_entity = this;
        WriteHeader(MSG_ONE, TE_CSQC_SERVERINFO);
        WriteByte(MSG_ONE, force_centerprint);
        WriteString(MSG_ONE, autocvar_hostname);
-       WriteString(MSG_ONE, GetClientVersionMessage(this));
+       WriteString(MSG_ONE, autocvar_g_xonoticversion);
+       WriteByte(MSG_ONE, CS(this).version_mismatch);
+       WriteByte(MSG_ONE, (CS(this).version < autocvar_gameversion));
 
        MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
        string modifications = M_ARGV(0, string);