summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2018-10-25 20:20:20 -0400
committerAaron Franke <arnfranke@yahoo.com>2019-04-30 13:49:17 -0400
commit620ec4703fa8790ac01a8c1e05212d85776cf9b9 (patch)
tree3e90d3bcbda95a4f148367b0e6aced874e369c95 /core
parentdd2cd06165670bb0d78bf4aa397935be15716e76 (diff)
Make "decimal" functions more consistent
In GDScript, rename "decimals" to "step_decimals". In C#, add "StepDecimals", but keep the old functionality in a method called "DecimalCount".
Diffstat (limited to 'core')
-rw-r--r--core/math/expression.cpp7
-rw-r--r--core/math/expression.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 133dcc7ab9..079c9b524f 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -64,6 +64,7 @@ const char *Expression::func_name[Expression::FUNC_MAX] = {
"is_inf",
"ease",
"decimals",
+ "step_decimals",
"stepify",
"lerp",
"inverse_lerp",
@@ -149,6 +150,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) {
case MATH_ISNAN:
case MATH_ISINF:
case MATH_DECIMALS:
+ case MATH_STEP_DECIMALS:
case MATH_SEED:
case MATH_RANDSEED:
case MATH_DEG2RAD:
@@ -365,6 +367,11 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
VALIDATE_ARG_NUM(0);
*r_return = Math::step_decimals((double)*p_inputs[0]);
} break;
+ case MATH_STEP_DECIMALS: {
+
+ VALIDATE_ARG_NUM(0);
+ *r_return = Math::step_decimals((double)*p_inputs[0]);
+ } break;
case MATH_STEPIFY: {
VALIDATE_ARG_NUM(0);
diff --git a/core/math/expression.h b/core/math/expression.h
index f9075cb689..f20619f0b6 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -62,6 +62,7 @@ public:
MATH_ISINF,
MATH_EASE,
MATH_DECIMALS,
+ MATH_STEP_DECIMALS,
MATH_STEPIFY,
MATH_LERP,
MATH_INVERSE_LERP,