From a267e7e102566726ded271ebeac8a93cd8001854 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 29 Aug 2015 16:21:30 +1000 Subject: [PATCH] Fix "system vars have been modified" CRC mismatch --- qcsrc/common/util-pre.qh | 12 ----------- qcsrc/common/util.qc | 21 ------------------- qcsrc/common/util.qh | 4 ---- qcsrc/lib/Bool.qh | 39 +++++++++++++++++++++++++++++++++++ qcsrc/lib/_all.inc | 2 ++ qcsrc/server/miscfunctions.qc | 4 ---- 6 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 qcsrc/lib/Bool.qh diff --git a/qcsrc/common/util-pre.qh b/qcsrc/common/util-pre.qh index b96e78d51..b81fd2a6d 100644 --- a/qcsrc/common/util-pre.qh +++ b/qcsrc/common/util-pre.qh @@ -29,18 +29,6 @@ #define itos(i) ftos(i) #endif -#ifndef QCC_SUPPORT_BOOL - #define bool float - - // Boolean Constants - const int true = 1; - const int false = 0; -#endif - -// Transitional aliases -[[deprecated("use true")]] [[alias("true")]] const bool TRUE; -[[deprecated("use false")]] [[alias("false")]] const bool FALSE; - #define FOREACH_ARRAY(arr, start, end, cond, body) do { \ for (int i = start; i < end; ++i) { \ const noref entity it = arr[i]; \ diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index eb744a989..8c1e127dc 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -2306,27 +2306,6 @@ string MakeConsoleSafe(string input) return input; } -#ifndef MENUQC -// get true/false value of a string with multiple different inputs -float InterpretBoolean(string input) -{ - switch(strtolower(input)) - { - case "yes": - case "true": - case "on": - return true; - - case "no": - case "false": - case "off": - return false; - - default: return stof(input); - } -} -#endif - #ifdef CSQC entity ReadCSQCEntity() { diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 8a77ba18f..e3fab47b7 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -246,10 +246,6 @@ string strtolower(string s); string MakeConsoleSafe(string input); -#ifndef MENUQC -float InterpretBoolean(string input); -#endif - // generic shutdown handler void Shutdown(); diff --git a/qcsrc/lib/Bool.qh b/qcsrc/lib/Bool.qh new file mode 100644 index 000000000..26169cd19 --- /dev/null +++ b/qcsrc/lib/Bool.qh @@ -0,0 +1,39 @@ +#ifndef BOOL_H +#define BOOL_H + +#ifndef QCC_SUPPORT_BOOL + #define bool float + + // Boolean Constants + const int true = 1; + const int false = 0; +#endif + +// Transitional aliases +[[deprecated("use true")]] [[alias("true")]] const bool TRUE; +[[deprecated("use false")]] [[alias("false")]] const bool FALSE; + +// get true/false value of a string with multiple different inputs +float InterpretBoolean(string input) +{ + switch (strtolower(input)) + { + case "yes": + case "true": + case "on": + return true; + + case "no": + case "false": + case "off": + return false; + + default: return stof(input); + } +} + +float boolean(float value) { // if value is 0 return false (0), otherwise return true (1) + return (value == 0) ? false : true; +} + +#endif diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index ba432ad2a..4e0b12f25 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -1,3 +1,5 @@ +#include "Bool.qh" + #include "../warpzonelib/mathlib.qc" #include "Accumulate.qh" diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 0dabbf0fa..60640441a 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -312,10 +312,6 @@ string formatmessage(string msg) return msg; } -float boolean(float value) { // if value is 0 return false (0), otherwise return true (1) - return (value == 0) ? false : true; -} - /* ============= GetCvars -- 2.39.2