mirror of
https://github.com/godotengine/godot.git
synced 2024-12-25 20:33:24 +00:00
Merge pull request #25010 from Faless/mp/fix_init
Fix MultiplayerAPI initialization, clear, set_network_peer.
This commit is contained in:
commit
d8cca33038
@ -122,6 +122,7 @@ void MultiplayerAPI::clear() {
|
|||||||
connected_peers.clear();
|
connected_peers.clear();
|
||||||
path_get_cache.clear();
|
path_get_cache.clear();
|
||||||
path_send_cache.clear();
|
path_send_cache.clear();
|
||||||
|
packet_cache.clear();
|
||||||
last_send_cache_id = 1;
|
last_send_cache_id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,6 +132,8 @@ void MultiplayerAPI::set_root_node(Node *p_node) {
|
|||||||
|
|
||||||
void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer) {
|
void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer) {
|
||||||
|
|
||||||
|
if (p_peer == network_peer) return; // Nothing to do
|
||||||
|
|
||||||
if (network_peer.is_valid()) {
|
if (network_peer.is_valid()) {
|
||||||
network_peer->disconnect("peer_connected", this, "_add_peer");
|
network_peer->disconnect("peer_connected", this, "_add_peer");
|
||||||
network_peer->disconnect("peer_disconnected", this, "_del_peer");
|
network_peer->disconnect("peer_disconnected", this, "_del_peer");
|
||||||
@ -857,6 +860,8 @@ void MultiplayerAPI::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MultiplayerAPI::MultiplayerAPI() {
|
MultiplayerAPI::MultiplayerAPI() {
|
||||||
|
rpc_sender_id = 0;
|
||||||
|
root_node = NULL;
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user