]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/bool.qh
Merge branch 'TimePath/items' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / bool.qh
1 #ifndef BOOL_H
2 #define BOOL_H
3
4 #ifndef QCC_SUPPORT_BOOL
5         // Boolean Constants
6         const int true  = 1;
7         const int false = 0;
8 #endif
9
10 // Transitional aliases
11 [[deprecated("use true")]][[alias("true")]] const bool TRUE;
12 [[deprecated("use false")]][[alias("false")]] const bool FALSE;
13
14 // get true/false value of a string with multiple different inputs
15 float InterpretBoolean(string input)
16 {
17         switch (strtolower(input))
18         {
19                 case "yes":
20                 case "true":
21                 case "on":
22                         return true;
23
24                 case "no":
25                 case "false":
26                 case "off":
27                         return false;
28
29                 default: return stof(input);
30         }
31 }
32
33 #define boolean(value) ((value) != 0)
34
35 #endif