aboutsummaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorJuan Linietsky2017-11-25 00:07:54 -0300
committerJuan Linietsky2017-11-25 00:09:40 -0300
commitbc2e8d99e5ae0dbd69e712cc71da3033f5f30139 (patch)
treed836011e3d5873e3ceea328ea3100f3c7719ab99 /scene/main
parent7dfba3cda9f13427f9f10a6eefbec52aef62274c (diff)
downloadgodot-bc2e8d99.tar.gz
godot-bc2e8d99.tar.zst
godot-bc2e8d99.zip
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 'scene/main')
-rw-r--r--scene/main/node.cpp2
-rw-r--r--scene/main/scene_tree.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 31d423c80..506dc8547 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1198,7 +1198,7 @@ void Node::_validate_child_name(Node *p_child, bool p_force_human_readable) {
unique = false;
} else {
//check if exists
- Node **childs = data.children.ptr();
+ Node **childs = data.children.ptrw();
int cc = data.children.size();
for (int i = 0; i < cc; i++) {
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index d4be683a2..17abf2425 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1001,7 +1001,7 @@ Array SceneTree::_get_nodes_in_group(const StringName &p_group) {
ret.resize(nc);
- Node **ptr = E->get().nodes.ptr();
+ Node **ptr = E->get().nodes.ptrw();
for (int i = 0; i < nc; i++) {
ret[i] = ptr[i];
@@ -1024,7 +1024,7 @@ void SceneTree::get_nodes_in_group(const StringName &p_group, List<Node *> *p_li
int nc = E->get().nodes.size();
if (nc == 0)
return;
- Node **ptr = E->get().nodes.ptr();
+ Node **ptr = E->get().nodes.ptrw();
for (int i = 0; i < nc; i++) {
p_list->push_back(ptr[i]);
@@ -1997,9 +1997,9 @@ void SceneTree::_network_process_packet(int p_from, const uint8_t *p_packet, int
Variant::CallError ce;
- node->call(name, argp.ptr(), argc, ce);
+ node->call(name, (const Variant **)argp.ptr(), argc, ce);
if (ce.error != Variant::CallError::CALL_OK) {
- String error = Variant::get_call_error_text(node, name, argp.ptr(), argc, ce);
+ String error = Variant::get_call_error_text(node, name, (const Variant **)argp.ptr(), argc, ce);
error = "RPC - " + error;
ERR_PRINTS(error);
}