Merge pull request #57855 from Faless/mp/4.x_rpc_strings

This commit is contained in:
Rémi Verschelde 2022-02-09 16:14:50 +01:00 committed by GitHub
commit f91e5bad8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -612,14 +612,15 @@ Variant Node::_rpc_bind(const Variant **p_args, int p_argcount, Callable::CallEr
return Variant(); 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.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0; r_error.argument = 0;
r_error.expected = Variant::STRING_NAME; r_error.expected = Variant::STRING_NAME;
return Variant(); return Variant();
} }
StringName method = *p_args[0]; StringName method = (*p_args[0]).operator StringName();
rpcp(0, method, &p_args[1], p_argcount - 1); 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(); 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.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 1; r_error.argument = 1;
r_error.expected = Variant::STRING_NAME; 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]; 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); rpcp(peer_id, method, &p_args[2], p_argcount - 2);