summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-07-11 10:06:00 +0200
committerGitHub <noreply@github.com>2016-07-11 10:06:00 +0200
commitf57aec05257b23b097609263a7352aecca75b874 (patch)
tree577ff5a9e4b9d0c3b8c3aa46a6a754c60a88a6bb /Source/Core/DolphinWX/NetPlay/NetWindow.cpp
parent8de6800e9d9ca7d093c36d2a42279043cee7899a (diff)
parentcd9a58b70470e3800d818c429c3b5453834ec0c6 (diff)
Merge pull request #3858 from Aestek/feature/better-netplay-gamenotfound
Netplay: check if all players have the game before starting
Diffstat (limited to 'Source/Core/DolphinWX/NetPlay/NetWindow.cpp')
-rw-r--r--Source/Core/DolphinWX/NetPlay/NetWindow.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
index 632472b1d0..4f41921cca 100644
--- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
+++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
@@ -288,19 +288,33 @@ void NetPlayDialog::GetNetSettings(NetSettings& settings)
settings.m_EXIDevice[1] = instance.m_EXIDevice[1];
}
-std::string NetPlayDialog::FindGame()
+std::string NetPlayDialog::FindGame(const std::string& target_game)
{
// find path for selected game, sloppy..
for (u32 i = 0; auto game = m_game_list->GetISO(i); ++i)
- if (m_selected_game == BuildGameName(*game))
+ if (target_game == BuildGameName(*game))
return game->GetFileName();
- WxUtils::ShowErrorDialog(_("Game not found!"));
return "";
}
+std::string NetPlayDialog::FindCurrentGame()
+{
+ return FindGame(m_selected_game);
+}
+
void NetPlayDialog::OnStart(wxCommandEvent&)
{
+ bool should_start = true;
+ if (!netplay_client->DoAllPlayersHaveGame())
+ {
+ should_start = wxMessageBox(_("Not all players have the game. Do you really want to start?"),
+ _("Warning"), wxYES_NO) == wxYES;
+ }
+
+ if (!should_start)
+ return;
+
NetSettings settings;
GetNetSettings(settings);
netplay_server->SetNetSettings(settings);
@@ -442,7 +456,11 @@ void NetPlayDialog::OnThread(wxThreadEvent& event)
case NP_GUI_EVT_START_GAME:
// client start game :/
{
- netplay_client->StartGame(FindGame());
+ std::string game = FindCurrentGame();
+ if (game.empty())
+ WxUtils::ShowErrorDialog(_("Game not found!"));
+ else
+ netplay_client->StartGame(game);
}
break;
case NP_GUI_EVT_STOP_GAME: