]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
LOG_HELP: print a new line only if missing, like LOG_INFO does. It fixes console...
authorterencehill <piuntn@gmail.com>
Wed, 5 Oct 2022 13:21:08 +0000 (15:21 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 5 Oct 2022 13:21:08 +0000 (15:21 +0200)
qcsrc/lib/log.qh

index 317fc8dedb363f316b359faf58369a573473cdf8..f33202f939ddaf975aa785b3fdd924372d6e1d11 100644 (file)
@@ -91,10 +91,14 @@ string(string, string...) strcat1n = #115;
                if (autocvar_developer > 1) dprint(msg); \
        MACRO_END
 
-// simpler version for help messages
+// same as LOG_INFO but without any debug information that bloats console output and compiled program files
 #define  LOG_HELP(...) _LOG_HELP(strcat1n(__VA_ARGS__))
 #define  LOG_HELPF(...) _LOG_HELP(sprintf(__VA_ARGS__))
-#define _LOG_HELP(s) print("^7", s, "\n")
+#define _LOG_HELP(s) \
+       MACRO_BEGIN \
+               string __s = s; \
+               print("^7", __s, (str2chr(__s, strlen(__s) - 1) != '\n') ? "\n" : ""); \
+       MACRO_END
 
 // TODO: this sucks, lets find a better way to do backtraces?
 #define _backtrace() builtin_remove(NULL)