summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2016-05-06 09:19:54 +1200
committerMatthew Parlane <parlane@gmail.com>2016-05-06 09:19:54 +1200
commit1cfeacd5b61814ee113041450f71b69cf2e200de (patch)
tree9010d79b68375ca47733475ea3a1f78709aa5373 /Source/Core/DolphinWX/NetPlay/NetWindow.cpp
parentdbd67c6b0642624af2451273ef76c49aff94c247 (diff)
parentf36cd77da43709a40b6b117d2cea1553e65c9e0a (diff)
Merge pull request #3793 from mathieui/netplay-disc-num
Add information about disc number in the netplay setup
Diffstat (limited to 'Source/Core/DolphinWX/NetPlay/NetWindow.cpp')
-rw-r--r--Source/Core/DolphinWX/NetPlay/NetWindow.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
index c9e30c311f..61a59b1460 100644
--- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
+++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
+#include <algorithm>
#include <cstddef>
#include <sstream>
#include <string>
@@ -69,18 +70,37 @@ static std::string BuildGameName(const GameListItem& game)
{
// Lang needs to be consistent
DiscIO::IVolume::ELanguage const lang = DiscIO::IVolume::LANGUAGE_ENGLISH;
+ std::vector<std::string> info;
+ if (!game.GetUniqueID().empty())
+ info.push_back(game.GetUniqueID());
+ if (game.GetRevision() != 0)
+ {
+ std::string rev_str = "Revision ";
+ info.push_back(rev_str + std::to_string((long long)game.GetRevision()));
+ }
std::string name(game.GetName(lang));
- if (game.GetRevision() != 0)
- return name + " (" + game.GetUniqueID() + ", Revision " + std::to_string((long long)game.GetRevision()) + ")";
+ int disc_number = game.GetDiscNumber() + 1;
+
+ std::string lower_name = name;
+ std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), ::tolower);
+ if (disc_number > 1 &&
+ lower_name.find(std::string(wxString::Format("disc %i", disc_number))) == std::string::npos &&
+ lower_name.find(std::string(wxString::Format("disc%i", disc_number))) == std::string::npos)
+ {
+ std::string disc_text = "Disc ";
+ info.push_back(disc_text + std::to_string(disc_number));
+ }
+
+ if (info.empty())
+ return name;
else
{
- if (game.GetUniqueID().empty())
- {
- return game.GetName();
- }
- return name + " (" + game.GetUniqueID() + ")";
+ std::ostringstream ss;
+ std::copy(info.begin(), info.end() -1, std::ostream_iterator<std::string>(ss, ", "));
+ ss << info.back();
+ return name + " (" + ss.str() + ")";
}
}