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