Make sure rpc binds can take both Strings and StringNames as method names.

This commit is contained in:
Relintai 2023-08-15 10:24:18 +02:00
parent c80ee8d7bf
commit 01c3cd88d5

View File

@ -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();
}