diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-11-25 00:07:54 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-11-25 00:09:40 -0300 |
commit | bc2e8d99e5ae0dbd69e712cc71da3033f5f30139 (patch) | |
tree | d836011e3d5873e3ceea328ea3100f3c7719ab99 /modules/gdscript | |
parent | 7dfba3cda9f13427f9f10a6eefbec52aef62274c (diff) |
Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 6 | ||||
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 41a810ff00..9496d0b310 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -100,7 +100,7 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco #endif instance->owner->set_script_instance(instance); - /* STEP 2, INITIALIZE AND CONSRTUCT */ +/* STEP 2, INITIALIZE AND CONSRTUCT */ #ifndef NO_THREADS GDScriptLanguage::singleton->lock->lock(); @@ -738,7 +738,7 @@ Error GDScript::load_byte_code(const String &p_path) { Error err = fae->open_and_parse(fa, key, FileAccessEncrypted::MODE_READ); ERR_FAIL_COND_V(err, err); bytecode.resize(fae->get_len()); - fae->get_buffer(bytecode.ptr(), bytecode.size()); + fae->get_buffer(bytecode.ptrw(), bytecode.size()); memdelete(fae); } else { @@ -1324,7 +1324,7 @@ void GDScriptLanguage::_add_global(const StringName &p_name, const Variant &p_va } globals[p_name] = global_array.size(); global_array.push_back(p_value); - _global_array = global_array.ptr(); + _global_array = global_array.ptrw(); } void GDScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) { diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 5a76acea6e..e7100d835c 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -29,11 +29,11 @@ /*************************************************************************/ #include "gdscript.h" +#include "core/engine.h" #include "editor/editor_settings.h" #include "gdscript_compiler.h" #include "global_constants.h" #include "os/file_access.h" -#include "core/engine.h" #ifdef TOOLS_ENABLED #include "editor/editor_file_system.h" @@ -791,7 +791,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &context, const GDS } Variant::CallError ce; - Variant ret = mb->call(baseptr, argptr.ptr(), argptr.size(), ce); + Variant ret = mb->call(baseptr, (const Variant **)argptr.ptr(), argptr.size(), ce); if (ce.error == Variant::CallError::CALL_OK && ret.get_type() != Variant::NIL) { @@ -1795,7 +1795,7 @@ static void _find_type_arguments(GDScriptCompletionContext &context, const GDScr } } else { - //regular method +//regular method #if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED) if (p_argidx < m->get_argument_count()) { |