diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-06-20 13:51:30 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-06-20 13:51:30 +0000 |
commit | 12371444ef58176bbf7bd5716a223e707a5942e7 (patch) | |
tree | f480c9545d8a07c071682ef85cd43919e8f53bb3 /src | |
parent | c204288633cd8f07720a1288a10f3c111de1599c (diff) | |
download | mana-12371444ef58176bbf7bd5716a223e707a5942e7.tar.gz mana-12371444ef58176bbf7bd5716a223e707a5942e7.tar.bz2 mana-12371444ef58176bbf7bd5716a223e707a5942e7.tar.xz mana-12371444ef58176bbf7bd5716a223e707a5942e7.zip |
Hammerbear suggestion: removing duplicated code
Diffstat (limited to 'src')
-rw-r--r-- | src/engine.cpp | 6 | ||||
-rw-r--r-- | src/game.cpp | 15 |
2 files changed, 6 insertions, 15 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 76edc0b5..fac158bf 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -270,6 +270,12 @@ void Engine::setCurrentMap(Map *newMap) { mCurrentMap = newMap; minimap->setMap(mCurrentMap); + std::string musicFile = newMap->getProperty("music"); + + if(musicFile!="") { + musicFile = std::string(TMW_DATADIR) + "data/music/" + musicFile; + sound.playMusic(musicFile.c_str(), -1); + } } void Engine::logic() diff --git a/src/game.cpp b/src/game.cpp index 820f7dc6..10ec4868 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -181,13 +181,6 @@ void do_init() else { engine->setCurrentMap(tiledMap); - // Start playing background music - std::string musicFile = tiledMap->getProperty("music"); - - if(musicFile!="") { - musicFile = std::string(TMW_DATADIR) + "data/music/" + musicFile; - sound.playMusic(musicFile.c_str(), -1); - } } // Initialize timers @@ -1064,14 +1057,6 @@ void do_parse() WFIFOSET(2); while (out_size > 0) flush(); engine->setCurrentMap(tiledMap); - - std::string musicFile = tiledMap->getProperty("music"); - - if(musicFile!="") { - musicFile = std::string(TMW_DATADIR) + "data/music/" - + musicFile; - sound.playMusic(musicFile.c_str(), -1); - } } else { logger->error("Could not find map file"); |