mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-18 14:10:04 +00:00
Remove duplicated logic in HostRoom
Fixes some issues with multiple warning messages
This commit is contained in:
parent
2be02f221d
commit
a5c8e07f46
@ -75,13 +75,10 @@ void HostRoomWindow::Host() {
|
||||
}
|
||||
if (auto member = Network::GetRoomMember().lock()) {
|
||||
if (member->IsConnected()) {
|
||||
if (!NetworkMessage::WarnDisconnect()) {
|
||||
auto parent = static_cast<MultiplayerState*>(parentWidget());
|
||||
if (!parent->OnCloseRoom()) {
|
||||
close();
|
||||
return;
|
||||
} else {
|
||||
member->Leave();
|
||||
auto parent = static_cast<MultiplayerState*>(parentWidget());
|
||||
parent->OnCloseRoom();
|
||||
}
|
||||
}
|
||||
ui->host->setDisabled(true);
|
||||
|
@ -112,9 +112,9 @@ void MultiplayerState::OnCreateRoom() {
|
||||
BringWidgetToFront(host_room);
|
||||
}
|
||||
|
||||
void MultiplayerState::OnCloseRoom() {
|
||||
bool MultiplayerState::OnCloseRoom() {
|
||||
if (!NetworkMessage::WarnCloseRoom())
|
||||
return;
|
||||
return false;
|
||||
if (auto room = Network::GetRoom().lock()) {
|
||||
// if you are in a room, leave it
|
||||
if (auto member = Network::GetRoomMember().lock()) {
|
||||
@ -123,11 +123,12 @@ void MultiplayerState::OnCloseRoom() {
|
||||
|
||||
// if you are hosting a room, also stop hosting
|
||||
if (room->GetState() != Network::Room::State::Open) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
room->Destroy();
|
||||
announce_multiplayer_session->Stop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MultiplayerState::OnOpenNetworkRoom() {
|
||||
|
@ -42,7 +42,7 @@ public slots:
|
||||
void OnNetworkStateChanged(const Network::RoomMember::State& state);
|
||||
void OnViewLobby();
|
||||
void OnCreateRoom();
|
||||
void OnCloseRoom();
|
||||
bool OnCloseRoom();
|
||||
void OnOpenNetworkRoom();
|
||||
void OnDirectConnectToRoom();
|
||||
void OnAnnounceFailed(const Common::WebResult&);
|
||||
|
Loading…
Reference in New Issue
Block a user