diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/enet/networked_multiplayer_enet.cpp | 1 | ||||
-rw-r--r-- | modules/gdnative/gdnative/dictionary.cpp | 14 | ||||
-rw-r--r-- | modules/gdnative/gdnative_api.json | 25 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/dictionary.h | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_tokenizer.cpp | 4 |
6 files changed, 38 insertions, 12 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 871c33bb35..000917507a 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -433,7 +433,6 @@ bool NetworkedMultiplayerENet::is_server() const { void NetworkedMultiplayerENet::close_connection(uint32_t wait_usec) { ERR_FAIL_COND(!active); - ERR_FAIL_COND(wait_usec < 0); _pop_current_packet(); diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp index a18d221a7c..2c6c9e2de2 100644 --- a/modules/gdnative/gdnative/dictionary.cpp +++ b/modules/gdnative/gdnative/dictionary.cpp @@ -155,12 +155,26 @@ godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self) { return raw_dest; } +// GDNative core 1.1 + godot_bool GDAPI godot_dictionary_erase_with_return(godot_dictionary *p_self, const godot_variant *p_key) { Dictionary *self = (Dictionary *)p_self; const Variant *key = (const Variant *)p_key; return self->erase(*key); } +godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default) { + const Dictionary *self = (const Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + const Variant *def = (const Variant *)p_default; + + godot_variant raw_dest; + Variant *dest = (Variant *)&raw_dest; + memnew_placement(dest, Variant(self->get(*key, *def))); + + return raw_dest; +} + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 7680471409..bdcd51085f 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -107,6 +107,23 @@ ] }, { + "name": "godot_dictionary_get_with_default", + "return_type": "godot_variant", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"], + ["const godot_variant *", "p_default"] + ] + }, + { + "name": "godot_dictionary_erase_with_return", + "return_type": "bool", + "arguments": [ + ["godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"] + ] + }, + { "name": "godot_node_path_get_as_property_path", "return_type": "godot_node_path", "arguments": [ @@ -234,14 +251,6 @@ ] }, { - "name": "godot_dictionary_erase_with_return", - "return_type": "bool", - "arguments": [ - ["godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"] - ] - }, - { "name": "godot_is_instance_valid", "return_type": "bool", "arguments": [ diff --git a/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h index 7703742899..14e35b4692 100644 --- a/modules/gdnative/include/gdnative/dictionary.h +++ b/modules/gdnative/include/gdnative/dictionary.h @@ -94,8 +94,12 @@ godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self); +// GDNative core 1.1 + godot_bool GDAPI godot_dictionary_erase_with_return(godot_dictionary *p_self, const godot_variant *p_key); +godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default); + #ifdef __cplusplus } #endif diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index a642abeb0a..705f39ae78 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -503,7 +503,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s Ref<GDScript> gds = res; if (gds.is_valid() && !gds->is_valid()) { - _set_error("Could not fully preload the script, possible cyclic reference or compilation error."); + _set_error("Could not fully preload the script, possible cyclic reference or compilation error. Use 'load()' instead if a cyclic reference is intended."); return NULL; } diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index dc9f2db331..480bf0fa3c 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -1417,7 +1417,7 @@ StringName GDScriptTokenizerBuffer::get_token_identifier(int p_offset) const { ERR_FAIL_INDEX_V(offset, tokens.size(), StringName()); uint32_t identifier = tokens[offset] >> TOKEN_BITS; - ERR_FAIL_INDEX_V(identifier, (uint32_t)identifiers.size(), StringName()); + ERR_FAIL_UNSIGNED_INDEX_V(identifier, identifiers.size(), StringName()); return identifiers[identifier]; } @@ -1473,7 +1473,7 @@ const Variant &GDScriptTokenizerBuffer::get_token_constant(int p_offset) const { int offset = token + p_offset; ERR_FAIL_INDEX_V(offset, tokens.size(), nil); uint32_t constant = tokens[offset] >> TOKEN_BITS; - ERR_FAIL_INDEX_V(constant, (uint32_t)constants.size(), nil); + ERR_FAIL_UNSIGNED_INDEX_V(constant, constants.size(), nil); return constants[constant]; } String GDScriptTokenizerBuffer::get_token_error(int p_offset) const { |