[Orxonox-commit 3934] r8608 - in code/branches/presentation/src/orxonox: . sound
landauf at orxonox.net
landauf at orxonox.net
Thu May 26 16:58:18 CEST 2011
Author: landauf
Date: 2011-05-26 16:58:18 +0200 (Thu, 26 May 2011)
New Revision: 8608
Modified:
code/branches/presentation/src/orxonox/MoodManager.cc
code/branches/presentation/src/orxonox/MoodManager.h
code/branches/presentation/src/orxonox/sound/AmbientSound.cc
Log:
removed some redundant code in MoodManager
Modified: code/branches/presentation/src/orxonox/MoodManager.cc
===================================================================
--- code/branches/presentation/src/orxonox/MoodManager.cc 2011-05-26 14:38:07 UTC (rev 8607)
+++ code/branches/presentation/src/orxonox/MoodManager.cc 2011-05-26 14:58:18 UTC (rev 8608)
@@ -92,8 +92,6 @@
}
- std::string MoodListener::mood_s;
-
MoodListener::MoodListener()
{
RegisterRootObject(MoodListener);
@@ -101,8 +99,7 @@
/*static*/ void MoodListener::changedMood(const std::string& mood)
{
- mood_s = mood;
for (ObjectList<MoodListener>::iterator it = ObjectList<MoodListener>::begin(); it; ++it)
- it->moodChanged(mood_s);
+ it->moodChanged(mood);
}
}
Modified: code/branches/presentation/src/orxonox/MoodManager.h
===================================================================
--- code/branches/presentation/src/orxonox/MoodManager.h 2011-05-26 14:38:07 UTC (rev 8607)
+++ code/branches/presentation/src/orxonox/MoodManager.h 2011-05-26 14:58:18 UTC (rev 8608)
@@ -49,13 +49,10 @@
MoodListener();
virtual ~MoodListener() {}
- const std::string& getMood() const { return mood_s; }
-
private:
virtual void moodChanged(const std::string& mood) = 0;
static void changedMood(const std::string& mood);
- static std::string mood_s;
};
/*
Modified: code/branches/presentation/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/presentation/src/orxonox/sound/AmbientSound.cc 2011-05-26 14:38:07 UTC (rev 8607)
+++ code/branches/presentation/src/orxonox/sound/AmbientSound.cc 2011-05-26 14:58:18 UTC (rev 8608)
@@ -81,14 +81,14 @@
void AmbientSound::setAmbientSource(const std::string& source)
{
this->ambientSource_ = source;
- this->moodChanged(this->getMood());
+ this->moodChanged(MoodManager::getInstance().getMood());
}
void AmbientSound::moodChanged(const std::string& mood)
{
if (GameMode::playsSound())
{
- const std::string& path = "ambient/" + MoodManager::getInstance().getMood() + '/' + this->ambientSource_;
+ const std::string& path = "ambient/" + mood + '/' + this->ambientSource_;
shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
if (fileInfo != NULL)
this->setSource(path);
More information about the Orxonox-commit
mailing list