From: TimePath Date: Thu, 17 Dec 2015 22:31:44 +0000 (+1100) Subject: assert: devassert, hidden outside developer mode X-Git-Tag: xonotic-v0.8.2~1481 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d4039068bcd8ffda0c8b77344ed3a4af5490b123;p=xonotic%2Fxonotic-data.pk3dir.git assert: devassert, hidden outside developer mode --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 4be14ad5c..6b5cf6463 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -167,7 +167,7 @@ void Shutdown() .float has_team; float SetTeam(entity o, int Team) { - assert_once(Team); + devassert_once(Team); entity tm; if(teamplay) { diff --git a/qcsrc/lib/log.qh b/qcsrc/lib/log.qh index a5b46926b..0a75d3a58 100644 --- a/qcsrc/lib/log.qh +++ b/qcsrc/lib/log.qh @@ -2,6 +2,8 @@ #define LOG_H #define assert(expr, ...) _assert(LOG_SEVERE, expr, __VA_ARGS__) +#define devassert(...) MACRO_BEGIN if (autocvar_developer) assert(__VA_ARGS__); MACRO_END + #define assert_once(expr, ...) \ MACRO_BEGIN { \ static bool __once; \ @@ -11,7 +13,11 @@ __once = true; \ } \ } MACRO_END +#define devassert_once(...) MACRO_BEGIN if (autocvar_developer) assert_once(__VA_ARGS__); MACRO_END + #define demand(expr, ...) _assert(LOG_FATAL, expr, __VA_ARGS__) +#define devdemand(...) MACRO_BEGIN if (autocvar_developer) demand(__VA_ARGS__); MACRO_END + #define _assert(f, expr, then) \ MACRO_BEGIN \ { \