Move creation of music information after downloading assets
This commit is contained in:
parent
3293196707
commit
ef68f8377a
@ -41,6 +41,7 @@ STKConfig::STKConfig()
|
||||
{
|
||||
m_has_been_loaded = false;
|
||||
m_title_music = NULL;
|
||||
m_default_music = NULL;
|
||||
m_default_kart_properties = new KartProperties();
|
||||
} // STKConfig
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -392,21 +393,13 @@ void STKConfig::getAllData(const XMLNode * root)
|
||||
|
||||
if (const XMLNode *music_node = root->getNode("music"))
|
||||
{
|
||||
std::string title_music;
|
||||
music_node->get("title", &title_music);
|
||||
assert(title_music.size() > 0);
|
||||
title_music = file_manager->getAsset(FileManager::MUSIC, title_music);
|
||||
m_title_music = MusicInformation::create(title_music);
|
||||
if(!m_title_music)
|
||||
Log::error("StkConfig", "Cannot load title music : %s", title_music.c_str());
|
||||
music_node->get("title", &m_title_music_file);
|
||||
assert(m_title_music_file.size() > 0);
|
||||
m_title_music_file = file_manager->getAsset(FileManager::MUSIC, m_title_music_file);
|
||||
|
||||
std::string default_music;
|
||||
music_node->get("default", &default_music);
|
||||
assert(default_music.size() > 0);
|
||||
default_music = file_manager->getAsset(FileManager::MUSIC, default_music);
|
||||
m_default_music = MusicInformation::create(default_music);
|
||||
if (!m_default_music)
|
||||
Log::error("StkConfig", "Cannot load default music : %s", default_music.c_str());
|
||||
music_node->get("default", &m_default_music_file);
|
||||
assert(m_default_music_file.size() > 0);
|
||||
m_default_music_file = file_manager->getAsset(FileManager::MUSIC, m_default_music_file);
|
||||
}
|
||||
|
||||
if(const XMLNode *skidmarks_node = root->getNode("skid-marks"))
|
||||
@ -575,6 +568,26 @@ void STKConfig::getAllData(const XMLNode * root)
|
||||
}
|
||||
} // getAllData
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Init the music files after downloading assets
|
||||
*/
|
||||
void STKConfig::initMusicFiles()
|
||||
{
|
||||
m_title_music = MusicInformation::create(m_title_music_file);
|
||||
if (!m_title_music)
|
||||
{
|
||||
Log::error("StkConfig", "Cannot load title music: %s.",
|
||||
m_title_music_file.c_str());
|
||||
}
|
||||
|
||||
m_default_music = MusicInformation::create(m_default_music_file);
|
||||
if (!m_default_music)
|
||||
{
|
||||
Log::error("StkConfig", "Cannot load default music: %s.",
|
||||
m_default_music_file.c_str());
|
||||
}
|
||||
} // initMusicFiles
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Defines the points for each position for a race with a given number
|
||||
* of karts.
|
||||
|
@ -246,7 +246,8 @@ private:
|
||||
/** Default FPS rate for physics. */
|
||||
int m_physics_fps;
|
||||
|
||||
|
||||
std::string m_title_music_file;
|
||||
std::string m_default_music_file;
|
||||
public:
|
||||
STKConfig();
|
||||
~STKConfig();
|
||||
@ -255,7 +256,7 @@ public:
|
||||
void load(const std::string &filename);
|
||||
const std::string &getMainMenuPicture(int n);
|
||||
const std::string &getBackgroundPicture(int n);
|
||||
|
||||
void initMusicFiles();
|
||||
void getAllScores(std::vector<int> *all_scores, int num_karts);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the default kart properties for each kart. */
|
||||
|
@ -1739,6 +1739,7 @@ void initRest()
|
||||
}
|
||||
#endif
|
||||
|
||||
stk_config->initMusicFiles();
|
||||
// This only initialises the non-network part of the add-ons manager. The
|
||||
// online section of the add-ons manager will be initialised from a
|
||||
// separate thread running in network HTTP.
|
||||
|
Loading…
Reference in New Issue
Block a user