Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8519


Ignore:
Timestamp:
May 20, 2011, 5:27:39 AM (14 years ago)
Author:
rgrieder
Message:

Changing the Core::bDevMode_ should also change the log levels to appropriate values.
For an exact description of the behaviour, see documentation of Core::devModeChanged().

Location:
code/branches/unity_build/src/libraries/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/unity_build/src/libraries/core/Core.cc

    r8518 r8519  
    267267
    268268        SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
    269             .description("Developer mode. If not set, hides some things from the user to not confuse him.");
     269            .description("Developer mode. If not set, hides some things from the user to not confuse him.")
     270            .callback(this, &Core::devModeChanged);
    270271        SetConfigValue(language_, Language::getInstance().defaultLanguage_)
    271272            .description("The language of the in game text")
     
    282283    }
    283284
     285    /** Callback function for changes in the dev mode that affect debug levels.
     286        The function behaves according to these rules:
     287        - 'normal' mode is defined based on where the program was launched: if
     288          the launch path was the build directory, development mode \c on is
     289          normal, otherwise normal means development mode \c off.
     290        - Debug levels should not be hard configured (\c config instead of
     291          \c tconfig) in non 'normal' mode to avoid strange behaviour.
     292        - Changing the development mode from 'normal' to the other state will
     293          immediately change the debug levels to predefined values which can be
     294          reconfigured with \c tconfig.
     295    */
     296    void Core::devModeChanged()
     297    {
     298        bool isNormal = (bDevMode_ == PathConfig::buildDirectoryRun());
     299        if (isNormal)
     300        {
     301            ModifyConfigValue(debugLevelLogFile_,       update);
     302            ModifyConfigValue(debugLevelIOConsole_,     update);
     303            ModifyConfigValue(debugLevelInGameConsole_, update);
     304        }
     305        else
     306        {
     307            DefaultLogLevels::List levels = (bDevMode_ ? DefaultLogLevels::Dev : DefaultLogLevels::User);
     308            ModifyConfigValue(debugLevelLogFile_,       tset, levels.logFile);
     309            ModifyConfigValue(debugLevelIOConsole_,     tset, levels.ioConsole);
     310            ModifyConfigValue(debugLevelInGameConsole_, tset, levels.inGameConsole);
     311        }
     312    }
     313
    284314    //! Callback function if the language has changed.
    285315    void Core::languageChanged()
  • code/branches/unity_build/src/libraries/core/Core.h

    r8518 r8519  
    101101            Core(const Core&); //!< Don't use (undefined symbol)
    102102
     103            void devModeChanged();
    103104            void languageChanged();
    104105            void initRandomNumberGenerator();
Note: See TracChangeset for help on using the changeset viewer.