|
From: Lasse Kärkkäi. <tr...@us...> - 2009-12-21 22:20:53
|
Module: performous
Branch: master
Commit: 57194ebd8c0d0d3aad226761222ed25c63724c8d
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Dec 22 00:20:35 2009 +0200
Guess music.ogg if music file is not found for SM format songs (because ITG is broken)
---
game/songparser-sm.cc | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/game/songparser-sm.cc b/game/songparser-sm.cc
index 0f03b5f..e7c6eba 100644
--- a/game/songparser-sm.cc
+++ b/game/songparser-sm.cc
@@ -1,5 +1,6 @@
#include "songparser.hh"
+#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <algorithm>
@@ -62,7 +63,10 @@ void SongParser::smParse() {
while (getline(line) && smParseField(line)) {}
if (m_song.danceTracks.empty() ) throw std::runtime_error("No note data in the file");
if (s.title.empty() || s.artist.empty()) throw std::runtime_error("Required header fields missing");
-
+ std::string& music = s.music["background"];
+ std::string tmp = s.path + "music.ogg";
+ namespace fs = boost::filesystem;
+ if ((music.empty() || !fs::exists(music)) && fs::exists(tmp)) music = tmp;
}
bool SongParser::smParseField(std::string line) {
|