diff options
| author | mathieui <mathieui@mathieui.net> | 2016-04-23 16:04:48 +0200 |
|---|---|---|
| committer | mathieui <mathieui@mathieui.net> | 2016-05-05 23:15:00 +0200 |
| commit | f36cd77da43709a40b6b117d2cea1553e65c9e0a (patch) | |
| tree | f159770ae6a2a8200e5229bdd40d6b60e074e9c3 /Source/Core/DolphinWX/NetPlay/NetWindow.cpp | |
| parent | bdb9da21041fdcefa4504c28259647eea910e36c (diff) | |
Add information about disc number in the netplay setup
Previously, two-disc games would appear exactly the same, and not
necessarily in disc order, which made it a pain.
Diffstat (limited to 'Source/Core/DolphinWX/NetPlay/NetWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/NetPlay/NetWindow.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index ece17e4fe9..51464bb99d 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() + ")"; } } |
