diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-07-21 10:40:31 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-07-21 10:41:08 +0200 |
commit | 4bd5e4fd9b80384d511e4c8f2f642b43159aba4c (patch) | |
tree | 092ae6bcfd67e321558102c03f162200ba9e909e /modules/gdscript | |
parent | 8cc599db645a356ca6af3bc15e7574fa6e3ada0e (diff) |
Use the standard C `INFINITY` and `NAN` constants directly
The `Math_INF` and `Math_NAN` defines were just aliases for those
constants, so we might as well use them directly.
Some portions of the code were already using `INFINITY` directly.
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index d0b7722847..f7113674ec 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1637,8 +1637,8 @@ void GDScriptLanguage::init() { _add_global(StaticCString::create("PI"), Math_PI); _add_global(StaticCString::create("TAU"), Math_TAU); - _add_global(StaticCString::create("INF"), Math_INF); - _add_global(StaticCString::create("NAN"), Math_NAN); + _add_global(StaticCString::create("INF"), INFINITY); + _add_global(StaticCString::create("NAN"), NAN); //populate native classes diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index c1a7bedbc8..79023df284 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -457,12 +457,12 @@ void GDScriptLanguage::get_public_constants(List<Pair<String, Variant>> *p_const Pair<String, Variant> infinity; infinity.first = "INF"; - infinity.second = Math_INF; + infinity.second = INFINITY; p_constants->push_back(infinity); Pair<String, Variant> nan; nan.first = "NAN"; - nan.second = Math_NAN; + nan.second = NAN; p_constants->push_back(nan); } diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index df36afc0f0..e103d86b15 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2123,10 +2123,10 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_builtin_constant(Expressio constant->value = Math_TAU; break; case GDScriptTokenizer::Token::CONST_INF: - constant->value = Math_INF; + constant->value = INFINITY; break; case GDScriptTokenizer::Token::CONST_NAN: - constant->value = Math_NAN; + constant->value = NAN; break; default: return nullptr; // Unreachable. |