From 01c3cd88d5407545537ca8344476d44441deb518 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 15 Aug 2023 10:24:18 +0200 Subject: [PATCH] Make sure rpc binds can take both Strings and StringNames as method names. --- scene/main/node.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 61982ca70..135f21e3d 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -888,10 +888,10 @@ Variant Node::_rpc_bind(const Variant **p_args, int p_argcount, Variant::CallErr return Variant(); } - if (p_args[0]->get_type() != Variant::STRING) { + if (p_args[0]->get_type() != Variant::STRING && p_args[0]->get_type() != Variant::STRING_NAME) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::STRING; + r_error.expected = Variant::STRING_NAME; return Variant(); } @@ -917,10 +917,10 @@ Variant Node::_rpc_id_bind(const Variant **p_args, int p_argcount, Variant::Call return Variant(); } - if (p_args[1]->get_type() != Variant::STRING) { + if (p_args[1]->get_type() != Variant::STRING && p_args[0]->get_type() != Variant::STRING_NAME) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 1; - r_error.expected = Variant::STRING; + r_error.expected = Variant::STRING_NAME; return Variant(); } @@ -940,10 +940,10 @@ Variant Node::_rpc_unreliable_bind(const Variant **p_args, int p_argcount, Varia return Variant(); } - if (p_args[0]->get_type() != Variant::STRING) { + if (p_args[0]->get_type() != Variant::STRING && p_args[0]->get_type() != Variant::STRING_NAME) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::STRING; + r_error.expected = Variant::STRING_NAME; return Variant(); } @@ -969,10 +969,10 @@ Variant Node::_rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Va return Variant(); } - if (p_args[1]->get_type() != Variant::STRING) { + if (p_args[1]->get_type() != Variant::STRING && p_args[0]->get_type() != Variant::STRING_NAME) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 1; - r_error.expected = Variant::STRING; + r_error.expected = Variant::STRING_NAME; return Variant(); } @@ -993,11 +993,11 @@ Variant Node::_vrpc_bind(const Variant **p_args, int p_argcount, Variant::CallEr return Variant(); } - if (p_args[0]->get_type() != Variant::STRING) { + if (p_args[0]->get_type() != Variant::STRING && p_args[0]->get_type() != Variant::STRING_NAME) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::STRING; + r_error.expected = Variant::STRING_NAME; return Variant(); } @@ -1034,11 +1034,11 @@ Variant Node::_vrpc_unreliable_bind(const Variant **p_args, int p_argcount, Vari return Variant(); } - if (p_args[0]->get_type() != Variant::STRING) { + if (p_args[0]->get_type() != Variant::STRING && p_args[0]->get_type() != Variant::STRING_NAME) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::STRING; + r_error.expected = Variant::STRING_NAME; return Variant(); }