diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-03-17 08:42:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-17 08:42:39 +0100 |
commit | b8577ecce1bb62a4a589d02bdd71b701e5bdea81 (patch) | |
tree | 6bb58135d05206e31bd597d69ae10889fcf23e85 /modules/webrtc | |
parent | 2658ccb85fd8ddc67d3b4639f7f4886560ff98f8 (diff) | |
parent | cb282c6ef0bb91957f8a6f422705813bd47c788c (diff) |
Merge pull request #37106 from akien-mga/clang-format-cpp11
Style: Set clang-format Standard to Cpp11
Diffstat (limited to 'modules/webrtc')
-rw-r--r-- | modules/webrtc/webrtc_multiplayer.cpp | 26 | ||||
-rw-r--r-- | modules/webrtc/webrtc_multiplayer.h | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/modules/webrtc/webrtc_multiplayer.cpp b/modules/webrtc/webrtc_multiplayer.cpp index 9df2420bbc..c24ae3468f 100644 --- a/modules/webrtc/webrtc_multiplayer.cpp +++ b/modules/webrtc/webrtc_multiplayer.cpp @@ -70,7 +70,7 @@ void WebRTCMultiplayer::poll() { List<int> remove; List<int> add; - for (Map<int, Ref<ConnectedPeer> >::Element *E = peer_map.front(); E; E = E->next()) { + for (Map<int, Ref<ConnectedPeer>>::Element *E = peer_map.front(); E; E = E->next()) { Ref<ConnectedPeer> peer = E->get(); peer->connection->poll(); // Check peer state @@ -89,7 +89,7 @@ void WebRTCMultiplayer::poll() { } // Check channels state int ready = 0; - for (List<Ref<WebRTCDataChannel> >::Element *C = peer->channels.front(); C && C->get().is_valid(); C = C->next()) { + for (List<Ref<WebRTCDataChannel>>::Element *C = peer->channels.front(); C && C->get().is_valid(); C = C->next()) { Ref<WebRTCDataChannel> ch = C->get(); switch (ch->get_ready_state()) { case WebRTCDataChannel::STATE_CONNECTING: @@ -130,7 +130,7 @@ void WebRTCMultiplayer::poll() { emit_signal("peer_connected", TARGET_PEER_SERVER); emit_signal("connection_succeeded"); // Notify of all previously connected peers - for (Map<int, Ref<ConnectedPeer> >::Element *F = peer_map.front(); F; F = F->next()) { + for (Map<int, Ref<ConnectedPeer>>::Element *F = peer_map.front(); F; F = F->next()) { if (F->key() != 1 && F->get()->connected) emit_signal("peer_connected", F->key()); } @@ -143,11 +143,11 @@ void WebRTCMultiplayer::poll() { } void WebRTCMultiplayer::_find_next_peer() { - Map<int, Ref<ConnectedPeer> >::Element *E = peer_map.find(next_packet_peer); + Map<int, Ref<ConnectedPeer>>::Element *E = peer_map.find(next_packet_peer); if (E) E = E->next(); // After last. while (E) { - for (List<Ref<WebRTCDataChannel> >::Element *F = E->get()->channels.front(); F; F = F->next()) { + for (List<Ref<WebRTCDataChannel>>::Element *F = E->get()->channels.front(); F; F = F->next()) { if (F->get()->get_available_packet_count()) { next_packet_peer = E->key(); return; @@ -158,7 +158,7 @@ void WebRTCMultiplayer::_find_next_peer() { E = peer_map.front(); // Before last while (E) { - for (List<Ref<WebRTCDataChannel> >::Element *F = E->get()->channels.front(); F; F = F->next()) { + for (List<Ref<WebRTCDataChannel>>::Element *F = E->get()->channels.front(); F; F = F->next()) { if (F->get()->get_available_packet_count()) { next_packet_peer = E->key(); return; @@ -204,7 +204,7 @@ int WebRTCMultiplayer::get_unique_id() const { void WebRTCMultiplayer::_peer_to_dict(Ref<ConnectedPeer> p_connected_peer, Dictionary &r_dict) { Array channels; - for (List<Ref<WebRTCDataChannel> >::Element *F = p_connected_peer->channels.front(); F; F = F->next()) { + for (List<Ref<WebRTCDataChannel>>::Element *F = p_connected_peer->channels.front(); F; F = F->next()) { channels.push_back(F->get()); } r_dict["connection"] = p_connected_peer->connection; @@ -225,7 +225,7 @@ Dictionary WebRTCMultiplayer::get_peer(int p_peer_id) { Dictionary WebRTCMultiplayer::get_peers() { Dictionary out; - for (Map<int, Ref<ConnectedPeer> >::Element *E = peer_map.front(); E; E = E->next()) { + for (Map<int, Ref<ConnectedPeer>>::Element *E = peer_map.front(); E; E = E->next()) { Dictionary d; _peer_to_dict(E->get(), d); out[E->key()] = d; @@ -288,7 +288,7 @@ Error WebRTCMultiplayer::get_packet(const uint8_t **r_buffer, int &r_buffer_size _find_next_peer(); ERR_FAIL_V(ERR_UNAVAILABLE); } - for (List<Ref<WebRTCDataChannel> >::Element *E = peer_map[next_packet_peer]->channels.front(); E; E = E->next()) { + for (List<Ref<WebRTCDataChannel>>::Element *E = peer_map[next_packet_peer]->channels.front(); E; E = E->next()) { if (E->get()->get_available_packet_count()) { Error err = E->get()->get_packet(r_buffer, r_buffer_size); _find_next_peer(); @@ -316,7 +316,7 @@ Error WebRTCMultiplayer::put_packet(const uint8_t *p_buffer, int p_buffer_size) break; } - Map<int, Ref<ConnectedPeer> >::Element *E = NULL; + Map<int, Ref<ConnectedPeer>>::Element *E = NULL; if (target_peer > 0) { @@ -330,7 +330,7 @@ Error WebRTCMultiplayer::put_packet(const uint8_t *p_buffer, int p_buffer_size) } else { int exclude = -target_peer; - for (Map<int, Ref<ConnectedPeer> >::Element *F = peer_map.front(); F; F = F->next()) { + for (Map<int, Ref<ConnectedPeer>>::Element *F = peer_map.front(); F; F = F->next()) { // Exclude packet. If target_peer == 0 then don't exclude any packets if (target_peer != 0 && F->key() == exclude) @@ -347,8 +347,8 @@ int WebRTCMultiplayer::get_available_packet_count() const { if (next_packet_peer == 0) return 0; // To be sure next call to get_packet works if size > 0 . int size = 0; - for (Map<int, Ref<ConnectedPeer> >::Element *E = peer_map.front(); E; E = E->next()) { - for (List<Ref<WebRTCDataChannel> >::Element *F = E->get()->channels.front(); F; F = F->next()) { + for (Map<int, Ref<ConnectedPeer>>::Element *E = peer_map.front(); E; E = E->next()) { + for (List<Ref<WebRTCDataChannel>>::Element *F = E->get()->channels.front(); F; F = F->next()) { size += F->get()->get_available_packet_count(); } } diff --git a/modules/webrtc/webrtc_multiplayer.h b/modules/webrtc/webrtc_multiplayer.h index 66a3cd0ff5..0e1335b8a8 100644 --- a/modules/webrtc/webrtc_multiplayer.h +++ b/modules/webrtc/webrtc_multiplayer.h @@ -53,7 +53,7 @@ private: public: Ref<WebRTCPeerConnection> connection; - List<Ref<WebRTCDataChannel> > channels; + List<Ref<WebRTCDataChannel>> channels; bool connected; ConnectedPeer() { @@ -72,7 +72,7 @@ private: int next_packet_peer; bool server_compat; - Map<int, Ref<ConnectedPeer> > peer_map; + Map<int, Ref<ConnectedPeer>> peer_map; void _peer_to_dict(Ref<ConnectedPeer> p_connected_peer, Dictionary &r_dict); void _find_next_peer(); |