mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Fix MultiplayerAPI initialization, clear.
rpc_sender_id is now correctly initialized to 0 so get_rpc_sender_id() work reliably even if called before receiving any RPC. root_node is initialized to NULL (fix crashes when incorrectly using the MultiplayerAPI). clear function now resets the packet cache size to free more memory when not running.
This commit is contained in:
parent
9ed34d4423
commit
1f7846abf8
@ -122,6 +122,7 @@ void MultiplayerAPI::clear() {
|
||||
connected_peers.clear();
|
||||
path_get_cache.clear();
|
||||
path_send_cache.clear();
|
||||
packet_cache.clear();
|
||||
last_send_cache_id = 1;
|
||||
}
|
||||
|
||||
@ -857,6 +858,8 @@ void MultiplayerAPI::_bind_methods() {
|
||||
}
|
||||
|
||||
MultiplayerAPI::MultiplayerAPI() {
|
||||
rpc_sender_id = 0;
|
||||
root_node = NULL;
|
||||
clear();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user