diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2019-01-27 14:59:25 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2019-01-28 02:12:50 +0100 |
commit | 14e59ff11206b4a5b211ab882f0b84ef37a947a7 (patch) | |
tree | 7d6fade4f29d42ee511fa105512f595c79007825 /modules/websocket/websocket_multiplayer.cpp | |
parent | 2e5ede7a4e0a230373660a6726a90e1c25cf0d37 (diff) | |
download | redot-engine-14e59ff11206b4a5b211ab882f0b84ef37a947a7.tar.gz |
Update docs and errors for WebSocket module
Diffstat (limited to 'modules/websocket/websocket_multiplayer.cpp')
-rw-r--r-- | modules/websocket/websocket_multiplayer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/websocket/websocket_multiplayer.cpp b/modules/websocket/websocket_multiplayer.cpp index 7c8cc36fad..11caac944b 100644 --- a/modules/websocket/websocket_multiplayer.cpp +++ b/modules/websocket/websocket_multiplayer.cpp @@ -96,6 +96,7 @@ void WebSocketMultiplayerPeer::_bind_methods() { // int WebSocketMultiplayerPeer::get_available_packet_count() const { + ERR_EXPLAIN("Please use get_peer(ID).get_available_packet_count to get available packet count from peers when not using the MultiplayerAPI."); ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED); return _incoming_packets.size(); @@ -103,9 +104,11 @@ int WebSocketMultiplayerPeer::get_available_packet_count() const { Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { - r_buffer_size = 0; + ERR_EXPLAIN("Please use get_peer(ID).get_packet/var to communicate with peers when not using the MultiplayerAPI."); ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED); + r_buffer_size = 0; + if (_current_packet.data != NULL) { memfree(_current_packet.data); _current_packet.data = NULL; @@ -122,6 +125,7 @@ Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buff Error WebSocketMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size) { + ERR_EXPLAIN("Please use get_peer(ID).put_packet/var to communicate with peers when not using the MultiplayerAPI."); ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED); PoolVector<uint8_t> buffer = _make_pkt(SYS_NONE, get_unique_id(), _target_peer, p_buffer, p_buffer_size); @@ -154,6 +158,7 @@ void WebSocketMultiplayerPeer::set_target_peer(int p_target_peer) { int WebSocketMultiplayerPeer::get_packet_peer() const { + ERR_EXPLAIN("This function is not available when not using the MultiplayerAPI."); ERR_FAIL_COND_V(!_is_multiplayer, 1); ERR_FAIL_COND_V(_incoming_packets.size() == 0, 1); |