[Orxonox-commit 2439] r7147 - code/branches/presentation3/src/orxonox
youngk at orxonox.net
youngk at orxonox.net
Sat Jun 12 12:39:14 CEST 2010
Author: youngk
Date: 2010-06-12 12:39:14 +0200 (Sat, 12 Jun 2010)
New Revision: 7147
Modified:
code/branches/presentation3/src/orxonox/MoodManager.cc
code/branches/presentation3/src/orxonox/MoodManager.h
Log:
MoodManager works fine now.
Modified: code/branches/presentation3/src/orxonox/MoodManager.cc
===================================================================
--- code/branches/presentation3/src/orxonox/MoodManager.cc 2010-06-11 07:41:11 UTC (rev 7146)
+++ code/branches/presentation3/src/orxonox/MoodManager.cc 2010-06-12 10:39:14 UTC (rev 7147)
@@ -45,11 +45,11 @@
RegisterRootObject(MoodManager);
this->setConfigValues();
+ // Need to use a variable to store old data because ResetConfigValues() doesn't seem to work.
+ oldMood_ = MoodManager::defaultMood_;
+
// Checking for the existence of the folder for the default mood
- /* Note: Currently Resource::exists(path) will always return false when the path field points to a folder.
- MoodManager::checkMoodValidity() performs the same check. Please help.
- */
- const std::string& path = "ambient/" + MoodManager::defaultMood_ + '/';
+ const std::string& path = "ambient/" + MoodManager::defaultMood_ + "/.";
if (!Resource::exists(path))
{
// TODO: Non-fatal error handling (non-critical resource missing)
@@ -68,17 +68,18 @@
*/
void MoodManager::setMood(const std::string& mood)
{
+ oldMood_ = mood_;
ModifyConfigValue(mood_, set, mood);
}
void MoodManager::checkMoodValidity()
{
// Generic mood validation
- const std::string& path = "ambient/" + mood_ + '/';
+ const std::string& path = "ambient/" + mood_ + "/.";
if (!Resource::exists(path))
{
COUT(3) << "Mood " << mood_ << " does not exist. Will not change." << std::endl;
- ResetConfigValue(mood_);
+ this->setMood(oldMood_);
}
else
{
Modified: code/branches/presentation3/src/orxonox/MoodManager.h
===================================================================
--- code/branches/presentation3/src/orxonox/MoodManager.h 2010-06-11 07:41:11 UTC (rev 7146)
+++ code/branches/presentation3/src/orxonox/MoodManager.h 2010-06-12 10:39:14 UTC (rev 7147)
@@ -81,6 +81,7 @@
// config values
std::string mood_;
+ std::string oldMood_;
static const std::string defaultMood_;
static MoodManager* singletonPtr_s;
More information about the Orxonox-commit
mailing list