Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lobby client fix peer named event not called when self name #203

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions modules/blazium_sdk/lobby/authoritative_lobby_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,17 +555,21 @@ void AuthoritativeLobbyClient::_receive_data(const Dictionary &p_dict) {
String peer_name = data_dict.get("name", "");
if (peer->get_id() == peer_id) {
peer->set_peer_name(peer_name);
}
for (int i = 0; i < peers.size(); ++i) {
Ref<LobbyPeer> updated_peer = peers[i];
if (updated_peer->get_id() == peer_id) {
updated_peer->set_peer_name(peer_name);
// if the named peer is the host, update the host name
if (updated_peer->get_id() == lobby->get_host()) {
lobby->set_host_name(peer_name);
// notify self
emit_signal("peer_named", peer);
} else {
// another peer got named
for (int i = 0; i < peers.size(); ++i) {
Ref<LobbyPeer> updated_peer = peers[i];
if (updated_peer->get_id() == peer_id) {
updated_peer->set_peer_name(peer_name);
// if the named peer is the host, update the host name
if (updated_peer->get_id() == lobby->get_host()) {
lobby->set_host_name(peer_name);
}
emit_signal("peer_named", updated_peer);
break;
}
emit_signal("peer_named", updated_peer);
break;
}
}
} else if (command == "peer_ready") {
Expand Down
24 changes: 14 additions & 10 deletions modules/blazium_sdk/lobby/lobby_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,17 +736,21 @@ void LobbyClient::_receive_data(const Dictionary &p_dict) {
String peer_name = data_dict.get("name", "");
if (peer->get_id() == peer_id) {
peer->set_peer_name(peer_name);
}
for (int i = 0; i < peers.size(); ++i) {
Ref<LobbyPeer> updated_peer = peers[i];
if (updated_peer->get_id() == peer_id) {
updated_peer->set_peer_name(peer_name);
// if the named peer is the host, update the host name
if (updated_peer->get_id() == lobby->get_host()) {
lobby->set_host_name(peer_name);
// notify self
emit_signal("peer_named", peer);
} else {
// another peer got named
for (int i = 0; i < peers.size(); ++i) {
Ref<LobbyPeer> updated_peer = peers[i];
if (updated_peer->get_id() == peer_id) {
updated_peer->set_peer_name(peer_name);
// if the named peer is the host, update the host name
if (updated_peer->get_id() == lobby->get_host()) {
lobby->set_host_name(peer_name);
}
emit_signal("peer_named", updated_peer);
break;
}
emit_signal("peer_named", updated_peer);
break;
}
}
} else if (command == "peer_ready") {
Expand Down
Loading