diff options
author | George L. Albany <Megacake1234@gmail.com> | 2024-10-19 02:18:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-19 02:18:31 +0000 |
commit | a480a0518a0ab12e3ccbdbc42f1072883c82bdb7 (patch) | |
tree | 075435b3a1b3ac57a75f1ca90865f61697c053f4 /modules/gdscript/gdscript.cpp | |
parent | edb8e2b1b2b09236bdcd76cb6c8b40b6fbb2abaf (diff) | |
parent | ebbe3e8c51fcf89f6b19a74497cedb5a8c448979 (diff) | |
download | redot-engine-a480a0518a0ab12e3ccbdbc42f1072883c82bdb7.tar.gz |
Merge pull request #759 from Spartan322/merge/80f0b33
Merge commit godotengine/godot@80f0b33
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 36fe68d15a..522932734d 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -695,10 +695,16 @@ void GDScript::_static_default_init() { continue; } if (type.builtin_type == Variant::ARRAY && type.has_container_element_type(0)) { + const GDScriptDataType element_type = type.get_container_element_type(0); Array default_value; - const GDScriptDataType &element_type = type.get_container_element_type(0); default_value.set_typed(element_type.builtin_type, element_type.native_type, element_type.script_type); static_variables.write[E.value.index] = default_value; + } else if (type.builtin_type == Variant::DICTIONARY && type.has_container_element_types()) { + const GDScriptDataType key_type = type.get_container_element_type_or_variant(0); + const GDScriptDataType value_type = type.get_container_element_type_or_variant(1); + Dictionary default_value; + default_value.set_typed(key_type.builtin_type, key_type.native_type, key_type.script_type, value_type.builtin_type, value_type.native_type, value_type.script_type); + static_variables.write[E.value.index] = default_value; } else { Variant default_value; Callable::CallError err; |