You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created. * Limited arguments to 5 (then later changed to 8) in many places. * They were replaced by C++11 Variadic Templates. * Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard. * Also added a dereference check for Variant*. Helped catch a couple of bugs.
This commit is contained in:
@@ -211,7 +211,7 @@ void Node::_propagate_enter_tree() {
|
||||
if (data.parent) {
|
||||
Variant c = this;
|
||||
const Variant *cptr = &c;
|
||||
data.parent->emit_signal(SNAME("child_entered_tree"), &cptr, 1);
|
||||
data.parent->emit_signalp(SNAME("child_entered_tree"), &cptr, 1);
|
||||
}
|
||||
|
||||
data.blocked++;
|
||||
@@ -287,7 +287,7 @@ void Node::_propagate_exit_tree() {
|
||||
if (data.parent) {
|
||||
Variant c = this;
|
||||
const Variant *cptr = &c;
|
||||
data.parent->emit_signal(SNAME("child_exited_tree"), &cptr, 1);
|
||||
data.parent->emit_signalp(SNAME("child_exited_tree"), &cptr, 1);
|
||||
}
|
||||
|
||||
// exit groups
|
||||
@@ -582,34 +582,6 @@ uint16_t Node::rpc_config(const StringName &p_method, Multiplayer::RPCMode p_rpc
|
||||
|
||||
/***** RPC FUNCTIONS ********/
|
||||
|
||||
void Node::rpc(const StringName &p_method, VARIANT_ARG_DECLARE) {
|
||||
VARIANT_ARGPTRS;
|
||||
|
||||
int argc = 0;
|
||||
for (int i = 0; i < VARIANT_ARG_MAX; i++) {
|
||||
if (argptr[i]->get_type() == Variant::NIL) {
|
||||
break;
|
||||
}
|
||||
argc++;
|
||||
}
|
||||
|
||||
rpcp(0, p_method, argptr, argc);
|
||||
}
|
||||
|
||||
void Node::rpc_id(int p_peer_id, const StringName &p_method, VARIANT_ARG_DECLARE) {
|
||||
VARIANT_ARGPTRS;
|
||||
|
||||
int argc = 0;
|
||||
for (int i = 0; i < VARIANT_ARG_MAX; i++) {
|
||||
if (argptr[i]->get_type() == Variant::NIL) {
|
||||
break;
|
||||
}
|
||||
argc++;
|
||||
}
|
||||
|
||||
rpcp(p_peer_id, p_method, argptr, argc);
|
||||
}
|
||||
|
||||
Variant Node::_rpc_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
|
||||
if (p_argcount < 1) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
@@ -2389,42 +2361,6 @@ void Node::_replace_connections_target(Node *p_new_target) {
|
||||
}
|
||||
}
|
||||
|
||||
Vector<Variant> Node::make_binds(VARIANT_ARG_DECLARE) {
|
||||
Vector<Variant> ret;
|
||||
|
||||
if (p_arg1.get_type() == Variant::NIL) {
|
||||
return ret;
|
||||
} else {
|
||||
ret.push_back(p_arg1);
|
||||
}
|
||||
|
||||
if (p_arg2.get_type() == Variant::NIL) {
|
||||
return ret;
|
||||
} else {
|
||||
ret.push_back(p_arg2);
|
||||
}
|
||||
|
||||
if (p_arg3.get_type() == Variant::NIL) {
|
||||
return ret;
|
||||
} else {
|
||||
ret.push_back(p_arg3);
|
||||
}
|
||||
|
||||
if (p_arg4.get_type() == Variant::NIL) {
|
||||
return ret;
|
||||
} else {
|
||||
ret.push_back(p_arg4);
|
||||
}
|
||||
|
||||
if (p_arg5.get_type() == Variant::NIL) {
|
||||
return ret;
|
||||
} else {
|
||||
ret.push_back(p_arg5);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Node::has_node_and_resource(const NodePath &p_path) const {
|
||||
if (!has_node(p_path)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user