Changeset 6105 for code/trunk/src/libraries/core/Core.cc
- Timestamp:
- Nov 20, 2009, 4:55:40 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/console (added) merged: 5941,5945,5968-5975,5983,5985-5986,5991-5992,5994-5996,5998,6000,6004-6007,6010-6017,6034,6037,6041,6043-6044,6089,6103-6104
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/Core.cc
r6021 r6105 64 64 #include "Identifier.h" 65 65 #include "Language.h" 66 #include "IOConsole.h" 66 67 #include "LuaState.h" 67 68 #include "ScopedSingletonManager.h" 68 #include "Shell.h"69 69 #include "TclBind.h" 70 70 #include "TclThreadManager.h" … … 105 105 void setConfigValues() 106 106 { 107 #ifdef NDEBUG 108 const unsigned int defaultLevelConsole = 1; 109 const unsigned int defaultLevelLogfile = 3; 110 const unsigned int defaultLevelShell = 1; 107 #ifdef ORXONOX_RELEASE 108 const unsigned int defaultLevelLogFile = 3; 111 109 #else 112 const unsigned int defaultLevelConsole = 3; 113 const unsigned int defaultLevelLogfile = 4; 114 const unsigned int defaultLevelShell = 3; 115 #endif 116 SetConfigValue(softDebugLevelConsole_, defaultLevelConsole) 117 .description("The maximal level of debug output shown in the console") 118 .callback(this, &CoreConfiguration::debugLevelChanged); 119 SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile) 120 .description("The maximal level of debug output shown in the logfile") 121 .callback(this, &CoreConfiguration::debugLevelChanged); 122 SetConfigValue(softDebugLevelShell_, defaultLevelShell) 123 .description("The maximal level of debug output shown in the ingame shell") 124 .callback(this, &CoreConfiguration::debugLevelChanged); 110 const unsigned int defaultLevelLogFile = 4; 111 #endif 112 SetConfigValueGeneric(ConfigFileType::Settings, softDebugLevelLogFile_, "softDebugLevelLogFile", "OutputHandler", defaultLevelLogFile) 113 .description("The maximum level of debug output shown in the log file"); 114 OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_); 125 115 126 116 SetConfigValue(language_, Language::getInstance().defaultLanguage_) 127 .description("The language of the in game text")117 .description("The language of the in game text") 128 118 .callback(this, &CoreConfiguration::languageChanged); 129 119 SetConfigValue(bInitializeRandomNumberGenerator_, true) 130 120 .description("If true, all random actions are different each time you start the game") 131 121 .callback(this, &CoreConfiguration::initializeRandomNumberGenerator); 132 }133 134 /**135 @brief Callback function if the debug level has changed.136 */137 void debugLevelChanged()138 {139 // softDebugLevel_ is the maximum of the 3 variables140 this->softDebugLevel_ = this->softDebugLevelConsole_;141 if (this->softDebugLevelLogfile_ > this->softDebugLevel_)142 this->softDebugLevel_ = this->softDebugLevelLogfile_;143 if (this->softDebugLevelShell_ > this->softDebugLevel_)144 this->softDebugLevel_ = this->softDebugLevelShell_;145 146 OutputHandler::setSoftDebugLevel(OutputHandler::LD_All, this->softDebugLevel_);147 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Console, this->softDebugLevelConsole_);148 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);149 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell, this->softDebugLevelShell_);150 122 } 151 123 … … 178 150 } 179 151 180 int softDebugLevel_; //!< The debug level 181 int softDebugLevelConsole_; //!< The debug level for the console 182 int softDebugLevelLogfile_; //!< The debug level for the logfile 183 int softDebugLevelShell_; //!< The debug level for the ingame shell 152 int softDebugLevelLogFile_; //!< The debug level for the log file (belongs to OutputHandler) 184 153 std::string language_; //!< The language 185 154 bool bInitializeRandomNumberGenerator_; //!< If true, srand(time(0)) is called … … 221 190 this->pathConfig_->setConfigurablePaths(); 222 191 223 // create a signal handler (only active for linux)192 // create a signal handler (only active for Linux) 224 193 // This call is placed as soon as possible, but after the directories are set 225 194 this->signalHandler_.reset(new SignalHandler()); 226 195 this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log"); 227 196 228 // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used229 OutputHandler::get OutStream().setLogPath(PathConfig::getLogPathString());197 // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used 198 OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString()); 230 199 231 200 // Parse additional options file now that we know its path … … 249 218 this->languageInstance_.reset(new Language()); 250 219 220 // create persistent io console 221 this->ioConsole_.reset(new IOConsole()); 222 251 223 // creates the class hierarchy for all classes with factories 252 224 Identifier::createClassHierarchy(); … … 262 234 this->tclBind_.reset(new TclBind(PathConfig::getDataPathString())); 263 235 this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter())); 264 265 // create a shell266 this->shell_.reset(new Shell());267 236 268 237 // Create singletons that always exist (in other libraries) … … 325 294 bGraphicsLoaded_ = false; 326 295 GameMode::bShowsGraphics_s = false; 327 }328 329 /**330 @brief Returns the softDebugLevel for the given device (returns a default-value if the class is right about to be created).331 @param device The device332 @return The softDebugLevel333 */334 /*static*/ int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)335 {336 switch (device)337 {338 case OutputHandler::LD_All:339 return Core::getInstance().configuration_->softDebugLevel_;340 case OutputHandler::LD_Console:341 return Core::getInstance().configuration_->softDebugLevelConsole_;342 case OutputHandler::LD_Logfile:343 return Core::getInstance().configuration_->softDebugLevelLogfile_;344 case OutputHandler::LD_Shell:345 return Core::getInstance().configuration_->softDebugLevelShell_;346 default:347 assert(0);348 return 2;349 }350 }351 352 /**353 @brief Sets the softDebugLevel for the given device. Please use this only temporary and restore the value afterwards, as it overrides the configured value.354 @param device The device355 @param level The level356 */357 /*static*/ void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)358 {359 if (device == OutputHandler::LD_All)360 Core::getInstance().configuration_->softDebugLevel_ = level;361 else if (device == OutputHandler::LD_Console)362 Core::getInstance().configuration_->softDebugLevelConsole_ = level;363 else if (device == OutputHandler::LD_Logfile)364 Core::getInstance().configuration_->softDebugLevelLogfile_ = level;365 else if (device == OutputHandler::LD_Shell)366 Core::getInstance().configuration_->softDebugLevelShell_ = level;367 368 OutputHandler::setSoftDebugLevel(device, level);369 296 } 370 297 … … 444 371 ScopedSingletonManager::update<ScopeID::Graphics>(time); 445 372 } 373 // process console text 374 this->ioConsole_->update(time); 446 375 // process thread commands 447 376 this->tclThreadManager_->update(time);
Note: See TracChangeset
for help on using the changeset viewer.