Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1326 for code/branches


Ignore:
Timestamp:
May 19, 2008, 4:37:06 PM (17 years ago)
Author:
landauf
Message:

fixed crash when displaying debug-level 4 and 5 in the InGameConsole. It works perfectly now, although it's not recommended, because you won't see much of your own input in the console any more ;)
however, performance is quite good. maybe i can improve it even more.

Location:
code/branches/console/src/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/core/CoreSettings.cc

    r1058 r1326  
    117117
    118118    /**
    119         @brief Static function that holds the singleton.
     119        @brief Returns the softDebugLevel for the given device (returns a default-value if the class ist right about to be created).
     120        @param device The device
     121        @return The softDebugLevel
    120122    */
    121123    int CoreSettings::getSoftDebugLevel(OutputHandler::OutputDevice device)
     
    136138        return 2;
    137139    }
     140
     141     /**
     142        @brief Sets the softDebugLevel for the given device. Please use this only temporary and restore the value afterwards, as it overrides the configured value.
     143        @param device The device
     144        @param level The level
     145    */
     146     void CoreSettings::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
     147     {
     148        if (!CoreSettings::isCreatingCoreSettings())
     149        {
     150            if (device == OutputHandler::LD_All)
     151                CoreSettings::getInstance().softDebugLevel_ = level;
     152            else if (device == OutputHandler::LD_Console)
     153                CoreSettings::getInstance().softDebugLevelConsole_ = level;
     154            else if (device == OutputHandler::LD_Logfile)
     155                CoreSettings::getInstance().softDebugLevelLogfile_ = level;
     156            else if (device == OutputHandler::LD_Shell)
     157                CoreSettings::getInstance().softDebugLevelShell_ = level;
     158        }
     159     }
    138160
    139161    /**
  • code/branches/console/src/core/CoreSettings.h

    r1064 r1326  
    5454
    5555            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
     56            static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
    5657            static const std::string& getLanguage();
    5758            static void resetLanguage();
  • code/branches/console/src/core/Shell.cc

    r1325 r1326  
    3131#include "CoreIncludes.h"
    3232#include "ConfigValueIncludes.h"
     33#include "CoreSettings.h"
    3334
    3435#define SHELL_UPDATE_LISTENERS(function) \
     
    7071    }
    7172
     73    Shell& Shell::createShell()
     74    {
     75        int level = CoreSettings::getSoftDebugLevel(OutputHandler::LD_Shell);
     76        CoreSettings::setSoftDebugLevel(OutputHandler::LD_Shell, -1);
     77        static Shell instance;
     78        CoreSettings::setSoftDebugLevel(OutputHandler::LD_Shell, level);
     79        return instance;
     80    }
     81
    7282    Shell& Shell::getInstance()
    7383    {
    74         static Shell instance;
     84        static Shell& instance = createShell();
    7585        return instance;
    7686    }
     
    325335
    326336        this->clear();
     337        this->scrollPosition_ = 0;
     338        this->scrollIterator_ = this->lines_.begin();
     339
    327340        SHELL_UPDATE_LISTENERS(exit);
    328341    }
  • code/branches/console/src/core/Shell.h

    r1322 r1326  
    5757        public:
    5858            static Shell& getInstance();
     59            static Shell& createShell();
    5960
    6061            virtual void setConfigValues();
Note: See TracChangeset for help on using the changeset viewer.