summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-07-02 12:22:17 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-07-02 12:22:17 +0000
commit57966d67923562c6d3bb10532c09175e8dddf882 (patch)
treec1162364b5f8de6f75acad591efdd23e93285ec9 /src/engine.cpp
parent76afaa810068cad82efa05cbac71c92f9531dd09 (diff)
downloadmana-57966d67923562c6d3bb10532c09175e8dddf882.tar.gz
mana-57966d67923562c6d3bb10532c09175e8dddf882.tar.bz2
mana-57966d67923562c6d3bb10532c09175e8dddf882.tar.xz
mana-57966d67923562c6d3bb10532c09175e8dddf882.zip
Music doesn't restart anymore if it's the same between maps.
(I hope Bjorn likes it this way :P)
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 3d18f8ad..1743bcc1 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -268,14 +268,21 @@ Map *Engine::getCurrentMap()
void Engine::setCurrentMap(Map *newMap)
{
+ std::string oldMusic = "";
+ if (mCurrentMap) {
+ oldMusic = mCurrentMap->getProperty("music");
+ logger->log("old: %s",oldMusic.c_str());
+ }
+ std::string newMusic = newMap->getProperty("music");
+ logger->log("new: %s",newMusic.c_str());
+ if(newMusic!=oldMusic) {
+ logger->log("new: %s",newMusic.c_str());
+ newMusic = std::string(TMW_DATADIR) + "data/music/" + newMusic;
+ sound.playMusic(newMusic.c_str(), -1);
+ }
+
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()