|
From: Yoda-JM <yo...@us...> - 2009-08-13 21:31:30
|
Module: performous
Branch: master
Commit: 7cca711838558867c5b1753813c7aca9adc99210
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Aug 13 23:30:26 2009 +0200
Added Guilhem patch to support sorting by language
---
game/song.hh | 1 +
game/songparser-txt.cc | 1 +
game/songs.cc | 4 +++-
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/game/song.hh b/game/song.hh
index 39e58d1..677cd62 100644
--- a/game/song.hh
+++ b/game/song.hh
@@ -51,6 +51,7 @@ class Song: boost::noncopyable {
std::string artist; ///< artist
std::string text; ///< songtext
std::string creator; ///< creator
+ std::string language; ///< language
std::vector<std::string> music; ///< music files (background, guitar, rhythm/bass, drums, vocals)
std::string cover; ///< cd cover
std::string background; ///< background image
diff --git a/game/songparser-txt.cc b/game/songparser-txt.cc
index 3c83b58..721f167 100644
--- a/game/songparser-txt.cc
+++ b/game/songparser-txt.cc
@@ -61,6 +61,7 @@ bool SongParser::txtParseField(std::string const& line) {
else if (key == "RELATIVE") assign(m_relative, value);
else if (key == "GAP") { assign(m_gap, value); m_gap *= 1e-3; }
else if (key == "BPM") assign(m_bpm, value);
+ else if (key == "LANGUAGE") m_song.language= value.substr(value.find_first_not_of(" "));
return true;
}
diff --git a/game/songs.cc b/game/songs.cc
index 7f2504f..7b4126c 100644
--- a/game/songs.cc
+++ b/game/songs.cc
@@ -201,7 +201,8 @@ namespace {
"by artist",
"by edition",
"by genre",
- "by path"
+ "by path",
+ "by language"
};
static const int orders = sizeof(order) / sizeof(*order);
@@ -237,6 +238,7 @@ void Songs::sort_internal() {
case 3: std::sort(m_filtered.begin(), m_filtered.end(), comparator(&Song::edition)); break;
case 4: std::sort(m_filtered.begin(), m_filtered.end(), comparator(&Song::genre)); break;
case 5: std::sort(m_filtered.begin(), m_filtered.end(), comparator(&Song::path)); break;
+ case 6: std::sort(m_filtered.begin(), m_filtered.end(), comparator(&Song::language)); break;
default: throw std::logic_error("Internal error: unknown sort order in Songs::sortChange");
}
}
|