diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2017-12-15 16:05:42 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2017-12-15 17:14:17 +0100 |
commit | 92067b4714eaf0d2a9be6b4fc50cc9e156c74cad (patch) | |
tree | 7b50d25b88ba333ecd9d39d97400d27285c6edce /modules | |
parent | 72d5ae84b30c805692e132e2103e14e6cc304e34 (diff) |
Remove "const" from PacketPeer get_packet/get_var
They are NOT constant methods, as state by the comment message,
they fetch the last packet and then forget about it, actively
changing the state of the object.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/enet/networked_multiplayer_enet.cpp | 4 | ||||
-rw-r--r-- | modules/enet/networked_multiplayer_enet.h | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index ce485956b4..396bebf0ea 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -386,7 +386,7 @@ int NetworkedMultiplayerENet::get_available_packet_count() const { return incoming_packets.size(); } -Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const { +Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { ERR_FAIL_COND_V(incoming_packets.size() == 0, ERR_UNAVAILABLE); @@ -480,7 +480,7 @@ int NetworkedMultiplayerENet::get_max_packet_size() const { return 1 << 24; //anything is good } -void NetworkedMultiplayerENet::_pop_current_packet() const { +void NetworkedMultiplayerENet::_pop_current_packet() { if (current_packet.packet) { enet_packet_destroy(current_packet.packet); diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index 81d517147d..d7bc5c7849 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -86,12 +86,12 @@ private: CompressionMode compression_mode; - mutable List<Packet> incoming_packets; + List<Packet> incoming_packets; - mutable Packet current_packet; + Packet current_packet; uint32_t _gen_unique_id() const; - void _pop_current_packet() const; + void _pop_current_packet(); Vector<uint8_t> src_compressor_mem; Vector<uint8_t> dst_compressor_mem; @@ -123,7 +123,7 @@ public: virtual bool is_server() const; virtual int get_available_packet_count() const; - virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const; ///< buffer is GONE after next get_packet + virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size); ///< buffer is GONE after next get_packet virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size); virtual int get_max_packet_size() const; |