More cosmetic only changes.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10043 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-10-26 05:03:13 +00:00
parent 3f73183228
commit 5d6f1ed4a4

View File

@ -78,8 +78,8 @@ MusicManager::~MusicManager()
{ {
stopMusic(); stopMusic();
for(std::map<std::string,MusicInformation*>::iterator i=m_all_music.begin(); for(std::map<std::string,MusicInformation*>::iterator
i!=m_all_music.end(); i++) i=m_all_music.begin(); i!=m_all_music.end(); i++)
{ {
delete i->second; delete i->second;
i->second = NULL; i->second = NULL;
@ -100,7 +100,8 @@ MusicManager::~MusicManager()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void MusicManager::loadMusicInformation() void MusicManager::loadMusicInformation()
{ {
// Load music files from data/music, and dirs defined in SUPERTUXKART_MUSIC_PATH // Load music files from data/music, and dirs defined in
// SUPERTUXKART_MUSIC_PATH
std::vector<std::string> allMusicDirs=file_manager->getMusicDirs(); std::vector<std::string> allMusicDirs=file_manager->getMusicDirs();
for(std::vector<std::string>::iterator dir=allMusicDirs.begin(); for(std::vector<std::string>::iterator dir=allMusicDirs.begin();
dir!=allMusicDirs.end(); dir++) dir!=allMusicDirs.end(); dir++)
@ -109,13 +110,14 @@ void MusicManager::loadMusicInformation()
} // for dir } // for dir
} // loadMusicInformation } // loadMusicInformation
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------
void MusicManager::loadMusicFromOneDir(const std::string& dir) void MusicManager::loadMusicFromOneDir(const std::string& dir)
{ {
std::set<std::string> files; std::set<std::string> files;
file_manager->listFiles(files, dir, /*is_full_path*/ true, file_manager->listFiles(files, dir, /*is_full_path*/ true,
/*make_full_path*/ true); /*make_full_path*/ true);
for(std::set<std::string>::iterator i = files.begin(); i != files.end(); ++i) for(std::set<std::string>::iterator i = files.begin();
i != files.end(); ++i)
{ {
if(StringUtils::getExtension(*i)!="music") continue; if(StringUtils::getExtension(*i)!="music") continue;
MusicInformation *mi = MusicInformation::create(*i); MusicInformation *mi = MusicInformation::create(*i);
@ -125,11 +127,11 @@ void MusicManager::loadMusicFromOneDir(const std::string& dir)
} // loadMusicFromOneDir } // loadMusicFromOneDir
//-----------------------------------------------------------------------------//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void MusicManager::addMusicToTracks() void MusicManager::addMusicToTracks()
{ {
for(std::map<std::string,MusicInformation*>::iterator i=m_all_music.begin(); for(std::map<std::string,MusicInformation*>::iterator
i!=m_all_music.end(); i++) i=m_all_music.begin(); i!=m_all_music.end(); i++)
{ {
if(!i->second) if(!i->second)
{ {
@ -150,9 +152,11 @@ void MusicManager::startMusic(MusicInformation* mi, bool startRightNow)
m_current_music->isPlaying()) m_current_music->isPlaying())
return; return;
// It is possible here that startMusic() will be called without first calling stopMusic(). // It is possible here that startMusic() will be called without first
// This would cause a memory leak by overwriting m_current_music without first releasing its resources. // calling stopMusic(). This would cause a memory leak by overwriting
// Guard against this here by making sure that stopMusic() is called before starting new music. // m_current_music without first releasing its resources. Guard against
// this here by making sure that stopMusic() is called before starting
// new music.
stopMusic(); stopMusic();
m_current_music = mi; m_current_music = mi;
@ -180,7 +184,7 @@ void MusicManager::setMasterMusicVolume(float gain)
if(m_current_music) m_current_music->volumeMusic(m_masterGain); if(m_current_music) m_current_music->volumeMusic(m_masterGain);
UserConfigParams::m_music_volume = m_masterGain; UserConfigParams::m_music_volume = m_masterGain;
} } // setMasterMusicVolume
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** /**