1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-09 20:32:43 +01:00

Make the right part of the code store the name of loaded audio

Otherwise game_play_music_id thinks that the audio hasn't loaded
This commit is contained in:
Timmy Sjöstedt 2016-05-28 04:38:38 +02:00
parent ccabc6f1d8
commit d715cfe24a
2 changed files with 4 additions and 3 deletions

View File

@ -520,9 +520,12 @@ bool GameData::loadAudioClip(const std::string& name, const std::string& fileNam
if ( ! loaded) { if ( ! loaded) {
logger->error("Data", "Error loading audio clip "+ filePath); logger->error("Data", "Error loading audio clip "+ filePath);
return false;
} }
return loaded; engine->missionAudio = name;
return true;
} }
void GameData::loadSplash(const std::string &name) void GameData::loadSplash(const std::string &name)

View File

@ -790,8 +790,6 @@ void game_load_audio(const ScriptArguments& args)
std::string name = args[0].string; std::string name = args[0].string;
std::transform(name.begin(), name.end(), name.begin(), ::tolower); std::transform(name.begin(), name.end(), name.begin(), ::tolower);
args.getWorld()->missionAudio = name;
if ( ! args.getWorld()->data->loadAudioClip(name, name + ".wav")) { if ( ! args.getWorld()->data->loadAudioClip(name, name + ".wav")) {
if ( ! args.getWorld()->data->loadAudioClip(name, name + ".mp3")) { if ( ! args.getWorld()->data->loadAudioClip(name, name + ".mp3")) {
args.getWorld()->logger->error("SCM", "Failed to load audio: " + name); args.getWorld()->logger->error("SCM", "Failed to load audio: " + name);