summaryrefslogtreecommitdiff
path: root/scene/main/node.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-09 16:14:50 +0100
committerGitHub <noreply@github.com>2022-02-09 16:14:50 +0100
commitf91e5bad8ce2ae30834e0f46be644dbc1d9daf10 (patch)
treee0d7011c83fd853296dfef53b0c972c757a480cd /scene/main/node.cpp
parentd368b88f5c4a79fe28a8e098993bd7012a54fe4b (diff)
parenta18ba63417fba0c73aa198566f3253b9b9a291fa (diff)
Merge pull request #57855 from Faless/mp/4.x_rpc_strings
Diffstat (limited to 'scene/main/node.cpp')
-rw-r--r--scene/main/node.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 6b9d8ab211..d5bc7d111a 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -612,14 +612,15 @@ Variant Node::_rpc_bind(const Variant **p_args, int p_argcount, Callable::CallEr
return Variant();
}
- if (p_args[0]->get_type() != Variant::STRING_NAME) {
+ Variant::Type type = p_args[0]->get_type();
+ if (type != Variant::STRING_NAME && type != Variant::STRING) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
r_error.expected = Variant::STRING_NAME;
return Variant();
}
- StringName method = *p_args[0];
+ StringName method = (*p_args[0]).operator StringName();
rpcp(0, method, &p_args[1], p_argcount - 1);
@@ -641,7 +642,8 @@ Variant Node::_rpc_id_bind(const Variant **p_args, int p_argcount, Callable::Cal
return Variant();
}
- if (p_args[1]->get_type() != Variant::STRING_NAME) {
+ Variant::Type type = p_args[1]->get_type();
+ if (type != Variant::STRING_NAME && type != Variant::STRING) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 1;
r_error.expected = Variant::STRING_NAME;
@@ -649,7 +651,7 @@ Variant Node::_rpc_id_bind(const Variant **p_args, int p_argcount, Callable::Cal
}
int peer_id = *p_args[0];
- StringName method = *p_args[1];
+ StringName method = (*p_args[1]).operator StringName();
rpcp(peer_id, method, &p_args[2], p_argcount - 2);