summaryrefslogtreecommitdiff
path: root/modules/visual_script
diff options
context:
space:
mode:
authorSaracen <SaracenOne@gmail.com>2017-02-06 22:44:22 +0000
committerSaracen <SaracenOne@gmail.com>2017-02-28 21:52:33 +0000
commit5e938f000136c076f9f35b8332dc7c022687a983 (patch)
treea8e79b3f4a557ce4097791f5622728c69d22764f /modules/visual_script
parent0f8c6dd3822c38b8145f08265abb9eba479f4d15 (diff)
Inf and NaN support added to GDScript.
Diffstat (limited to 'modules/visual_script')
-rw-r--r--modules/visual_script/visual_script_expression.cpp6
-rw-r--r--modules/visual_script/visual_script_nodes.cpp6
-rw-r--r--modules/visual_script/visual_script_nodes.h4
3 files changed, 14 insertions, 2 deletions
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index cc3b5f2174..f14aee5d71 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -558,6 +558,12 @@ Error VisualScriptExpression::_get_token(Token& r_token) {
} else if (id=="PI") {
r_token.type=TK_CONSTANT;
r_token.value=Math_PI;
+ } else if (id == "INF") {
+ r_token.type = TK_CONSTANT;
+ r_token.value = Math_INF;
+ } else if (id == "NAN") {
+ r_token.type = TK_CONSTANT;
+ r_token.value = Math_NAN;
} else if (id=="not") {
r_token.type=TK_OP_NOT;
} else if (id=="or") {
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index d1ee5be378..f01284feba 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1738,6 +1738,8 @@ const char* VisualScriptMathConstant::const_name[MATH_CONSTANT_MAX]={
"PI/2",
"E",
"Sqrt2",
+ "INF",
+ "NAN"
};
double VisualScriptMathConstant::const_value[MATH_CONSTANT_MAX]={
@@ -1746,7 +1748,9 @@ double VisualScriptMathConstant::const_value[MATH_CONSTANT_MAX]={
Math_PI*2,
Math_PI*0.5,
2.71828182845904523536,
- Math::sqrt(2.0)
+ Math::sqrt(2.0),
+ Math_INF,
+ Math_NAN
};
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index 7a06fbf5e8..25d07ccb86 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -467,7 +467,9 @@ public:
MATH_CONSTANT_HALF_PI,
MATH_CONSTANT_E,
MATH_CONSTANT_SQRT2,
- MATH_CONSTANT_MAX,
+ MATH_CONSTANT_INF,
+ MATH_CONSTANT_NAN,
+ MATH_CONSTANT_MAX
};
private: