diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /modules/enet/networked_multiplayer_enet.h | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to '')
| -rw-r--r-- | modules/enet/networked_multiplayer_enet.h | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index dcf8c2429..4e95adec1 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -29,13 +29,13 @@ #ifndef NETWORKED_MULTIPLAYER_ENET_H #define NETWORKED_MULTIPLAYER_ENET_H -#include "io/networked_multiplayer_peer.h" #include "enet/enet.h" #include "io/compression.h" +#include "io/networked_multiplayer_peer.h" class NetworkedMultiplayerENet : public NetworkedMultiplayerPeer { - GDCLASS(NetworkedMultiplayerENet,NetworkedMultiplayerPeer) + GDCLASS(NetworkedMultiplayerENet, NetworkedMultiplayerPeer) public: enum CompressionMode { COMPRESS_NONE, @@ -43,9 +43,8 @@ public: COMPRESS_FASTLZ, COMPRESS_ZLIB }; -private: - +private: enum { SYSMSG_ADD_PEER, SYSMSG_REMOVE_PEER @@ -74,7 +73,7 @@ private: ConnectionStatus connection_status; - Map<int,ENetPeer*> peer_map; + Map<int, ENetPeer *> peer_map; struct Packet { @@ -95,25 +94,24 @@ private: Vector<uint8_t> dst_compressor_mem; ENetCompressor enet_compressor; - static size_t enet_compress(void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit); - static size_t enet_decompress (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit); - static void enet_compressor_destroy(void * context); + static size_t enet_compress(void *context, const ENetBuffer *inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 *outData, size_t outLimit); + static size_t enet_decompress(void *context, const enet_uint8 *inData, size_t inLimit, enet_uint8 *outData, size_t outLimit); + static void enet_compressor_destroy(void *context); void _setup_compressor(); enet_uint32 bind_ip; + protected: static void _bind_methods(); -public: +public: virtual void set_transfer_mode(TransferMode p_mode); virtual void set_target_peer(int p_peer); - virtual int get_packet_peer() const; - - Error create_server(int p_port, int p_max_peers=32, int p_in_bandwidth=0, int p_out_bandwidth=0); - Error create_client(const IP_Address& p_ip, int p_port, int p_in_bandwidth=0, int p_out_bandwidth=0); + Error create_server(int p_port, int p_max_peers = 32, int p_in_bandwidth = 0, int p_out_bandwidth = 0); + Error create_client(const IP_Address &p_ip, int p_port, int p_in_bandwidth = 0, int p_out_bandwidth = 0); void close_connection(); @@ -122,8 +120,8 @@ 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 put_packet(const uint8_t *p_buffer,int p_buffer_size); + virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const; ///< 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; @@ -140,10 +138,9 @@ public: NetworkedMultiplayerENet(); ~NetworkedMultiplayerENet(); - void set_bind_ip(const IP_Address& p_ip); + void set_bind_ip(const IP_Address &p_ip); }; VARIANT_ENUM_CAST(NetworkedMultiplayerENet::CompressionMode); - #endif // NETWORKED_MULTIPLAYER_ENET_H |
