Changeset 7121 for code/branches/presentation3/src/orxonox/MoodManager.cc
- Timestamp:
- Jun 7, 2010, 1:06:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/orxonox/MoodManager.cc
r6417 r7121 32 32 #include "core/CoreIncludes.h" 33 33 #include "core/ScopedSingletonManager.h" 34 #include "core/Resource.h" 34 35 35 36 namespace orxonox … … 37 38 ManageScopedSingleton(MoodManager, ScopeID::Root, false); 38 39 40 // Note: I'm (Kevin Young) not entirely sure whether that's good code style: 41 const std::string MoodManager::defaultMood_ = "default"; 42 39 43 MoodManager::MoodManager() 40 44 { 41 45 RegisterRootObject(MoodManager); 42 46 this->setConfigValues(); 47 48 // Checking for the existence of the folder for the default mood 49 /* Note: Currently Resource::exists(path) will always return false when the path field points to a folder. 50 MoodManager::checkMoodValidity() performs the same check. Please help. 51 */ 52 const std::string& path = "ambient/" + MoodManager::defaultMood_ + '/'; 53 if (!Resource::exists(path)) 54 { 55 // TODO: Non-fatal error handling (non-critical resource missing) 56 COUT(2) << "Mood Warning: Folder for default mood (" << MoodManager::defaultMood_ << ") does not exist!" << std::endl; 57 } 43 58 } 44 59 45 60 void MoodManager::setConfigValues() 46 61 { 47 SetConfigValue(mood_, "default")62 SetConfigValue(mood_, MoodManager::defaultMood_) 48 63 .description("Sets the mood for the current level.") 49 64 .callback(this, &MoodManager::checkMoodValidity); 50 65 } 51 66 52 /** Sets the mood 53 @note 54 TODO: Inform dependent classes of mood change 55 */ 67 /** Set a new mood 68 */ 56 69 void MoodManager::setMood(const std::string& mood) 57 70 { … … 61 74 void MoodManager::checkMoodValidity() 62 75 { 63 // TODO: Insert new moods here & make this generic 64 if (mood_ != "default" && mood_ != "dnb") 76 // Generic mood validation 77 const std::string& path = "ambient/" + mood_ + '/'; 78 if (!Resource::exists(path)) 65 79 { 80 COUT(3) << "Mood " << mood_ << " does not exist. Will not change." << std::endl; 66 81 ResetConfigValue(mood_); 67 82 }
Note: See TracChangeset
for help on using the changeset viewer.