parent
90b4a3fa75
commit
fb8e21bd6d
|
@ -144,6 +144,18 @@ void CallableCustomBind::call(const Variant **p_arguments, int p_argcount, Varia
|
||||||
callable.callp(args, p_argcount + binds.size(), r_return_value, r_call_error);
|
callable.callp(args, p_argcount + binds.size(), r_return_value, r_call_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Error CallableCustomBind::rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const {
|
||||||
|
const Variant **args = (const Variant **)alloca(sizeof(const Variant **) * (binds.size() + p_argcount));
|
||||||
|
for (int i = 0; i < p_argcount; i++) {
|
||||||
|
args[i] = (const Variant *)p_arguments[i];
|
||||||
|
}
|
||||||
|
for (int i = 0; i < binds.size(); i++) {
|
||||||
|
args[i + p_argcount] = (const Variant *)&binds[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return callable.rpcp(p_peer_id, args, p_argcount + binds.size(), r_call_error);
|
||||||
|
}
|
||||||
|
|
||||||
CallableCustomBind::CallableCustomBind(const Callable &p_callable, const Vector<Variant> &p_binds) {
|
CallableCustomBind::CallableCustomBind(const Callable &p_callable, const Vector<Variant> &p_binds) {
|
||||||
callable = p_callable;
|
callable = p_callable;
|
||||||
binds = p_binds;
|
binds = p_binds;
|
||||||
|
@ -242,6 +254,16 @@ void CallableCustomUnbind::call(const Variant **p_arguments, int p_argcount, Var
|
||||||
callable.callp(p_arguments, p_argcount - argcount, r_return_value, r_call_error);
|
callable.callp(p_arguments, p_argcount - argcount, r_return_value, r_call_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Error CallableCustomUnbind::rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const {
|
||||||
|
if (argcount > p_argcount) {
|
||||||
|
r_call_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
|
r_call_error.argument = 0;
|
||||||
|
r_call_error.expected = argcount;
|
||||||
|
return ERR_UNCONFIGURED;
|
||||||
|
}
|
||||||
|
return callable.rpcp(p_peer_id, p_arguments, p_argcount - argcount, r_call_error);
|
||||||
|
}
|
||||||
|
|
||||||
CallableCustomUnbind::CallableCustomUnbind(const Callable &p_callable, int p_argcount) {
|
CallableCustomUnbind::CallableCustomUnbind(const Callable &p_callable, int p_argcount) {
|
||||||
callable = p_callable;
|
callable = p_callable;
|
||||||
argcount = p_argcount;
|
argcount = p_argcount;
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
virtual StringName get_method() const override;
|
virtual StringName get_method() const override;
|
||||||
virtual ObjectID get_object() const override;
|
virtual ObjectID get_object() const override;
|
||||||
virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override;
|
virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override;
|
||||||
|
virtual Error rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const override;
|
||||||
virtual const Callable *get_base_comparator() const override;
|
virtual const Callable *get_base_comparator() const override;
|
||||||
virtual int get_bound_arguments_count() const override;
|
virtual int get_bound_arguments_count() const override;
|
||||||
virtual void get_bound_arguments(Vector<Variant> &r_arguments, int &r_argcount) const override;
|
virtual void get_bound_arguments(Vector<Variant> &r_arguments, int &r_argcount) const override;
|
||||||
|
@ -78,6 +79,7 @@ public:
|
||||||
virtual StringName get_method() const override;
|
virtual StringName get_method() const override;
|
||||||
virtual ObjectID get_object() const override;
|
virtual ObjectID get_object() const override;
|
||||||
virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override;
|
virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override;
|
||||||
|
virtual Error rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const override;
|
||||||
virtual const Callable *get_base_comparator() const override;
|
virtual const Callable *get_base_comparator() const override;
|
||||||
virtual int get_bound_arguments_count() const override;
|
virtual int get_bound_arguments_count() const override;
|
||||||
virtual void get_bound_arguments(Vector<Variant> &r_arguments, int &r_argcount) const override;
|
virtual void get_bound_arguments(Vector<Variant> &r_arguments, int &r_argcount) const override;
|
||||||
|
|
Loading…
Reference in New Issue