From: terencehill <piuntn@gmail.com>
Date: Fri, 26 Jul 2024 16:55:45 +0000 (+0200)
Subject: Get rid of 2 warnings, one in the client and the other in the dedicated server, print... 
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c94b27cbe172091843af3245c7133ec6a9565a37;p=xonotic%2Fxonotic-data.pk3dir.git

Get rid of 2 warnings, one in the client and the other in the dedicated server, printed at startup

* _def_detect_dedicated and the usage of ${qport ?} instead of ${qport} are meant to avoid this warning in the dedicated server: Could not expand $qport in alias _if_dedicated
* The new _detect_dedicated_ aliases are meant to avoid this warning in the client: Unknown command "_detect_dedicated_60106"
---

diff --git a/commands.cfg b/commands.cfg
index d0726bce5..986765185 100644
--- a/commands.cfg
+++ b/commands.cfg
@@ -2,15 +2,27 @@
 //  Master config for managing various command aliases and settings
 // =================================================================
 
-// Execute commands based on whether it is dedicated a server or a client.
-alias "_detect_dedicated_$qport" "${* asis}"
+// create if_client and if_dedicated aliases that allow executing commands based on
+// whether it is a dedicated server or a client
+alias _def_detect_dedicated "alias _detect_dedicated_${qport ?} \"\""
+_def_detect_dedicated
+alias "_detect_dedicated_" "${* asis}"
+alias "_detect_dedicated_${qport ?}" "${* asis}"
 alias "_detect_dedicated_0" ""
-alias _if_dedicated "_detect_dedicated_$qport ${* asis}"
+alias _if_dedicated "_detect_dedicated_${qport ?} ${* asis}"
 alias if_client "${* asis}"
 alias if_dedicated "${* asis}"
 _if_dedicated alias if_client ""
 if_client alias if_dedicated ""
 
+// these aliases are now useless, remove them
+// NOTE for some reason _detect_dedicated_ no longer exists in dedicated
+unalias _def_detect_dedicated
+if_client unalias "_detect_dedicated_"
+unalias "_detect_dedicated_${qport ?}"
+unalias _detect_dedicated_0
+unalias _if_dedicated
+
 // for easy access by QC
 if_dedicated set is_dedicated 1
 if_client    set is_dedicated 0