[Orxonox-commit 1387] r6105 - in code/trunk: . cmake src/libraries/core src/libraries/core/input src/libraries/network/packet src/libraries/tools src/libraries/util src/orxonox src/orxonox/gamestates src/orxonox/overlays

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Nov 20 16:55:40 CET 2009


Author: rgrieder
Date: 2009-11-20 16:55:40 +0100 (Fri, 20 Nov 2009)
New Revision: 6105

Added:
   code/trunk/src/libraries/core/IOConsole.cc
   code/trunk/src/libraries/core/IOConsole.h
Removed:
   code/trunk/src/libraries/util/OutputBuffer.cc
   code/trunk/src/libraries/util/OutputBuffer.h
   code/trunk/src/orxonox/gamestates/GSDedicated.h
   code/trunk/src/orxonox/gamestates/GSDedicatedClient.h
   code/trunk/src/orxonox/gamestates/GSIOConsole.cc
   code/trunk/src/orxonox/gamestates/GSIOConsole.h
Modified:
   code/trunk/
   code/trunk/cmake/CompilerConfigMSVC.cmake
   code/trunk/src/libraries/core/CMakeLists.txt
   code/trunk/src/libraries/core/ConfigFileManager.h
   code/trunk/src/libraries/core/ConfigValueIncludes.h
   code/trunk/src/libraries/core/ConsoleCommandCompilation.cc
   code/trunk/src/libraries/core/Core.cc
   code/trunk/src/libraries/core/Core.h
   code/trunk/src/libraries/core/CorePrereqs.h
   code/trunk/src/libraries/core/GUIManager.cc
   code/trunk/src/libraries/core/GraphicsManager.cc
   code/trunk/src/libraries/core/GraphicsManager.h
   code/trunk/src/libraries/core/LuaState.cc
   code/trunk/src/libraries/core/OrxonoxClass.cc
   code/trunk/src/libraries/core/OrxonoxClass.h
   code/trunk/src/libraries/core/PathConfig.cc
   code/trunk/src/libraries/core/Shell.cc
   code/trunk/src/libraries/core/Shell.h
   code/trunk/src/libraries/core/input/InputBuffer.cc
   code/trunk/src/libraries/core/input/InputBuffer.h
   code/trunk/src/libraries/core/input/InputHandler.h
   code/trunk/src/libraries/core/input/InputManager.cc
   code/trunk/src/libraries/network/packet/Packet.cc
   code/trunk/src/libraries/tools/ResourceCollection.h
   code/trunk/src/libraries/util/CMakeLists.txt
   code/trunk/src/libraries/util/Debug.h
   code/trunk/src/libraries/util/OrxAssert.h
   code/trunk/src/libraries/util/OutputHandler.cc
   code/trunk/src/libraries/util/OutputHandler.h
   code/trunk/src/libraries/util/UtilPrereqs.h
   code/trunk/src/orxonox/Main.cc
   code/trunk/src/orxonox/gamestates/CMakeLists.txt
   code/trunk/src/orxonox/gamestates/GSClient.cc
   code/trunk/src/orxonox/gamestates/GSMainMenu.cc
   code/trunk/src/orxonox/gamestates/GSRoot.cc
   code/trunk/src/orxonox/gamestates/GSServer.cc
   code/trunk/src/orxonox/overlays/InGameConsole.cc
   code/trunk/src/orxonox/overlays/InGameConsole.h
Log:
Merged console branch back to trunk.


Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /code/branches/core5:5768-5928,6009
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
   + /code/branches/console:5941-6104
/code/branches/core5:5768-5928,6009
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890

Modified: code/trunk/cmake/CompilerConfigMSVC.cmake
===================================================================
--- code/trunk/cmake/CompilerConfigMSVC.cmake	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/cmake/CompilerConfigMSVC.cmake	2009-11-20 15:55:40 UTC (rev 6105)
@@ -148,5 +148,6 @@
 
 # Use Link time code generation for Release config if ORXONOX_RELEASE is defined
 IF(ORXONOX_RELEASE)
+  REMOVE_COMPILER_FLAGS("-INCREMENTAL:YES" ReleaseAll CACHE)
   ADD_LINKER_FLAGS("-LTCG" ReleaseAll CACHE)
 ENDIF()

Modified: code/trunk/src/libraries/core/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/core/CMakeLists.txt	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/CMakeLists.txt	2009-11-20 15:55:40 UTC (rev 6105)
@@ -28,6 +28,7 @@
   GameState.cc
   GraphicsManager.cc
   GUIManager.cc
+  IOConsole.cc
   Language.cc
   LuaState.cc
   ObjectListBase.cc

Modified: code/trunk/src/libraries/core/ConfigFileManager.h
===================================================================
--- code/trunk/src/libraries/core/ConfigFileManager.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/ConfigFileManager.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -53,12 +53,12 @@
         static const int numberOfReservedTypes = 1024;
     };
 
-    bool config(const std::string& classname, const std::string& varname, const std::string& value);
-    bool tconfig(const std::string& classname, const std::string& varname, const std::string& value);
-    void reloadConfig();
-    void saveConfig();
-    void cleanConfig();
-    void loadSettings(const std::string& filename);
+    _CoreExport bool config(const std::string& classname, const std::string& varname, const std::string& value);
+    _CoreExport bool tconfig(const std::string& classname, const std::string& varname, const std::string& value);
+    _CoreExport void reloadConfig();
+    _CoreExport void saveConfig();
+    _CoreExport void cleanConfig();
+    _CoreExport void loadSettings(const std::string& filename);
 
 
     /////////////////////

Modified: code/trunk/src/libraries/core/ConfigValueIncludes.h
===================================================================
--- code/trunk/src/libraries/core/ConfigValueIncludes.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/ConfigValueIncludes.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -46,17 +46,17 @@
     @param varname The name of the variable
     @param defvalue The default-value of the variable
 */
-#define SetConfigValueGeneric(type, varname, defvalue) \
+#define SetConfigValueGeneric(type, varname, entryname, sectionname, defvalue) \
     static orxonox::Identifier* identifier##varname = this->getIdentifier(); \
-    orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(#varname); \
+    orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(entryname); \
     if (!container##varname) \
     { \
-        container##varname = new orxonox::ConfigValueContainer(type, identifier##varname, identifier##varname->getName(), #varname, defvalue, varname); \
-        identifier##varname->addConfigValueContainer(#varname, container##varname); \
+        container##varname = new orxonox::ConfigValueContainer(type, identifier##varname, sectionname, entryname, defvalue, varname); \
+        identifier##varname->addConfigValueContainer(entryname, container##varname); \
     } \
     container##varname->getValue(&varname, this)
 
-#define SetConfigValue(varname, defvalue) SetConfigValueGeneric(ConfigFileType::Settings, varname, defvalue)
+#define SetConfigValue(varname, defvalue) SetConfigValueGeneric(ConfigFileType::Settings, varname, #varname, identifier##varname->getName(), defvalue)
 
 
 /**

Modified: code/trunk/src/libraries/core/ConsoleCommandCompilation.cc
===================================================================
--- code/trunk/src/libraries/core/ConsoleCommandCompilation.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/ConsoleCommandCompilation.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -85,7 +85,6 @@
 
     std::string echo(const std::string& text)
     {
-        std::cout << text << std::endl;
         return text;
     }
 

Modified: code/trunk/src/libraries/core/Core.cc
===================================================================
--- code/trunk/src/libraries/core/Core.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/Core.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -63,9 +63,9 @@
 #include "GUIManager.h"
 #include "Identifier.h"
 #include "Language.h"
+#include "IOConsole.h"
 #include "LuaState.h"
 #include "ScopedSingletonManager.h"
-#include "Shell.h"
 #include "TclBind.h"
 #include "TclThreadManager.h"
 #include "input/InputManager.h"
@@ -104,27 +104,17 @@
         */
         void setConfigValues()
         {
-#ifdef NDEBUG
-            const unsigned int defaultLevelConsole = 1;
-            const unsigned int defaultLevelLogfile = 3;
-            const unsigned int defaultLevelShell   = 1;
+#ifdef ORXONOX_RELEASE
+            const unsigned int defaultLevelLogFile = 3;
 #else
-            const unsigned int defaultLevelConsole = 3;
-            const unsigned int defaultLevelLogfile = 4;
-            const unsigned int defaultLevelShell   = 3;
+            const unsigned int defaultLevelLogFile = 4;
 #endif
-            SetConfigValue(softDebugLevelConsole_, defaultLevelConsole)
-                .description("The maximal level of debug output shown in the console")
-                .callback(this, &CoreConfiguration::debugLevelChanged);
-            SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile)
-                .description("The maximal level of debug output shown in the logfile")
-                .callback(this, &CoreConfiguration::debugLevelChanged);
-            SetConfigValue(softDebugLevelShell_, defaultLevelShell)
-                .description("The maximal level of debug output shown in the ingame shell")
-                .callback(this, &CoreConfiguration::debugLevelChanged);
+            SetConfigValueGeneric(ConfigFileType::Settings, softDebugLevelLogFile_, "softDebugLevelLogFile", "OutputHandler", defaultLevelLogFile)
+                .description("The maximum level of debug output shown in the log file");
+            OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_);
 
             SetConfigValue(language_, Language::getInstance().defaultLanguage_)
-                .description("The language of the ingame text")
+                .description("The language of the in game text")
                 .callback(this, &CoreConfiguration::languageChanged);
             SetConfigValue(bInitializeRandomNumberGenerator_, true)
                 .description("If true, all random actions are different each time you start the game")
@@ -132,24 +122,6 @@
         }
 
         /**
-            @brief Callback function if the debug level has changed.
-        */
-        void debugLevelChanged()
-        {
-            // softDebugLevel_ is the maximum of the 3 variables
-            this->softDebugLevel_ = this->softDebugLevelConsole_;
-            if (this->softDebugLevelLogfile_ > this->softDebugLevel_)
-                this->softDebugLevel_ = this->softDebugLevelLogfile_;
-            if (this->softDebugLevelShell_ > this->softDebugLevel_)
-                this->softDebugLevel_ = this->softDebugLevelShell_;
-
-            OutputHandler::setSoftDebugLevel(OutputHandler::LD_All,     this->softDebugLevel_);
-            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Console, this->softDebugLevelConsole_);
-            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);
-            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell,   this->softDebugLevelShell_);
-        }
-
-        /**
             @brief Callback function if the language has changed.
         */
         void languageChanged()
@@ -177,10 +149,7 @@
             }
         }
 
-        int softDebugLevel_;                            //!< The debug level
-        int softDebugLevelConsole_;                     //!< The debug level for the console
-        int softDebugLevelLogfile_;                     //!< The debug level for the logfile
-        int softDebugLevelShell_;                       //!< The debug level for the ingame shell
+        int softDebugLevelLogFile_;                     //!< The debug level for the log file (belongs to OutputHandler)
         std::string language_;                          //!< The language
         bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
     };
@@ -220,13 +189,13 @@
         // Set configurable paths like log, config and media
         this->pathConfig_->setConfigurablePaths();
 
-        // create a signal handler (only active for linux)
+        // create a signal handler (only active for Linux)
         // This call is placed as soon as possible, but after the directories are set
         this->signalHandler_.reset(new SignalHandler());
         this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
 
-        // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
-        OutputHandler::getOutStream().setLogPath(PathConfig::getLogPathString());
+        // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used
+        OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString());
 
         // Parse additional options file now that we know its path
         CommandLineParser::parseFile();
@@ -248,6 +217,9 @@
         // Required as well for the config values
         this->languageInstance_.reset(new Language());
 
+        // create persistent io console
+        this->ioConsole_.reset(new IOConsole());
+
         // creates the class hierarchy for all classes with factories
         Identifier::createClassHierarchy();
 
@@ -262,9 +234,6 @@
         this->tclBind_.reset(new TclBind(PathConfig::getDataPathString()));
         this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));
 
-        // create a shell
-        this->shell_.reset(new Shell());
-
         // Create singletons that always exist (in other libraries)
         this->rootScope_.reset(new Scope<ScopeID::Root>());
     }
@@ -327,48 +296,6 @@
     }
 
     /**
-        @brief Returns the softDebugLevel for the given device (returns a default-value if the class is right about to be created).
-        @param device The device
-        @return The softDebugLevel
-    */
-    /*static*/ int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)
-    {
-        switch (device)
-        {
-        case OutputHandler::LD_All:
-            return Core::getInstance().configuration_->softDebugLevel_;
-        case OutputHandler::LD_Console:
-            return Core::getInstance().configuration_->softDebugLevelConsole_;
-        case OutputHandler::LD_Logfile:
-            return Core::getInstance().configuration_->softDebugLevelLogfile_;
-        case OutputHandler::LD_Shell:
-            return Core::getInstance().configuration_->softDebugLevelShell_;
-        default:
-            assert(0);
-            return 2;
-        }
-    }
-
-     /**
-        @brief Sets the softDebugLevel for the given device. Please use this only temporary and restore the value afterwards, as it overrides the configured value.
-        @param device The device
-        @param level The level
-    */
-    /*static*/ void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
-    {
-        if (device == OutputHandler::LD_All)
-            Core::getInstance().configuration_->softDebugLevel_ = level;
-        else if (device == OutputHandler::LD_Console)
-            Core::getInstance().configuration_->softDebugLevelConsole_ = level;
-        else if (device == OutputHandler::LD_Logfile)
-            Core::getInstance().configuration_->softDebugLevelLogfile_ = level;
-        else if (device == OutputHandler::LD_Shell)
-            Core::getInstance().configuration_->softDebugLevelShell_ = level;
-
-        OutputHandler::setSoftDebugLevel(device, level);
-    }
-
-    /**
         @brief Returns the configured language.
     */
     /*static*/ const std::string& Core::getLanguage()
@@ -443,6 +370,8 @@
             // graphics singletons from other libraries
             ScopedSingletonManager::update<ScopeID::Graphics>(time);
         }
+        // process console text
+        this->ioConsole_->update(time);
         // process thread commands
         this->tclThreadManager_->update(time);
     }

Modified: code/trunk/src/libraries/core/Core.h
===================================================================
--- code/trunk/src/libraries/core/Core.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/Core.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -68,8 +68,6 @@
 
             void setConfigValues();
 
-            static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
-            static void  setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
             static const std::string& getLanguage();
             static void  resetLanguage();
 
@@ -92,10 +90,10 @@
             SimpleScopeGuard              consoleCommandDestroyer_;
             scoped_ptr<ConfigFileManager> configFileManager_;
             scoped_ptr<Language>          languageInstance_;
+            scoped_ptr<IOConsole>         ioConsole_;
             scoped_ptr<CoreConfiguration> configuration_;
             scoped_ptr<TclBind>           tclBind_;
             scoped_ptr<TclThreadManager>  tclThreadManager_;
-            scoped_ptr<Shell>             shell_;
             // graphical
             scoped_ptr<GraphicsManager>   graphicsManager_;     //!< Interface to OGRE
             scoped_ptr<InputManager>      inputManager_;        //!< Interface to OIS

Modified: code/trunk/src/libraries/core/CorePrereqs.h
===================================================================
--- code/trunk/src/libraries/core/CorePrereqs.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/CorePrereqs.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -147,6 +147,7 @@
     class GraphicsManager;
     class GUIManager;
     class Identifier;
+    class IOConsole;
     class IRC;
     template <class T>
     class Iterator;

Modified: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/GUIManager.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -52,7 +52,6 @@
 #include "util/Debug.h"
 #include "util/Exception.h"
 #include "util/OrxAssert.h"
-#include "Core.h"
 #include "LuaState.h"
 #include "PathConfig.h"
 #include "Resource.h"
@@ -74,7 +73,7 @@
                 case CEGUI::Insane:      orxonoxLevel = 6; break;
                 default: OrxAssert(false, "CEGUI log level out of range, inpect immediately!");
             }
-            OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
+            OutputHandler::getOutStream(orxonoxLevel)
                 << "CEGUI: " << message << std::endl;
 
             CEGUI::DefaultLogger::logEvent(message, level);
@@ -120,20 +119,20 @@
         ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
         // set the log level according to ours (translate by subtracting 1)
         ceguiLogger->setLoggingLevel(
-            static_cast<LoggingLevel>(Core::getSoftDebugLevel(OutputHandler::LD_Logfile) - 1));
+            static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
         this->ceguiLogger_ = ceguiLogger.release();
 
         // create the CEGUI system singleton
         guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get()));
 
-        // Initialise the basic lua code
+        // Initialise the basic Lua code
         rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua", "GUI");
         this->luaState_->doFile("InitialiseGUI.lua", "GUI", false);
 
         // Align CEGUI mouse with OIS mouse
         guiSystem_->injectMousePosition(mousePosition.first, mousePosition.second);
 
-        // Hide the mouse cursor unless playing in fullscreen mode
+        // Hide the mouse cursor unless playing in full screen mode
         if (!bFullScreen)
             CEGUI::MouseCursor::getSingleton().hide();
     }
@@ -279,7 +278,7 @@
     @return
         code of the mouse button as it is used by CEGUI
 
-        Simple convertion from mouse event code in Orxonox to the one used in CEGUI.
+        Simple conversion from mouse event code in Orxonox to the one used in CEGUI.
      */
     static inline CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button)
     {

Modified: code/trunk/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/GraphicsManager.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -408,7 +408,7 @@
         default:
             orxonoxLevel = 0;
         }
-        OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
+        OutputHandler::getOutStream(orxonoxLevel)
             << "Ogre: " << message << std::endl;
     }
 

Modified: code/trunk/src/libraries/core/GraphicsManager.h
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/GraphicsManager.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -105,13 +105,13 @@
         shared_ptr<XMLFile> debugOverlay_;             //!< XML with various debug overlays
 
         // config values
-        std::string         ogreConfigFile_;           //!< ogre config file name
+        std::string         ogreConfigFile_;           //!< ogre config filename
         std::string         ogrePluginsDirectory_;     //!< Directory where the Ogre plugins are located
         std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
-        std::string         ogreLogFile_;              //!< log file name for Ogre log messages
-        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
-        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
-        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
+        std::string         ogreLogFile_;              //!< log filename for Ogre log messages
+        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonox debug level for LL_TRIVIAL
+        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonox debug level for LL_NORMAL
+        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonox debug level for LL_CRITICAL
 
         // console commands
         ConsoleCommand*     ccPrintScreen_;

Copied: code/trunk/src/libraries/core/IOConsole.cc (from rev 6103, code/branches/console/src/libraries/core/IOConsole.cc)
===================================================================
--- code/trunk/src/libraries/core/IOConsole.cc	                        (rev 0)
+++ code/trunk/src/libraries/core/IOConsole.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -0,0 +1,562 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "IOConsole.h"
+
+#include <iomanip>
+#include <iostream>
+#include "core/Game.h"
+#include "core/input/InputBuffer.h"
+
+// ##########################
+// ###   Mutual methods   ###
+// ##########################
+namespace orxonox
+{
+    IOConsole* IOConsole::singletonPtr_s = NULL;
+
+    int IOConsole::extractLogLevel(std::string* text)
+    {
+        // Handle line colouring by inspecting the first letter
+        char level = 0;
+        if (!text->empty())
+        {
+            level = (*text)[0];
+            if (level == -1 || level >= 1 && level <= 6)
+            {
+                *text = text->substr(1);
+                if (level != -1)
+                    return level;
+            }
+        }
+        return 0;
+    }
+
+    inline bool IOConsole::willPrintStatusLines()
+    {
+        return !this->statusLineWidths_.empty()
+             && this->terminalWidth_  >= this->statusLineMaxWidth_
+             && this->terminalHeight_ >= (this->minOutputLines_ + this->statusLineWidths_.size());
+    }
+
+    // ###############################
+    // ###  ShellListener methods  ###
+    // ###############################
+
+    //! Called if all output-lines have to be reprinted
+    void IOConsole::linesChanged()
+    {
+        // Method only gets called upon start to draw all the lines
+        // or when scrolling. But scrolling is disabled and the output
+        // is already in std::cout when we start the IOConsole
+    }
+
+    //! Called if the text in the input-line has changed
+    void IOConsole::inputChanged()
+    {
+        this->printInputLine();
+        this->cout_.flush();
+    }
+
+    //! Called if the position of the cursor in the input-line has changed
+    void IOConsole::cursorChanged()
+    {
+        this->printInputLine();
+        this->cout_.flush();
+    }
+
+    //! Called if a command is about to be executed
+    void IOConsole::executed()
+    {
+        this->shell_->addOutputLine(this->promptString_ + this->shell_->getInput());
+    }
+
+    //! Called if the console gets closed
+    void IOConsole::exit()
+    {
+        // Exit is not an option, just do nothing (Shell doesn't really exit too)
+    }
+}
+
+#ifdef ORXONOX_PLATFORM_UNIX
+// ###############################
+// ###   Unix Implementation   ###
+// ###############################
+
+#include <termios.h>
+#include <sys/ioctl.h>
+
+namespace orxonox
+{
+    namespace EscapeMode
+    {
+        enum Value
+        {
+            None,
+            First,
+            Second
+        };
+    }
+
+    IOConsole::IOConsole()
+        : shell_(new Shell("IOConsole", false, true))
+        , buffer_(shell_->getInputBuffer())
+        , cout_(std::cout.rdbuf())
+        , bStatusPrinted_(false)
+        , promptString_("orxonox # ")
+        , originalTerminalSettings_(new termios())
+    {
+        this->setTerminalMode();
+        this->shell_->registerListener(this);
+
+        // Manually set the widths of the individual status lines
+        this->statusLineWidths_.push_back(29);
+        this->statusLineMaxWidth_ = 29;
+
+        this->getTerminalSize();
+        this->lastTerminalWidth_ = this->terminalWidth_;
+        this->lastTerminalHeight_ = this->terminalHeight_;
+
+        // Disable standard std::cout logging
+        OutputHandler::getInstance().disableCout();
+        // Redirect std::cout to an ostringstream
+        // (Other part is in the initialiser list)
+        std::cout.rdbuf(this->origCout_.rdbuf());
+
+        // Make sure we make way for the status lines
+        this->update(Game::getInstance().getGameClock());
+    }
+
+    IOConsole::~IOConsole()
+    {
+        // Empty all buffers
+        this->update(Game::getInstance().getGameClock());
+        // Erase input and status lines
+        this->cout_ << "\033[1G\033[J";
+        // Move cursor to the bottom
+        this->cout_ << "\033[" << this->statusLineWidths_.size() << 'B';
+        // Scroll terminal to compensate for erased lines
+        this->cout_ << "\033[" << this->statusLineWidths_.size() << 'T';
+
+        resetTerminalMode();
+        delete this->originalTerminalSettings_;
+        this->shell_->destroy();
+
+        // Restore this->cout_ redirection
+        std::cout.rdbuf(this->cout_.rdbuf());
+        // Enable standard std::cout logging again
+        OutputHandler::getInstance().enableCout();
+    }
+
+    void IOConsole::update(const Clock& time)
+    {
+        unsigned char c;
+        std::string escapeSequence;
+        EscapeMode::Value escapeMode = EscapeMode::None;
+        while (std::cin.good())
+        {
+            c = std::cin.get();
+            if (!std::cin.good())
+                break;
+
+            if (escapeMode == EscapeMode::First && (c == '[' || c=='O') )
+                escapeMode = EscapeMode::Second;
+            // Get Alt+Tab combination when switching applications
+            else if (escapeMode == EscapeMode::First && c == '\t')
+            {
+                this->buffer_->buttonPressed(KeyEvent(KeyCode::Tab, '\t', KeyboardModifier::Alt));
+                escapeMode = EscapeMode::None;
+            }
+            else if (escapeMode == EscapeMode::Second)
+            {
+                escapeSequence += c;
+                escapeMode = EscapeMode::None;
+                if      (escapeSequence == "A")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::Up,       0, 0));
+                else if (escapeSequence == "B")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::Down,     0, 0));
+                else if (escapeSequence == "C")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::Right,    0, 0));
+                else if (escapeSequence == "D")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::Left,     0, 0));
+                else if (escapeSequence == "1~" || escapeSequence == "H")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::Home,     0, 0));
+                else if (escapeSequence == "2~")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::Insert,   0, 0));
+                else if (escapeSequence == "3~")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::Delete,   0, 0));
+                else if (escapeSequence == "4~" || escapeSequence == "F")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::End,      0, 0));
+                else if (escapeSequence == "5~")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::PageUp,   0, 0));
+                else if (escapeSequence == "6~")
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::PageDown, 0, 0));
+                else
+                    // Waiting for sequence to complete
+                    // If the user presses ESC and then '[' or 'O' while the loop is not
+                    // running (for instance while loading), the whole sequence gets dropped
+                    escapeMode = EscapeMode::Second;
+            }
+            else // not in an escape sequence OR user might have pressed just ESC
+            {
+                if (escapeMode == EscapeMode::First)
+                {
+                    this->buffer_->buttonPressed(KeyEvent(KeyCode::Escape, c, 0));
+                    escapeMode = EscapeMode::None;
+                }
+                if (c == '\033')
+                {
+                    escapeMode = EscapeMode::First;
+                    escapeSequence.clear();
+                }
+                else
+                {
+                    KeyCode::ByEnum code;
+                    switch (c)
+                    {
+                    case '\n'  : case '\r': code = KeyCode::Return; break;
+                    case '\177': case '\b': code = KeyCode::Back;   break;
+                    case '\t'             : code = KeyCode::Tab;    break;
+                    default:
+                        // We don't encode the key code (would be a very large switch)
+                        // because the InputBuffer will only insert the text anyway
+                        // Replacement character is simply KeyCode::A
+                        code = KeyCode::A;
+                    }
+                    this->buffer_->buttonPressed(KeyEvent(code, c, 0));
+                }
+            }
+        }
+        // Reset error flags in std::cin
+        std::cin.clear();
+
+        // If there is still an escape key pending (escape key ONLY), then
+        // it sure isn't an escape sequence anymore
+        if (escapeMode == EscapeMode::First)
+            this->buffer_->buttonPressed(KeyEvent(KeyCode::Escape, '\033', 0));
+
+        // Determine terminal width and height
+        this->lastTerminalWidth_ = this->terminalWidth_;
+        this->lastTerminalHeight_ = this->terminalHeight_;
+        this->getTerminalSize();
+
+        int heightDiff = this->terminalHeight_ - this->lastTerminalHeight_;
+        if (this->bStatusPrinted_ && heightDiff < 0)
+        {
+            // Terminal width has shrunk. The cursor will still be on the input line,
+            // but that line might very well be the last
+            int newLines = std::min((int)this->statusLineWidths_.size(), -heightDiff);
+            // Scroll terminal to create new lines
+            this->cout_ << "\033[" << newLines << 'S';
+        }
+
+        if (!this->bStatusPrinted_ && this->willPrintStatusLines())
+        {
+            // Scroll console to make way for status lines
+            this->cout_ << "\033[" << this->statusLineWidths_.size() << 'S';
+            this->bStatusPrinted_ = true;
+        }
+
+        // We always assume that the cursor is on the inputline.
+        // But we cannot always be sure about that, esp. if we scroll the console
+        this->cout_ << "\033[" << this->statusLineWidths_.size() << 'B';
+        this->cout_ << "\033[" << this->statusLineWidths_.size() << 'A';
+
+        // Erase status and input lines
+        this->cout_ << "\033[1G\033[J";
+        this->printInputLine();
+        this->printStatusLines();
+        this->cout_.flush();
+
+        // Process output written to std::cout
+        if (!this->origCout_.str().empty())
+        {
+            this->shell_->addOutputLine(this->origCout_.str());
+            this->origCout_.str("");
+        }
+    }
+
+    void IOConsole::printLogText(const std::string& text)
+    {
+        std::string output = text;
+        /*int level =*/ this->extractLogLevel(&output);
+
+/*
+        // Colour line
+        switch (level)
+        {
+        case -1: this->cout_ << "\033[37m"; break;
+        case  1: this->cout_ << "\033[91m"; break;
+        case  2: this->cout_ << "\033[31m"; break;
+        case  3: this->cout_ << "\033[34m"; break;
+        case  4: this->cout_ << "\033[36m"; break;
+        case  5: this->cout_ << "\033[35m"; break;
+        case  6: this->cout_ << "\033[37m"; break;
+        default: break;
+        }
+*/
+
+        // Print output line
+        this->cout_ << output;
+
+        // Reset colour to white
+//        this->cout_ << "\033[37m";
+    }
+
+    void IOConsole::printInputLine()
+    {
+        // Set cursor to the beginning of the line and erase the line
+        this->cout_ << "\033[1G\033[K";
+        // Indicate a command prompt
+        this->cout_ << this->promptString_;
+        // Save cursor position
+        this->cout_ << "\033[s";
+        // Print command line buffer
+        this->cout_ << this->shell_->getInput();
+        // Restore cursor position and move it to the right
+        this->cout_ << "\033[u";
+        if (this->buffer_->getCursorPosition() > 0)
+            this->cout_ << "\033[" << this->buffer_->getCursorPosition() << "C";
+    }
+
+    void IOConsole::printStatusLines()
+    {
+        if (this->willPrintStatusLines())
+        {
+            // Save cursor position
+            this->cout_ << "\033[s";
+            // Move cursor down (don't create a new line here because the buffer might flush then!)
+            this->cout_ << "\033[1B\033[1G";
+            this->cout_ << std::fixed << std::setprecision(2) << std::setw(5) << Game::getInstance().getAvgFPS() << " fps, ";
+            this->cout_ <<               std::setprecision(2) << std::setw(5) << Game::getInstance().getAvgTickTime() << " ms tick time";
+            // Restore cursor position
+            this->cout_ << "\033[u";
+            this->bStatusPrinted_ = true;
+        }
+        else
+            this->bStatusPrinted_ = false;
+    }
+
+    void IOConsole::setTerminalMode()
+    {
+        termios new_settings;
+
+        tcgetattr(0, this->originalTerminalSettings_);
+        new_settings = *this->originalTerminalSettings_;
+        new_settings.c_lflag &= ~(ICANON | ECHO);
+        //new_settings.c_lflag |= (ISIG | IEXTEN);
+        new_settings.c_cc[VTIME] = 0;
+        new_settings.c_cc[VMIN]  = 0;
+        tcsetattr(0, TCSANOW, &new_settings);
+    }
+
+    void IOConsole::resetTerminalMode()
+    {
+        tcsetattr(0, TCSANOW, IOConsole::originalTerminalSettings_);
+    }
+
+    void IOConsole::getTerminalSize()
+    {
+#ifdef TIOCGSIZE
+        struct ttysize win;
+        if (!ioctl(STDIN_FILENO, TIOCGSIZE, &win))
+        {
+            this->terminalWidth_  = win.ts_cols;
+            this->terminalHeight_ = win.ts_lines;
+            return;
+        }
+#elif defined TIOCGWINSZ
+        struct winsize win;
+        if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &win))
+        {
+            this->terminalWidth_  = win.ws_col;
+            this->terminalHeight_ = win.ws_row;
+            return;
+        }
+#else
+        const char* s = getenv("COLUMNS");
+        this->terminalWidth_  = s ? strtol(s, NULL, 10) : 80;
+        s = getenv("LINES");
+        this->terminalHeight_ = s ? strtol(s, NULL, 10) : 24;
+        return;
+#endif
+        this->terminalWidth_  = 80;
+        this->terminalHeight_ = 24;
+    }
+
+    // ###############################
+    // ###  ShellListener methods  ###
+    // ###############################
+
+    //! Called if only the last output-line has changed
+    void IOConsole::onlyLastLineChanged()
+    {
+        // Save cursor position and move it to the beginning of the first output line
+        this->cout_ << "\033[s\033[1A\033[1G";
+        // Erase the line
+        this->cout_ << "\033[K";
+        // Reprint the last output line
+        this->printLogText(*(this->shell_->getNewestLineIterator()));
+        // Restore cursor
+        this->cout_ << "\033[u";
+        this->cout_.flush();
+    }
+
+    //! Called if a new output-line was added
+    void IOConsole::lineAdded()
+    {
+        int newLines = this->shell_->getNewestLineIterator()->size() / this->terminalWidth_ + 1;
+        // Create new lines by scrolling the screen
+        this->cout_ << "\033[" << newLines << 'S';
+        // Move cursor to the beginning of the new (last) output line
+        this->cout_ << "\033[" << newLines << "A\033[1G";
+        // Erase screen from here
+        this->cout_ << "\033[J";
+        // Print the new output lines
+        for (int i = 0; i < newLines; ++i)
+            this->printLogText(this->shell_->getNewestLineIterator()->substr(i*this->terminalWidth_, this->terminalWidth_));
+        // Move cursor down
+        this->cout_ << "\033[1B\033[1G";
+        // Print status and input lines
+        this->printInputLine();
+        this->printStatusLines();
+        this->cout_.flush();
+    }
+}
+
+#elif defined(ORXONOX_PLATFORM_WINDOWS)
+// ##################################
+// ###   Windows Implementation   ###
+// ##################################
+
+namespace orxonox
+{
+    IOConsole::IOConsole()
+        : shell_(new Shell("IOConsole", false, true))
+        , buffer_(shell_->getInputBuffer())
+        , cout_(std::cout.rdbuf())
+        , bStatusPrinted_(false)
+        , promptString_("orxonox # ")
+    {
+/*
+        this->setTerminalMode();
+        this->shell_->registerListener(this);
+
+        // Manually set the widths of the individual status lines
+        this->statusLineWidths_.push_back(29);
+        this->statusLineMaxWidth_ = 29;
+
+        this->getTerminalSize();
+        this->lastTerminalWidth_ = this->terminalWidth_;
+        this->lastTerminalHeight_ = this->terminalHeight_;
+
+        // Disable standard this->cout_ logging
+        OutputHandler::getInstance().disableCout();
+*/
+    }
+
+    IOConsole::~IOConsole()
+    {
+/*
+        resetTerminalMode();
+        this->shell_->destroy();
+
+        // Enable standard this->cout_ logging again
+        OutputHandler::getInstance().enableCout();
+*/
+    }
+
+    void IOConsole::update(const Clock& time)
+    {
+/*
+        unsigned char c = 0;
+        while (std::cin.good())
+        {
+            c = std::cin.get();
+            if (std::cin.bad())
+                break;
+        }
+        // Reset error flags in std::cin
+        std::cin.clear();
+
+        // Determine terminal width and height
+        this->lastTerminalWidth_ = this->terminalWidth_;
+        this->lastTerminalHeight_ = this->terminalHeight_;
+        this->getTerminalSize();
+*/
+    }
+
+    void IOConsole::printLogText(const std::string& text)
+    {
+    }
+
+    void IOConsole::printInputLine()
+    {
+    }
+
+    void IOConsole::printStatusLines()
+    {
+/*
+        if (this->willPrintStatusLines())
+        {
+            this->bStatusPrinted_ = true;
+        }
+        else
+            this->bStatusPrinted_ = false;
+*/
+    }
+
+    void IOConsole::setTerminalMode()
+    {
+    }
+
+    void IOConsole::resetTerminalMode()
+    {
+    }
+
+    void IOConsole::getTerminalSize()
+    {
+    }
+
+    // ###############################
+    // ###  ShellListener methods  ###
+    // ###############################
+
+    //! Called if only the last output-line has changed
+    void IOConsole::onlyLastLineChanged()
+    {
+    }
+
+    //! Called if a new output-line was added
+    void IOConsole::lineAdded()
+    {
+    }
+}
+
+#endif /* ORXONOX_PLATFORM_UNIX */

Copied: code/trunk/src/libraries/core/IOConsole.h (from rev 6103, code/branches/console/src/libraries/core/IOConsole.h)
===================================================================
--- code/trunk/src/libraries/core/IOConsole.h	                        (rev 0)
+++ code/trunk/src/libraries/core/IOConsole.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -0,0 +1,99 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _IOConsole_H__
+#define _IOConsole_H__
+
+#include "CorePrereqs.h"
+
+#include <sstream>
+#include <string>
+#include <vector>
+#include "util/Singleton.h"
+#include "core/Shell.h"
+
+#ifdef ORXONOX_PLATFORM_UNIX
+struct termios;
+#endif
+
+namespace orxonox
+{
+    class _CoreExport IOConsole : public Singleton<IOConsole>, public ShellListener
+    {
+        friend class Singleton<IOConsole>;
+
+    public:
+        IOConsole();
+        ~IOConsole();
+
+        void update(const Clock& time);
+
+    private:
+        void setTerminalMode();
+        void resetTerminalMode();
+        void getTerminalSize();
+        bool willPrintStatusLines();
+        int extractLogLevel(std::string* text);
+
+        void printLogText(const std::string& line);
+        void printInputLine();
+        void printStatusLines();
+
+        // Methods from ShellListener
+        void linesChanged();
+        void onlyLastLineChanged();
+        void lineAdded();
+        void inputChanged();
+        void cursorChanged();
+        void executed();
+        void exit();
+        Shell*                  shell_;
+        InputBuffer*            buffer_;
+        std::ostream            cout_;
+        std::ostringstream      origCout_;
+        unsigned int            terminalWidth_;
+        unsigned int            terminalHeight_;
+        unsigned int            lastTerminalWidth_;
+        unsigned int            lastTerminalHeight_;
+        bool                    bPrintStatusLine_;
+        bool                    bStatusPrinted_;
+        std::vector<unsigned>   statusLineWidths_;
+        unsigned int            statusLineMaxWidth_;
+        const std::string       promptString_;
+        static const unsigned   minOutputLines_ = 3;
+
+#ifdef ORXONOX_PLATFORM_UNIX
+        termios*                originalTerminalSettings_;
+#endif
+
+        static IOConsole* singletonPtr_s;
+    };
+}
+
+#endif /* _IOConsole_H__ */

Modified: code/trunk/src/libraries/core/LuaState.cc
===================================================================
--- code/trunk/src/libraries/core/LuaState.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/LuaState.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -181,7 +181,7 @@
 
     void LuaState::luaLog(unsigned int level, const std::string& message)
     {
-        OutputHandler::getOutStream().setOutputLevel(level) << message << std::endl;
+        OutputHandler::getOutStream(level) << message << std::endl;
     }
 
     bool LuaState::fileExists(const std::string& filename, const std::string& resourceGroup, bool bSearchOtherPaths)

Modified: code/trunk/src/libraries/core/OrxonoxClass.cc
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/OrxonoxClass.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -33,6 +33,7 @@
 
 #include "OrxonoxClass.h"
 
+#include <cassert>
 #include "MetaObjectList.h"
 #include "Identifier.h"
 #include "WeakPtr.h"
@@ -71,6 +72,7 @@
     /** @brief Deletes the object if no smart pointers point to this object. Otherwise schedules the object to be deleted as soon as possible. */
     void OrxonoxClass::destroy()
     {
+        assert(this); // Just in case someone tries to delete a NULL pointer
         this->requestedDestruction_ = true;
         if (this->referenceCount_ == 0)
             delete this;

Modified: code/trunk/src/libraries/core/OrxonoxClass.h
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/OrxonoxClass.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -42,6 +42,13 @@
 #include <set>
 #include <vector>
 
+/**
+ at def CCOUT
+    Acts almost exactly like COUT(x), but prepends "ClassName: "
+*/
+#define CCOUT(level) \
+    COUT(level) << this->getIdentifier()->getName() << ": "
+
 namespace orxonox
 {
     //! The class all objects and interfaces of the game-logic (not the engine) are derived from.

Modified: code/trunk/src/libraries/core/PathConfig.cc
===================================================================
--- code/trunk/src/libraries/core/PathConfig.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/PathConfig.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -262,6 +262,10 @@
         std::string pathVariable = getenv("PATH");
         putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + modulePath_.string()).c_str()));
 
+        // Make sure the path exists, otherwise don't load modules
+        if (!boost::filesystem::exists(modulePath_))
+            return modulePaths;
+
         boost::filesystem::directory_iterator file(modulePath_);
         boost::filesystem::directory_iterator end;
 

Modified: code/trunk/src/libraries/core/Shell.cc
===================================================================
--- code/trunk/src/libraries/core/Shell.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/Shell.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -22,81 +22,92 @@
  *   Author:
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Reto Grieder
  *
  */
 
 #include "Shell.h"
 
 #include "util/OutputHandler.h"
+#include "util/StringUtils.h"
+#include "util/SubString.h"
 #include "CommandExecutor.h"
 #include "CoreIncludes.h"
 #include "ConfigValueIncludes.h"
-#include "Core.h"
 #include "ConsoleCommand.h"
 
-#define SHELL_UPDATE_LISTENERS(function) \
-    for (std::list<ShellListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ) \
-        (*(it++))->function()
-
 namespace orxonox
 {
-    SetConsoleCommand(Shell, clearShell, true);
-    SetConsoleCommand(Shell, history, true);
-
     SetConsoleCommandShortcut(OutputHandler, log);
     SetConsoleCommandShortcut(OutputHandler, error);
     SetConsoleCommandShortcut(OutputHandler, warning);
     SetConsoleCommandShortcut(OutputHandler, info);
     SetConsoleCommandShortcut(OutputHandler, debug);
 
-    Shell* Shell::singletonPtr_s = 0;
-
-    Shell::Shell()
+    Shell::Shell(const std::string& consoleName, bool bScrollable, bool bPrependOutputLevel)
+        : OutputListener(consoleName)
+        , inputBuffer_(new InputBuffer())
+        , consoleName_(consoleName)
+        , bPrependOutputLevel_(bPrependOutputLevel)
+        , bScrollable_(bScrollable)
     {
-        int level = Core::getSoftDebugLevel(OutputHandler::LD_Shell);
-        Core::setSoftDebugLevel(OutputHandler::LD_Shell, -1);
-
         RegisterRootObject(Shell);
 
         this->scrollPosition_ = 0;
         this->maxHistoryLength_ = 100;
         this->historyPosition_ = 0;
         this->historyOffset_ = 0;
-        this->finishedLastLine_ = true;
-        this->bAddOutputLevel_ = false;
+        this->bFinishedLastLine_ = true;
 
-        this->clearLines();
-
-        this->inputBuffer_ = new InputBuffer();
+        this->clearOutput();
         this->configureInputBuffer();
 
-        this->outputBuffer_.registerListener(this);
-        OutputHandler::getOutStream().setOutputBuffer(&this->outputBuffer_);
-
         // Get a config file for the command history
         this->commandHistoryConfigFileType_ = ConfigFileManager::getInstance().getNewConfigFileType();
         ConfigFileManager::getInstance().setFilename(this->commandHistoryConfigFileType_, "commandHistory.ini");
 
+        // Use a stringstream object to buffer the output and get it line by line in update()
+        this->outputStream_ = &this->outputBuffer_;
+
         this->setConfigValues();
 
-        Core::setSoftDebugLevel(OutputHandler::LD_Shell, level);
+        // Get the previous output and add it to the Shell
+        for (OutputHandler::OutputVectorIterator it = OutputHandler::getInstance().getOutputVectorBegin();
+            it != OutputHandler::getInstance().getOutputVectorEnd(); ++it)
+        {
+            if (it->first <= this->getSoftDebugLevel())
+            {
+                this->outputBuffer_ << it->second;
+                this->outputChanged(it->first);
+            }
+        }
+
+        // Register the shell as output listener
+        OutputHandler::getInstance().registerOutputListener(this);
     }
 
     Shell::~Shell()
     {
-        OutputHandler::getOutStream().setOutputBuffer(0);
-        if (this->inputBuffer_)
-            this->inputBuffer_->destroy();
+        OutputHandler::getInstance().unregisterOutputListener(this);
+        this->inputBuffer_->destroy();
     }
 
     void Shell::setConfigValues()
     {
-        SetConfigValueGeneric(commandHistoryConfigFileType_, maxHistoryLength_, 100)
+        SetConfigValue(maxHistoryLength_, 100)
             .callback(this, &Shell::commandHistoryLengthChanged);
-        SetConfigValueGeneric(commandHistoryConfigFileType_, historyOffset_, 0)
+        SetConfigValue(historyOffset_, 0)
             .callback(this, &Shell::commandHistoryOffsetChanged);
         SetConfigValueVectorGeneric(commandHistoryConfigFileType_, commandHistory_, std::vector<std::string>());
+
+#ifdef ORXONOX_RELEASE
+        const unsigned int defaultLevel = 1;
+#else
+        const unsigned int defaultLevel = 3;
+#endif
+        SetConfigValueGeneric(ConfigFileType::Settings, softDebugLevel_, "softDebugLevel" + this->consoleName_, "OutputHandler", defaultLevel)
+            .description("The maximal level of debug output shown in the Shell");
+        this->setSoftDebugLevel(this->softDebugLevel_);
     }
 
     void Shell::commandHistoryOffsetChanged()
@@ -120,39 +131,46 @@
     void Shell::configureInputBuffer()
     {
         this->inputBuffer_->registerListener(this, &Shell::inputChanged, true);
-        this->inputBuffer_->registerListener(this, &Shell::execute, '\r', false);
-        this->inputBuffer_->registerListener(this, &Shell::hintandcomplete, '\t', true);
-        this->inputBuffer_->registerListener(this, &Shell::backspace, '\b', true);
-        this->inputBuffer_->registerListener(this, &Shell::deletechar, KeyCode::Delete);
-        this->inputBuffer_->registerListener(this, &Shell::exit, static_cast<char>(27), true);
-        this->inputBuffer_->registerListener(this, &Shell::cursor_right, KeyCode::Right);
-        this->inputBuffer_->registerListener(this, &Shell::cursor_left, KeyCode::Left);
-        this->inputBuffer_->registerListener(this, &Shell::cursor_end, KeyCode::End);
-        this->inputBuffer_->registerListener(this, &Shell::cursor_home, KeyCode::Home);
-        this->inputBuffer_->registerListener(this, &Shell::history_up, KeyCode::Up);
-        this->inputBuffer_->registerListener(this, &Shell::history_down, KeyCode::Down);
-        this->inputBuffer_->registerListener(this, &Shell::scroll_up, KeyCode::PageUp);
-        this->inputBuffer_->registerListener(this, &Shell::scroll_down, KeyCode::PageDown);
+        this->inputBuffer_->registerListener(this, &Shell::execute,         '\r',   false);
+        this->inputBuffer_->registerListener(this, &Shell::execute,         '\n',   false);
+        this->inputBuffer_->registerListener(this, &Shell::hintAndComplete, '\t',   true);
+        this->inputBuffer_->registerListener(this, &Shell::backspace,       '\b',   true);
+        this->inputBuffer_->registerListener(this, &Shell::backspace,       '\177', true);
+        this->inputBuffer_->registerListener(this, &Shell::exit,            '\033', true); // escape
+        this->inputBuffer_->registerListener(this, &Shell::deleteChar,      KeyCode::Delete);
+        this->inputBuffer_->registerListener(this, &Shell::cursorRight,     KeyCode::Right);
+        this->inputBuffer_->registerListener(this, &Shell::cursorLeft,      KeyCode::Left);
+        this->inputBuffer_->registerListener(this, &Shell::cursorEnd,       KeyCode::End);
+        this->inputBuffer_->registerListener(this, &Shell::cursorHome,      KeyCode::Home);
+        this->inputBuffer_->registerListener(this, &Shell::historyUp,       KeyCode::Up);
+        this->inputBuffer_->registerListener(this, &Shell::historyDown,     KeyCode::Down);
+        if (this->bScrollable_)
+        {
+            this->inputBuffer_->registerListener(this, &Shell::scrollUp,    KeyCode::PageUp);
+            this->inputBuffer_->registerListener(this, &Shell::scrollDown,  KeyCode::PageDown);
+        }
+        else
+        {
+            this->inputBuffer_->registerListener(this, &Shell::historySearchUp,   KeyCode::PageUp);
+            this->inputBuffer_->registerListener(this, &Shell::historySearchDown, KeyCode::PageDown);
+        }
     }
 
-    void Shell::clearShell()
-    {
-        Shell::getInstance().clearLines();
-    }
-
+    /*
     void Shell::history()
     {
         Shell& instance = Shell::getInstance();
 
         for (unsigned int i = instance.historyOffset_; i < instance.commandHistory_.size(); ++i)
-            instance.addLine(instance.commandHistory_[i], -1);
+            instance.addOutputLine(instance.commandHistory_[i], -1);
         for (unsigned int i =  0; i < instance.historyOffset_; ++i)
-            instance.addLine(instance.commandHistory_[i], -1);
+            instance.addOutputLine(instance.commandHistory_[i], -1);
     }
+    */
 
     void Shell::registerListener(ShellListener* listener)
     {
-        this->listeners_.insert(this->listeners_.end(), listener);
+        this->listeners_.push_back(listener);
     }
 
     void Shell::unregisterListener(ShellListener* listener)
@@ -160,7 +178,7 @@
         for (std::list<ShellListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); )
         {
             if ((*it) == listener)
-                this->listeners_.erase(it++);
+                it = this->listeners_.erase(it);
             else
                 ++it;
         }
@@ -169,36 +187,30 @@
     void Shell::setCursorPosition(unsigned int cursor)
     {
         this->inputBuffer_->setCursorPosition(cursor);
-        SHELL_UPDATE_LISTENERS(cursorChanged);
+        this->updateListeners<&ShellListener::cursorChanged>();
     }
 
-    void Shell::setInput(const std::string& input)
+    void Shell::addOutputLine(const std::string& line, int level)
     {
-        this->inputBuffer_->set(input);
-        this->inputChanged();
+        // Make sure we really only have one line per line (no new lines!)
+        SubString lines(line, '\n');
+        for (unsigned i = 0; i < lines.size(); ++i)
+        {
+            if (level <= this->softDebugLevel_)
+                this->outputLines_.push_front(lines[i]);
+            this->updateListeners<&ShellListener::lineAdded>();
+        }
     }
 
-    void Shell::addLine(const std::string& line, int level)
+    void Shell::clearOutput()
     {
-        int original_level = OutputHandler::getOutStream().getOutputLevel();
-        OutputHandler::getOutStream().setOutputLevel(level);
+        this->outputLines_.clear();
+        this->scrollIterator_ = this->outputLines_.begin();
 
-        if (!this->finishedLastLine_)
-            this->outputBuffer_ << std::endl;
-
-        this->outputBuffer_ << line << std::endl;
-        OutputHandler::getOutStream().setOutputLevel(original_level);
-    }
-
-    void Shell::clearLines()
-    {
-        this->lines_.clear();
-        this->scrollIterator_ = this->lines_.begin();
-
         this->scrollPosition_ = 0;
-        this->finishedLastLine_ = true;
+        this->bFinishedLastLine_ = true;
 
-        SHELL_UPDATE_LISTENERS(linesChanged);
+        this->updateListeners<&ShellListener::linesChanged>();
     }
 
     std::list<std::string>::const_iterator Shell::getNewestLineIterator() const
@@ -206,12 +218,12 @@
         if (this->scrollPosition_)
             return this->scrollIterator_;
         else
-            return this->lines_.begin();
+            return this->outputLines_.begin();
     }
 
     std::list<std::string>::const_iterator Shell::getEndIterator() const
     {
-        return this->lines_.end();
+        return this->outputLines_.end();
     }
 
     void Shell::addToHistory(const std::string& command)
@@ -230,67 +242,92 @@
             return "";
     }
 
-    void Shell::outputChanged()
+    void Shell::outputChanged(int level)
     {
-        std::string output;
-        bool newline;
+        bool newline = false;
         do
         {
-            newline = this->outputBuffer_.getLine(&output);
+            std::string output;
+            std::getline(this->outputBuffer_, output);
 
+            bool eof = this->outputBuffer_.eof();
+            bool fail = this->outputBuffer_.fail();
+            if (eof)
+                this->outputBuffer_.flush();
+            if (eof || fail)
+                this->outputBuffer_.clear();
+            newline = (!eof && !fail);
+
             if (!newline && output == "")
                 break;
 
-            if (this->finishedLastLine_)
+            if (this->bFinishedLastLine_)
             {
-                if (this->bAddOutputLevel_)
-                    output.insert(0, 1, static_cast<char>(OutputHandler::getOutStream().getOutputLevel()));
+                if (this->bPrependOutputLevel_)
+                    output.insert(0, 1, static_cast<char>(level));
 
-                this->lines_.insert(this->lines_.begin(), output);
+                this->outputLines_.push_front(output);
 
                 if (this->scrollPosition_)
                     this->scrollPosition_++;
                 else
-                    this->scrollIterator_ = this->lines_.begin();
+                    this->scrollIterator_ = this->outputLines_.begin();
 
-                this->finishedLastLine_ = newline;
+                this->bFinishedLastLine_ = newline;
 
                 if (!this->scrollPosition_)
                 {
-                    SHELL_UPDATE_LISTENERS(lineAdded);
+                    this->updateListeners<&ShellListener::lineAdded>();
                 }
             }
             else
             {
-                (*this->lines_.begin()) += output;
-                this->finishedLastLine_ = newline;
-                SHELL_UPDATE_LISTENERS(onlyLastLineChanged);
+                (*this->outputLines_.begin()) += output;
+                this->bFinishedLastLine_ = newline;
+                this->updateListeners<&ShellListener::onlyLastLineChanged>();
             }
 
         } while (newline);
     }
 
+    void Shell::clearInput()
+    {
+        this->inputBuffer_->clear();
+        this->historyPosition_ = 0;
+        this->updateListeners<&ShellListener::inputChanged>();
+        this->updateListeners<&ShellListener::cursorChanged>();
+    }
+
+    void Shell::setPromptPrefix(const std::string& str)
+    {
+    }
+
+
+    // ##########################################
+    // ###   InputBuffer callback functions   ###
+    // ##########################################
+
     void Shell::inputChanged()
     {
-        SHELL_UPDATE_LISTENERS(inputChanged);
-        SHELL_UPDATE_LISTENERS(cursorChanged);
+        this->updateListeners<&ShellListener::inputChanged>();
+        this->updateListeners<&ShellListener::cursorChanged>();
     }
 
     void Shell::execute()
     {
         this->addToHistory(this->inputBuffer_->get());
-        this->addLine(this->inputBuffer_->get(), 0);
+        this->updateListeners<&ShellListener::executed>();
 
         if (!CommandExecutor::execute(this->inputBuffer_->get()))
-            this->addLine("Error: Can't execute \"" + this->inputBuffer_->get() + "\".", 1);
+            this->addOutputLine("Error: Can't execute \"" + this->inputBuffer_->get() + "\".", 1);
 
-        this->clear();
+        this->clearInput();
     }
 
-    void Shell::hintandcomplete()
+    void Shell::hintAndComplete()
     {
         this->inputBuffer_->set(CommandExecutor::complete(this->inputBuffer_->get()));
-        this->addLine(CommandExecutor::hint(this->inputBuffer_->get()), -1);
+        this->addOutputLine(CommandExecutor::hint(this->inputBuffer_->get()), -1);
 
         this->inputChanged();
     }
@@ -298,49 +335,56 @@
     void Shell::backspace()
     {
         this->inputBuffer_->removeBehindCursor();
-        SHELL_UPDATE_LISTENERS(inputChanged);
-        SHELL_UPDATE_LISTENERS(cursorChanged);
+        this->updateListeners<&ShellListener::inputChanged>();
+        this->updateListeners<&ShellListener::cursorChanged>();
     }
 
-    void Shell::deletechar()
+    void Shell::exit()
     {
-        this->inputBuffer_->removeAtCursor();
-        SHELL_UPDATE_LISTENERS(inputChanged);
+        if (this->inputBuffer_->getSize() > 0)
+        {
+            this->clearInput();
+            return;
+        }
+
+        this->clearInput();
+        this->scrollPosition_ = 0;
+        this->scrollIterator_ = this->outputLines_.begin();
+
+        this->updateListeners<&ShellListener::exit>();
     }
 
-    void Shell::clear()
+    void Shell::deleteChar()
     {
-        this->inputBuffer_->clear();
-        this->historyPosition_ = 0;
-        SHELL_UPDATE_LISTENERS(inputChanged);
-        SHELL_UPDATE_LISTENERS(cursorChanged);
+        this->inputBuffer_->removeAtCursor();
+        this->updateListeners<&ShellListener::inputChanged>();
     }
 
-    void Shell::cursor_right()
+    void Shell::cursorRight()
     {
         this->inputBuffer_->increaseCursor();
-        SHELL_UPDATE_LISTENERS(cursorChanged);
+        this->updateListeners<&ShellListener::cursorChanged>();
     }
 
-    void Shell::cursor_left()
+    void Shell::cursorLeft()
     {
         this->inputBuffer_->decreaseCursor();
-        SHELL_UPDATE_LISTENERS(cursorChanged);
+        this->updateListeners<&ShellListener::cursorChanged>();
     }
 
-    void Shell::cursor_end()
+    void Shell::cursorEnd()
     {
         this->inputBuffer_->setCursorToEnd();
-        SHELL_UPDATE_LISTENERS(cursorChanged);
+        this->updateListeners<&ShellListener::cursorChanged>();
     }
 
-    void Shell::cursor_home()
+    void Shell::cursorHome()
     {
         this->inputBuffer_->setCursorToBegin();
-        SHELL_UPDATE_LISTENERS(cursorChanged);
+        this->updateListeners<&ShellListener::cursorChanged>();
     }
 
-    void Shell::history_up()
+    void Shell::historyUp()
     {
         if (this->historyPosition_ < this->commandHistory_.size())
         {
@@ -349,7 +393,7 @@
         }
     }
 
-    void Shell::history_down()
+    void Shell::historyDown()
     {
         if (this->historyPosition_ > 0)
         {
@@ -358,40 +402,61 @@
         }
     }
 
-    void Shell::scroll_up()
+    void Shell::historySearchUp()
     {
-        if (this->scrollIterator_ != this->lines_.end())
+        if (this->historyPosition_ == this->historyOffset_)
+            return;
+        unsigned int cursorPosition = this->getCursorPosition();
+        std::string input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning of the inputline until the cursor position
+        for (unsigned int newPos = this->historyPosition_ + 1; newPos <= this->historyOffset_; newPos++)
         {
-            ++this->scrollIterator_;
-            ++this->scrollPosition_;
+            if (getLowercase(this->commandHistory_[this->historyOffset_ - newPos]).find(getLowercase(input_str)) == 0) // search case insensitive
+            {
+                this->historyPosition_ = newPos;
+                this->inputBuffer_->set(this->getFromHistory());
+                this->setCursorPosition(cursorPosition);
+                return;
+            }
+        }
+    }
 
-            SHELL_UPDATE_LISTENERS(linesChanged);
+    void Shell::historySearchDown()
+    {
+        if (this->historyPosition_ == 0)
+            return;
+        unsigned int cursorPosition = this->getCursorPosition();
+        std::string input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning
+        for (unsigned int newPos = this->historyPosition_ - 1; newPos > 0; newPos--)
+        {
+            if (getLowercase(this->commandHistory_[this->historyOffset_ - newPos]).find(getLowercase(input_str)) == 0) // sear$
+            {
+                this->historyPosition_ = newPos;
+                this->inputBuffer_->set(this->getFromHistory());
+                this->setCursorPosition(cursorPosition);
+                return;
+            }
         }
     }
 
-    void Shell::scroll_down()
+    void Shell::scrollUp()
     {
-        if (this->scrollIterator_ != this->lines_.begin())
+        if (this->scrollIterator_ != this->outputLines_.end())
         {
-            --this->scrollIterator_;
-            --this->scrollPosition_;
+            ++this->scrollIterator_;
+            ++this->scrollPosition_;
 
-            SHELL_UPDATE_LISTENERS(linesChanged);
+            this->updateListeners<&ShellListener::linesChanged>();
         }
     }
 
-    void Shell::exit()
+    void Shell::scrollDown()
     {
-        if (this->inputBuffer_->getSize() > 0)
+        if (this->scrollIterator_ != this->outputLines_.begin())
         {
-            this->clear();
-            return;
+            --this->scrollIterator_;
+            --this->scrollPosition_;
+
+            this->updateListeners<&ShellListener::linesChanged>();
         }
-
-        this->clear();
-        this->scrollPosition_ = 0;
-        this->scrollIterator_ = this->lines_.begin();
-
-        SHELL_UPDATE_LISTENERS(exit);
     }
 }

Modified: code/trunk/src/libraries/core/Shell.h
===================================================================
--- code/trunk/src/libraries/core/Shell.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/Shell.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -22,7 +22,7 @@
  *   Author:
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Reto Grieder
  *
  */
 
@@ -31,15 +31,15 @@
 
 #include "CorePrereqs.h"
 
-#include <cassert>
 #include <list>
+#include <sstream>
 #include <string>
 #include <vector>
 
-#include "util/OutputBuffer.h"
-#include "input/InputBuffer.h"
+#include "util/OutputHandler.h"
 #include "OrxonoxClass.h"
 #include "ConfigFileManager.h"
+#include "input/InputBuffer.h"
 
 namespace orxonox
 {
@@ -56,20 +56,18 @@
             virtual void lineAdded() {}
             virtual void inputChanged() {}
             virtual void cursorChanged() {}
+            virtual void executed() {}
             virtual void exit() {}
     };
 
-    class _CoreExport Shell : public Singleton<Shell>, virtual public OrxonoxClass, public OutputBufferListener
+
+    class _CoreExport Shell : virtual public OrxonoxClass, public OutputListener
     {
-        friend class Singleton<Shell>;
         public:
-            Shell();
-            virtual ~Shell();
+            Shell(const std::string& consoleName, bool bScrollable, bool bPrependOutputLevel = false);
+            ~Shell();
 
-            static void clearShell();
-            static void history();
-
-            virtual void setConfigValues();
+            void setConfigValues();
             void commandHistoryOffsetChanged();
             void commandHistoryLengthChanged();
 
@@ -78,75 +76,84 @@
 
             inline InputBuffer* getInputBuffer()
                 { return this->inputBuffer_; }
-            inline OutputBuffer& getOutputBuffer()
-                { return this->outputBuffer_; }
 
             void setCursorPosition(unsigned int cursor);
             inline unsigned int getCursorPosition() const
                 { return this->inputBuffer_->getCursorPosition(); }
 
-            void setInput(const std::string& input);
-
-            inline void clearInput()
-                { this->setInput(""); }
             inline std::string getInput() const
                 { return this->inputBuffer_->get(); }
 
             std::list<std::string>::const_iterator getNewestLineIterator() const;
             std::list<std::string>::const_iterator getEndIterator() const;
 
-            void addLine(const std::string& line, int level = 0);
-            void clearLines();
+            void addOutputLine(const std::string& line, int level = 0);
+            void clearOutput();
 
             inline unsigned int getNumLines() const
-                { return this->lines_.size(); }
+                { return this->outputLines_.size(); }
             inline unsigned int getScrollPosition() const
                 { return this->scrollPosition_; }
 
-            inline void addOutputLevel(bool bAddOutputLevel)
-                { this->bAddOutputLevel_ = bAddOutputLevel; }
+            inline const std::string& getPromptPrefix() const { return this->promptPrefix_; }
+            void setPromptPrefix(const std::string& str);
 
         private:
             Shell(const Shell& other);
 
-            void configureInputBuffer();
-
             void addToHistory(const std::string& command);
             std::string getFromHistory() const;
+            void clearInput();
+            // OutputListener
+            void outputChanged(int level);
 
-            virtual void outputChanged();
+            void configureInputBuffer();
+
+            // InputBuffer callbacks
             void inputChanged();
             void execute();
-            void hintandcomplete();
+            void hintAndComplete();
             void backspace();
-            void deletechar();
-            void clear();
-            void cursor_right();
-            void cursor_left();
-            void cursor_end();
-            void cursor_home();
-            void history_up();
-            void history_down();
-            void scroll_up();
-            void scroll_down();
+            void deleteChar();
+            void cursorRight();
+            void cursorLeft();
+            void cursorEnd();
+            void cursorHome();
+            void historyUp();
+            void historyDown();
+            void historySearchUp();
+            void historySearchDown();
+            void scrollUp();
+            void scrollDown();
             void exit();
 
+            template <void (ShellListener::*F)()>
+            void updateListeners()
+            {
+                for (std::list<ShellListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); )
+                    ((*(it++))->*F)();
+            }
+
             std::list<ShellListener*> listeners_;
-            InputBuffer* inputBuffer_;
-            OutputBuffer outputBuffer_;
-            bool finishedLastLine_;
-            std::list<std::string> lines_;
+            InputBuffer*              inputBuffer_;
+            std::stringstream         outputBuffer_;
+            bool                      bFinishedLastLine_;
+            std::list<std::string>    outputLines_;
             std::list<std::string>::const_iterator scrollIterator_;
-            unsigned int scrollPosition_;
-            std::vector<std::string> commandHistory_;
-            unsigned int maxHistoryLength_;
-            unsigned int historyPosition_;
-            unsigned int historyOffset_;
-            bool bAddOutputLevel_;
+            unsigned int              scrollPosition_;
+            unsigned int              historyPosition_;
+            ConfigFileType            commandHistoryConfigFileType_;
 
-            ConfigFileType commandHistoryConfigFileType_;
+            std::string               promptPrefix_;
+            const std::string         consoleName_;
+            const bool                bPrependOutputLevel_;
+            const bool                bScrollable_;
 
-            static Shell* singletonPtr_s;
+            // Config values
+            unsigned int              maxHistoryLength_;
+            unsigned int              historyOffset_;
+            std::vector<std::string>  commandHistory_;
+            int                       softDebugLevel_;
     };
 }
 

Modified: code/trunk/src/libraries/core/input/InputBuffer.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputBuffer.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/input/InputBuffer.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -79,7 +79,7 @@
 
     void InputBuffer::setConfigValues()
     {
-        SetConfigValue(keyRepeatDeleay_, 0.4).description("Key repeat deleay of the input buffer");
+        SetConfigValue(keyRepeatDeleay_, 0.4).description("Key repeat delay of the input buffer");
         SetConfigValue(keyRepeatTime_, 0.022).description("Key repeat time of the input buffer");
 
         if (keyRepeatDeleay_ < 0.0)
@@ -185,6 +185,7 @@
 
     void InputBuffer::processKey(const KeyEvent& evt)
     {
+        // Prevent disaster when switching applications
         if (evt.isModifierDown(KeyboardModifier::Alt) && evt.getKeyCode() == KeyCode::Tab)
             return;
 
@@ -221,7 +222,7 @@
     }
 
     /**
-        @brief This update() function is called by the InputManager if the InputBuffer is active.
+        @brief This update() function is called by the InputState if the InputBuffer is active.
         @param dt Delta time
     */
     void InputBuffer::keyboardUpdated(float dt)

Modified: code/trunk/src/libraries/core/input/InputBuffer.h
===================================================================
--- code/trunk/src/libraries/core/input/InputBuffer.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/input/InputBuffer.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -161,10 +161,11 @@
             inline void decreaseCursor()
                 { if (this->cursor_ > 0) { --this->cursor_; } }
 
+            void buttonPressed(const KeyEvent& evt);
+
         private:
             bool charIsAllowed(const char& input);
 
-            void buttonPressed(const KeyEvent& evt);
             void buttonHeld   (const KeyEvent& evt);
             void processKey   (const KeyEvent& evt);
 

Modified: code/trunk/src/libraries/core/input/InputHandler.h
===================================================================
--- code/trunk/src/libraries/core/input/InputHandler.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/input/InputHandler.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -72,6 +72,11 @@
             , text_(evt.text)
             , modifiers_(0)
         { }
+        KeyEvent(KeyCode::ByEnum key, unsigned int text, int modifiers)
+            : key_(key)
+            , text_(text)
+            , modifiers_(modifiers)
+        { }
         bool operator==(const KeyEvent& rhs) const
             { return rhs.key_ == key_; }
         bool operator!=(const KeyEvent& rhs) const
@@ -96,10 +101,10 @@
         Base class for all input handlers like KeyBinder, InputBuffer, etc.
 
         Derive from this class if you wish to receive input events.
-        But keep in mind that this is pointless wihtout first having an InputState.
+        But keep in mind that this is pointless without first having an InputState.
     @note
         The definitions for the button events with the weird arguments are simply
-        to avoid redunant code in the input devices.
+        to avoid redundant code in the input devices.
     */
     class _CoreExport InputHandler
     {

Modified: code/trunk/src/libraries/core/input/InputManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/core/input/InputManager.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -189,7 +189,7 @@
             oisInputManager_ = OIS::InputManager::createInputSystem(paramList);
             // Exception-safety
             Loki::ScopeGuard guard = Loki::MakeGuard(OIS::InputManager::destroyInputSystem, oisInputManager_);
-            CCOUT(ORX_DEBUG) << "Created OIS input manager." << std::endl;
+            CCOUT(4) << "Created OIS input manager." << std::endl;
 
             if (oisInputManager_->getNumberOfDevices(OIS::OISKeyboard) > 0)
                 devices_[InputDeviceEnumerator::Keyboard] = new Keyboard(InputDeviceEnumerator::Keyboard, oisInputManager_);
@@ -231,7 +231,7 @@
             }
         }
         else
-            CCOUT(ORX_WARNING) << "Warning: No mouse found! Proceeding without mouse support." << std::endl;
+            CCOUT(2) << "Warning: No mouse found! Proceeding without mouse support." << std::endl;
     }
 
     //! Creates as many joy sticks as are available.

Modified: code/trunk/src/libraries/network/packet/Packet.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Packet.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/network/packet/Packet.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -229,7 +229,7 @@
     data we allocated ourselves.
 */
 void Packet::deletePacket(ENetPacket *enetPacket){
-  // Get our Packet from a gloabal map with all Packets created in the send() method of Packet.
+  // Get our Packet from a global map with all Packets created in the send() method of Packet.
   std::map<size_t, Packet*>::iterator it = packetMap_.find(reinterpret_cast<size_t>(enetPacket));
   assert(it != packetMap_.end());
   // Make sure we don't delete it again in the destructor

Modified: code/trunk/src/libraries/tools/ResourceCollection.h
===================================================================
--- code/trunk/src/libraries/tools/ResourceCollection.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/tools/ResourceCollection.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -37,8 +37,6 @@
 
 namespace orxonox
 {
-    class ResourceLocation;
-
     class _ToolsExport ResourceCollection : public BaseObject
     {
     public:

Modified: code/trunk/src/libraries/util/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/util/CMakeLists.txt	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/util/CMakeLists.txt	2009-11-20 15:55:40 UTC (rev 6105)
@@ -28,7 +28,6 @@
   Clock.cc
   CRC32.cc
   ExprParser.cc
-  OutputBuffer.cc
   OutputHandler.cc
   SignalHandler.cc
   Sleep.cc

Modified: code/trunk/src/libraries/util/Debug.h
===================================================================
--- code/trunk/src/libraries/util/Debug.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/util/Debug.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -20,23 +20,25 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Benjamin Grauer
- *   Co-authors:
  *      Fabian 'x3n' Landau
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
  *
  */
 
 /**
-    @file
-    @brief Handles different output-levels of errors, warnings, infos and debug information.
+ at file
+ at brief
+    Handles different output-levels of errors, warnings, infos and debug information.
 
     The COUT(level) macro acts like std::cout, but the output is only performed if the given
     level is <= the soft debug level.
 
     There are two used values in this file:
-     - The hard debug level is used during compiletime. It describes the highest allowed output level.
+     - The hard debug level is used during compile time. It describes the highest allowed output level.
      - The soft debug level is used during runtime and is the maximum of the three configurable
-       output-levels for console, logfile and ingame shell.
+       output-levels for console, log file and in game shell.
 
     The separation between the three devices is done by the OutputHandler.
 
@@ -49,211 +51,47 @@
      5: More debug information
      6: Crazy debug information
 
-    @example
+ at example
     COUT(0) << "Very important output" << std::endl;
     COUT(1) << "Error: Something went wrong!" << std::endl;
     COUT(2) << "Warning: There might be a problem." << std::endl;
-    COUT(3) << "Info: It's monday" << std::endl;
+    COUT(3) << "Info: It's Monday" << std::endl;
     COUT(4) << "Debug: x is 1.23456" << std::endl;
- */
+*/
 
-#ifndef _Debug_H__
-#define _Debug_H__
+#ifndef _Util_Debug_H__
+#define _Util_Debug_H__
 
 #include "UtilPrereqs.h"
-
 #include "OutputHandler.h"
 
 namespace orxonox
 {
-    /**
-        @brief Returns the soft debug level, stored in the only existing instance of the OutputHandler class, configured in the config-file.
-        @return The soft debug level
-    */
-    inline int getSoftDebugLevel()
-    {
-        return OutputHandler::getSoftDebugLevel();
-    }
-
+    // Just for convenience
     using std::endl;
+
+    //! Adjust to discard certain output with level > hardDebugLevel at compile time
+    const int hardDebugLevel = OutputLevel::Verbose;
 }
 
-// DEFINE ERROR MODES
-#define ORX_NONE            0
-#define ORX_ERROR           1
-#define ORX_WARNING         2
-#define ORX_INFO            3
-#define ORX_DEBUG           4
-#define ORX_VERBOSE         5
-#define ORX_ULTRA           6
+/**
+ at brief
+    Logs text output: use exactly like std::cout, but specify an output
+    level as argument.
+ at example
+    COUT(3) << "Some info" << std::endl;
+ at note
+    The ? : operator requires both possible results to have the type of
+    the first. This is achieved by the int conversion operator dummy
+    in the OutputHandler.
+*/
+#define COUT(level)                                                    \
+    /*if*/ (level > orxonox::hardDebugLevel) ?                         \
+        0                                                              \
+    /*else*/ :                                                         \
+        /*if*/ (level > orxonox::OutputHandler::getSoftDebugLevel()) ? \
+            0                                                          \
+        /*else*/ :                                                     \
+            orxonox::OutputHandler::getOutStream(level)
 
-//definitions
-#define ORX_PRINT_DEBUG_OUTPUT 1
-#define ORX_HARD_DEBUG_LEVEL ORX_VERBOSE
-
-#define COUT_EXEC(x) orxonox::OutputHandler::getOutStream().setOutputLevel(x)
-
-////////////////////////////////////////////////////////
-///  COUT: just prints output as is with std::cout   ///
-////////////////////////////////////////////////////////
-#define COUTORX_NONE    COUT0
-#define COUTORX_ERROR   COUT1
-#define COUTORX_WARNING COUT2
-#define COUTORX_INFO    COUT3
-#define COUTORX_DEBUG   COUT4
-#define COUTORX_VERBOSE COUT5
-#define COUTORX_ULTRA   COUT6
-
-#ifndef COUT
- #if ORX_PRINT_DEBUG_OUTPUT
-  #define COUT(x) \
-   COUT ## x
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
-   #define COUT0 \
-   (orxonox::getSoftDebugLevel() < ORX_NONE) ? COUT_EXEC(0) : COUT_EXEC(0)
-  #else
-   #define COUT0 \
-    false ? COUT_EXEC(0) : COUT_EXEC(0)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
-   #define COUT1 \
-    (orxonox::getSoftDebugLevel() < ORX_ERROR) ? COUT_EXEC(1) : COUT_EXEC(1)
-  #else
-   #define COUT1 \
-    false ? COUT_EXEC(1) : COUT_EXEC(1)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
-   #define COUT2 \
-    (orxonox::getSoftDebugLevel() < ORX_WARNING) ? COUT_EXEC(2) : COUT_EXEC(2)
-  #else
-   #define COUT2 \
-    false ? COUT_EXEC(2) : COUT_EXEC(2)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
-   #define COUT3 \
-    (orxonox::getSoftDebugLevel() < ORX_INFO) ? COUT_EXEC(3) : COUT_EXEC(3)
-  #else
-   #define COUT3 \
-    false ? COUT_EXEC(3) : COUT_EXEC(3)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
-   #define COUT4 \
-    (orxonox::getSoftDebugLevel() < ORX_DEBUG) ? COUT_EXEC(4) : COUT_EXEC(4)
-  #else
-   #define COUT4 \
-    false ? COUT_EXEC(4) : COUT_EXEC(4)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
-   #define COUT5 \
-    (orxonox::getSoftDebugLevel() < ORX_VERBOSE) ? COUT_EXEC(5) : COUT_EXEC(5)
-  #else
-   #define COUT5 \
-    false ? COUT_EXEC(5) : COUT_EXEC(5)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
-   #define COUT6 \
-    (orxonox::getSoftDebugLevel() < ORX_ULTRA) ? COUT_EXEC(6) : COUT_EXEC(6)
-  #else
-   #define COUT6 \
-    false ? COUT_EXEC(6) : COUT_EXEC(6)
-  #endif
-
- #else /* if ORX_PRINT_DEBUG_OUTPUT */
-  #define COUT(x) \
-    false ? COUT_EXEC(6) : COUT_EXEC(6)
- #endif /* if ORX_PRINT_DEBUG_OUTPUT */
-
-#endif /* ifndef COUT */
-
-
-/////////////////////////////////////////////////////////////////////
-///  CCOUT: Prints output with std::cout and adds the classname   ///
-/////////////////////////////////////////////////////////////////////
-#define CCOUTORX_NONE    CCOUT0
-#define CCOUTORX_ERROR   CCOUT1
-#define CCOUTORX_WARNING CCOUT2
-#define CCOUTORX_INFO    CCOUT3
-#define CCOUTORX_DEBUG   CCOUT4
-#define CCOUTORX_VERBOSE CCOUT5
-#define CCOUTORX_ULTRA   CCOUT6
-
-#define CCOUT_EXEC(x) \
-  orxonox::OutputHandler::getOutStream().setOutputLevel(x) \
-  << this->getIdentifier()->getName() << ": "
-
-#ifndef CCOUT
- #if ORX_PRINT_DEBUG_OUTPUT
-  #define CCOUT(x) \
-   CCOUT ## x
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
-   #define CCOUT0 \
-    (orxonox::getSoftDebugLevel() < ORX_NONE) ? COUT_EXEC(0) : CCOUT_EXEC(0)
-  #else
-   #define CCOUT0 \
-    false ? COUT_EXEC(0) : CCOUT_EXEC(0)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
-   #define CCOUT1 \
-    (orxonox::getSoftDebugLevel() < ORX_ERROR) ? COUT_EXEC(1) : CCOUT_EXEC(1)
-  #else
-   #define CCOUT1 \
-    false ? COUT_EXEC(1) : CCOUT_EXEC(1)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
-   #define CCOUT2 \
-    (orxonox::getSoftDebugLevel() < ORX_WARNING) ? COUT_EXEC(2) : CCOUT_EXEC(2)
-  #else
-   #define CCOUT2 \
-    false ? COUT_EXEC(2) : CCOUT_EXEC(2)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
-   #define CCOUT3 \
-    (orxonox::getSoftDebugLevel() < ORX_INFO) ? COUT_EXEC(3) : CCOUT_EXEC(3)
-  #else
-   #define CCOUT3 \
-    false ? COUT_EXEC(3) : CCOUT_EXEC(3)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
-   #define CCOUT4 \
-    (orxonox::getSoftDebugLevel() < ORX_DEBUG) ? COUT_EXEC(4) : CCOUT_EXEC(4)
-  #else
-   #define CCOUT4 \
-    false ? COUT_EXEC(4) : CCOUT_EXEC(4)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
-   #define CCOUT5 \
-    (orxonox::getSoftDebugLevel() < ORX_VERBOSE) ? COUT_EXEC(5) : CCOUT_EXEC(5)
-  #else
-   #define CCOUT5 \
-    false ? COUT_EXEC(5) : CCOUT_EXEC(5)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
-   #define CCOUT6 \
-    (orxonox::getSoftDebugLevel() < ORX_ULTRA) ? COUT_EXEC(6) : CCOUT_EXEC(6)
-  #else
-   #define CCOUT6 \
-    false ? COUT_EXEC(6) : CCOUT_EXEC(6)
-  #endif
-
- #else /* if ORX_PRINT_DEBUG_OUTPUT */
-  #define CCOUT(x) \
-   false ? CCOUT_EXEC(6) : CCOUT_EXEC(6)
- #endif /* if ORX_PRINT_DEBUG_OUTPUT */
-
-#endif /* ifndef CCOUT */
-
-#endif /* _Debug_H__ */
+#endif /* _Util_Debug_H__ */

Modified: code/trunk/src/libraries/util/OrxAssert.h
===================================================================
--- code/trunk/src/libraries/util/OrxAssert.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/util/OrxAssert.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -43,7 +43,7 @@
 // define an assert macro that can display a message
 #ifndef NDEBUG
 #define OrxAssert(Assertion, ErrorMessage) \
-    Assertion ? ((void)0) : (void)(orxonox::OutputHandler::getOutStream().setOutputLevel(1) << ErrorMessage << std::endl); \
+    Assertion ? ((void)0) : (void)(orxonox::OutputHandler::getOutStream(1) << ErrorMessage << std::endl); \
     assert(Assertion)
 #else
 #define OrxAssert(condition, errorMessage)  ((void)0)

Deleted: code/trunk/src/libraries/util/OutputBuffer.cc
===================================================================
--- code/trunk/src/libraries/util/OutputBuffer.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/util/OutputBuffer.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -1,127 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Implementation of the OutputBuffer.
-*/
-
-#include "OutputBuffer.h"
-
-namespace orxonox
-{
-    /**
-        @brief Adds a new listener to the list.
-        @param listener The new listener
-    */
-    void OutputBuffer::registerListener(OutputBufferListener* listener)
-    {
-        this->listeners_.push_back(listener);
-    }
-
-    /**
-        @brief Removes a listener from the list.
-        @param listener The listener
-    */
-    void OutputBuffer::unregisterListener(OutputBufferListener* listener)
-    {
-        for (std::vector<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); )
-        {
-            if ((*it) == listener)
-                it = this->listeners_.erase(it);
-            else
-                ++it;
-        }
-    }
-
-    /**
-        @brief Puts a stream manipulator to the stream.
-        @param manipulator The manipulator
-    */
-    OutputBuffer& OutputBuffer::operator<<(std::ostream& (*manipulator)(std::ostream&))
-    {
-        this->stream_ << manipulator;
-        this->callListeners();
-        return *this;
-    }
-
-    /**
-        @brief Puts a stream manipulator to the stream.
-        @param manipulator The manipulator
-    */
-    OutputBuffer& OutputBuffer::operator<<(std::ios& (*manipulator)(std::ios&))
-    {
-        this->stream_ << manipulator;
-        this->callListeners();
-        return *this;
-    }
-
-    /**
-        @brief Puts a stream manipulator to the stream.
-        @param manipulator The manipulator
-    */
-    OutputBuffer& OutputBuffer::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
-    {
-        this->stream_ << manipulator;
-        this->callListeners();
-        return *this;
-    }
-
-    /**
-        @brief Removes the first line from the stream and assigns it to a given string object.
-        @param output The string object to assign the first line
-        @return True if there was at least one line in the stream and this line was successfully assigned
-
-        It's important to know the returned line will be removed from the stream. If there are more than one
-        listener, they have to cooperate to avoid conflicts.
-    */
-    bool OutputBuffer::getLine(std::string* output)
-    {
-        std::getline(this->stream_, *output);
-
-        bool eof = this->stream_.eof();
-        bool fail = this->stream_.fail();
-
-        if (eof)
-            this->stream_.flush();
-
-        if (eof || fail)
-            this->stream_.clear();
-
-        return (!eof && !fail);
-    }
-
-    /**
-        @brief Calls the outputChanged() function of all registered listeners.
-    */
-    void OutputBuffer::callListeners()
-    {
-        for (std::vector<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
-            (*it)->outputChanged();
-    }
-}

Deleted: code/trunk/src/libraries/util/OutputBuffer.h
===================================================================
--- code/trunk/src/libraries/util/OutputBuffer.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/util/OutputBuffer.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -1,173 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Declaration of the OutputBuffer class.
-
-    The OutputBuffer acts almost like std::ostream. You can put text and other values to the
-    OutputBuffer by using the << operator. The OutputBuffer stores the text and calls registerd
-    listeners if new text gets assigned.
-    The listeners are then able to retrieve the text line by line.
-
-    It's important to know that getLine actually removes the line from the OutputBuffer, so it's
-    better to only have one "active" listener.
-*/
-
-#ifndef _OutputBuffer_H__
-#define _OutputBuffer_H__
-
-#include "UtilPrereqs.h"
-
-#include <vector>
-#include <sstream>
-
-namespace orxonox
-{
-    /**
-        @brief A pure virtual baseclass for classes that want to register as listener to an OutputBuffer.
-
-        This class is pure virtual, so an inheriting class has to implement the function on it's own.
-        The function get's called, if an instance of the inheriting class registers as a listener at
-        an OutputBuffer and this buffer changes.
-    */
-    class OutputBufferListener
-    {
-        friend class OutputBuffer;
-
-        public:
-            virtual ~OutputBufferListener() {}
-
-        private:
-            virtual void outputChanged() = 0;
-    };
-
-    /**
-        @brief The OutputBuffer acts almost like std::ostream and stores the assigned text.
-
-        If text gets assigned by using the << operator or another function, the OutputBuffer
-        calls it's listeners, allowing them to retrieve the text line by line.
-
-        It's important to know that getLine actually removes the line from the OutputBuffer, so it's
-        better to only have one "active" listener.
-    */
-    class _UtilExport OutputBuffer
-    {
-        public:
-            OutputBuffer() {}
-            ~OutputBuffer() {}
-
-            /**
-                @brief Puts some object/value to the OutputBuffer. The text gets assigned and the OutputBuffer calls it's listeners.
-                @param object The object/value to assign
-            */
-            template <class T>
-            inline OutputBuffer& operator<<(T object)
-            {
-                this->stream_ << object;
-                this->callListeners();
-                return *this;
-            }
-
-            /**
-                @brief Reads the stored text of the other OutputBuffer and calls the listeners.
-                @param object The other OutputBuffer
-            */
-            template <const OutputBuffer&>
-            inline OutputBuffer& operator<<(const OutputBuffer& object)
-            {
-                this->stream_ << object.stream_.rdbuf();
-                this->callListeners();
-                return *this;
-            }
-
-            OutputBuffer& operator<<(std::ostream& (*manipulator)(std::ostream&));
-            OutputBuffer& operator<<(std::ios& (*manipulator)(std::ios&));
-            OutputBuffer& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
-
-            /**
-                @brief Does the same like operator<<: Assigns the object to the stream and calls the listeners.
-                @param object The object/value
-            */
-            template <class T>
-            inline void add(T object)
-            {
-                this->stream_ << object;
-                this->callListeners();
-            }
-
-            /**
-                @brief Assigns an object/value and adds std::endl.
-                @param object The object/value
-            */
-            template <class T>
-            inline void addLine(T object)
-            {
-                this->stream_ << object << std::endl;
-                this->callListeners();
-            }
-
-            /**
-                @brief Puts std::endl to the stream and calls the listeners.
-            */
-            inline void newline()
-            {
-                this->stream_ << std::endl;
-                this->callListeners();
-            }
-
-            /**
-                @brief Flushes the stored text (~empties the OutputBuffer).
-            */
-            inline void flush()
-            {
-                this->stream_.flush();
-            }
-
-            bool getLine(std::string* output);
-
-            void registerListener(OutputBufferListener* listener);
-            void unregisterListener(OutputBufferListener* listener);
-
-            /**
-                @brief Returns the internal stringstream object.
-            */
-            inline std::stringstream& getStream()
-            {
-                return this->stream_;
-            }
-
-        private:
-            void callListeners();
-
-            std::stringstream stream_;                     //!< The stringstream that stores the assigned text
-            std::vector<OutputBufferListener*> listeners_; //!< A list of all listeners
-    };
-}
-
-#endif /* _OutputBuffer_H__ */

Modified: code/trunk/src/libraries/util/OutputHandler.cc
===================================================================
--- code/trunk/src/libraries/util/OutputHandler.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/util/OutputHandler.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -22,210 +22,282 @@
  *   Author:
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Reto Grieder
  *
  */
 
 /**
-    @file
-    @brief Implementation of the OutputHandler class.
+ at file
+ at brief
+    Definition of classes related to output (logging).
 */
 
 #include "OutputHandler.h"
 
+#include <algorithm>
 #include <ctime>
 #include <cstdlib>
+#include <fstream>
+#include <sstream>
 
+#include "Debug.h"
+
 namespace orxonox
 {
+    //! How the log file shall be named on the filesystem
+    const std::string logFileBaseName_g = "orxonox.log";
+
+    /////////////////////////
+    ///// LogFileWriter /////
+    /////////////////////////
     /**
-        @brief Constructor: Opens the logfile and writes the first line.
-        @param logfilename The name of the logfile
+    @brief
+        Writes the output to the log file.
+    @note
+        As long as the correct log path is not yet known (for pre main code), the
+        LogFileWriter will write to a temporary file in /temp (Unix) or %TEMP% (Windows).
+        As soon as you set the correct path setLogPath the content of the temporary file
+        is read and put into the new file as well.
     */
-    OutputHandler::OutputHandler()
+    class LogFileWriter : public OutputListener
     {
+    public:
+        /**
+        @brief
+            Gets temporary log path and starts the log file
+        @param outputHandler
+            This is only required to avoid another call to getInstance (this c'tor was
+            called from getInstance!)
+        */
+        LogFileWriter()
+            : OutputListener(OutputHandler::logFileOutputListenerName_s)
+        {
+            // Get path for a temporary file
 #ifdef ORXONOX_PLATFORM_WINDOWS
-        char* pTempDir = getenv("TEMP");
-        this->logfilename_ = std::string(pTempDir) + "/orxonox.log";
+            char* pTempDir = getenv("TEMP");
+            this->logFilename_ = std::string(pTempDir) + "/" + logFileBaseName_g;
 #else
-        this->logfilename_ = "/tmp/orxonox.log";
+            this->logFilename_ = std::string("/tmp/") + logFileBaseName_g;
 #endif
-#ifdef NDEBUG
-        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 2;
-        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 1;
-#else
-        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 3;
-        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 2;
-#endif
 
-        this->outputBuffer_ = &this->fallbackBuffer_;
-        this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
+            // Get current time
+            time_t rawtime;
+            struct tm* timeinfo;
+            time(&rawtime);
+            timeinfo = localtime(&rawtime);
 
-        time_t rawtime;
-        struct tm* timeinfo;
-        time(&rawtime);
-        timeinfo = localtime(&rawtime);
+            this->logFile_.open(this->logFilename_.c_str(), std::fstream::out);
+            this->logFile_ << "Started log on " << asctime(timeinfo) << std::endl;
+            this->logFile_.flush();
 
-        this->logfile_ << "Started log on " << asctime(timeinfo) << std::endl;
-        this->logfile_.flush();
-    }
+            this->outputStream_ = &this->logFile_;
+        }
 
+        //! Closes the log file
+        ~LogFileWriter()
+        {
+            this->logFile_ << "Closed log" << std::endl;
+            this->logFile_.close();
+        }
+
+        //! Changes the log path
+        void setLogPath(const std::string& path)
+        {
+            this->logFile_.close();
+            // Read old file into a buffer
+            std::ifstream old(this->logFilename_.c_str());
+            this->logFilename_ = path + logFileBaseName_g;
+            // Open the new file and feed it the content of the old one
+            this->logFile_.open(this->logFilename_.c_str(), std::fstream::out);
+            this->logFile_ << old.rdbuf();
+            this->logFile_.flush();
+            old.close();
+        }
+
+    private:
+        std::ofstream logFile_;     //! File handle for the log file
+        std::string   logFilename_; //! Filename of the log file
+    };
+
+
+    /////////////////////////
+    ///// ConsoleWriter /////
+    /////////////////////////
     /**
-        @brief Destructor: Writes the last line to the logfile and closes it.
+    @brief
+        Writes the output to std::cout.
+    @note
+        This listener will usually be disable once an actual shell with console is instantiated.
     */
-    OutputHandler::~OutputHandler()
+    class ConsoleWriter : public OutputListener
     {
-        this->logfile_ << "Closed log" << std::endl;
-        this->logfile_.close();
-    }
+    public:
+        //! Only assigns the output stream with std::cout
+        ConsoleWriter()
+            : OutputListener("consoleLog")
+        {
+            this->outputStream_ = &std::cout;
+        }
+    };
 
+
+    ///////////////////////////
+    ///// MemoryLogWriter /////
+    ///////////////////////////
     /**
-        @brief Returns a reference to the only existing instance of the OutputHandler class.
-        @return The instance
+    @brief
+        OutputListener that writes all the output piece by piece to an array
+        associated with the corresponding output level.
+    @note
+        Only output below or equal to the current soft debug level is written
+        to minimise huge arrays for the normal run.
     */
-    OutputHandler& OutputHandler::getOutStream()
+    class MemoryLogWriter : public OutputListener
     {
-        static OutputHandler orxout;
-        return orxout;
+    public:
+        friend class OutputHandler;
+
+        /**
+        @brief
+            Sets the right soft debug level and registers itself
+        @param outputHandler
+            This is only required to avoid another call to getInstance (this c'tor was
+            called from getInstance!)
+        */
+        MemoryLogWriter()
+            : OutputListener("memoryLog")
+        {
+            this->outputStream_ = &this->buffer_;
+        }
+
+        //! Pushed the just written output to the internal array
+        void outputChanged(int level)
+        {
+            // Read ostringstream and store it
+            this->output_.push_back(std::make_pair(level, this->buffer_.str()));
+            // Clear content and flags
+            this->buffer_.str(std::string());
+            this->buffer_.clear();
+        }
+
+    private:
+        std::ostringstream                        buffer_; //! Stream object used to process the output
+        std::vector<std::pair<int, std::string> > output_; //! Vector containing ALL output
+    };
+
+
+    /////////////////////////
+    ///// OutputHandler /////
+    /////////////////////////
+    const std::string OutputHandler::logFileOutputListenerName_s = "logFile";
+          int         OutputHandler::softDebugLevel_s = hardDebugLevel;
+
+    //! Creates the LogFileWriter and the MemoryLogWriter
+    OutputHandler::OutputHandler()
+        : outputLevel_(OutputLevel::Verbose)
+    {
+#ifdef ORXONOX_RELEASE
+        const OutputLevel::Value defaultLevelConsole = OutputLevel::Error;
+        const OutputLevel::Value defaultLevelLogFile = OutputLevel::Info;
+#else
+        const OutputLevel::Value defaultLevelConsole = OutputLevel::Info;
+        const OutputLevel::Value defaultLevelLogFile = OutputLevel::Debug;
+#endif
+
+        this->logFile_ = new LogFileWriter();
+        // Use default level until we get the configValue from the Core
+        this->logFile_->softDebugLevel_ = defaultLevelLogFile;
+        this->registerOutputListener(this->logFile_);
+
+        this->consoleWriter_ = new ConsoleWriter();
+        this->consoleWriter_->softDebugLevel_ = defaultLevelConsole;
+        this->registerOutputListener(this->consoleWriter_);
+
+        this->output_  = new MemoryLogWriter();
+        // We capture as much input as the listener with the highest level
+        this->output_->softDebugLevel_ = getSoftDebugLevel();
+        this->registerOutputListener(this->output_);
     }
 
-    /**
-        @brief Sets the soft debug level for a given output device.
-        @param device The output device
-        @param level The debug level
-    */
-    void OutputHandler::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
+    //! Destroys the LogFileWriter and the MemoryLogWriter
+    OutputHandler::~OutputHandler()
     {
-        OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)] = level;
+        delete this->logFile_;
+        delete this->output_;
     }
 
-    /**
-        @brief Returns the soft debug level for a given output device.
-        @param device The output device
-        @return The debug level
-    */
-    int OutputHandler::getSoftDebugLevel(OutputHandler::OutputDevice device)
+    OutputHandler& OutputHandler::getInstance()
     {
-        return OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)];
+        static OutputHandler orxout;
+        return orxout;
     }
 
-    /**
-        @brief Sets the OutputBuffer, representing the third output stream.
-        @param buffer The OutputBuffer
-    */
-    void OutputHandler::setOutputBuffer(OutputBuffer* buffer)
+    void OutputHandler::registerOutputListener(OutputListener* listener)
     {
-        if (buffer == NULL)
-            this->outputBuffer_ = &this->fallbackBuffer_;
-        else
+        for (std::list<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
         {
-            buffer->getStream() >> this->outputBuffer_->getStream().rdbuf();
-            this->outputBuffer_ = buffer;
+            if ((*it)->name_ == listener->name_)
+            {
+                COUT(2) << "OutputHandler, Warning: Trying to register two listeners with the same name!" << std::endl;
+                return;
+            }
         }
+        this->listeners_.push_back(listener);
+        // Update global soft debug level
+        this->setSoftDebugLevel(listener->getOutputListenerName(), listener->getSoftDebugLevel());
     }
 
-    /**
-        @brief Sets the path where to create orxonox.log
-        @param Path string with trailing slash
-    */
+    void OutputHandler::unregisterOutputListener(OutputListener* listener)
+    {
+        this->listeners_.remove(listener);
+    }
+
     void OutputHandler::setLogPath(const std::string& path)
     {
-        OutputHandler::getOutStream().logfile_.close();
-        // store old content
-        std::ifstream old;
-        old.open(OutputHandler::getOutStream().logfilename_.c_str());
-        OutputHandler::getOutStream().logfilename_ = path + "orxonox.log";
-        OutputHandler::getOutStream().logfile_.open(OutputHandler::getOutStream().logfilename_.c_str(), std::fstream::out);
-        OutputHandler::getOutStream().logfile_ << old.rdbuf();
-        old.close();
-        OutputHandler::getOutStream().logfile_.flush();
+        this->logFile_->setLogPath(path);
     }
 
-    /**
-        @brief Overloaded << operator, redirects the output to the console and the logfile.
-        @param sb The streambuffer that should be shown in the console
-        @return A reference to the OutputHandler itself
-    */
-    OutputHandler& OutputHandler::operator<<(std::streambuf* sb)
+    void OutputHandler::disableCout()
     {
-        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
-            std::cout << sb;
+        this->unregisterOutputListener(this->consoleWriter_);
+    }
 
-        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
-        {
-            this->logfile_ << sb;
-            this->logfile_.flush();
-        }
+    void OutputHandler::enableCout()
+    {
+        this->registerOutputListener(this->consoleWriter_);
+    }
 
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
-            (*this->outputBuffer_) << sb;
-
-        return *this;
+    OutputHandler::OutputVectorIterator OutputHandler::getOutputVectorBegin() const
+    {
+        return this->output_->output_.begin();
     }
 
-    /**
-        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
-        @param manipulator A function, manipulating the outstream.
-        @return A reference to the OutputHandler itself
-    */
-    OutputHandler& OutputHandler::operator<<(std::ostream& (*manipulator)(std::ostream&))
+    OutputHandler::OutputVectorIterator OutputHandler::getOutputVectorEnd() const
     {
-        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
-            manipulator(std::cout);
-
-        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
-        {
-            manipulator(this->logfile_);
-            this->logfile_.flush();
-        }
-
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
-            (*this->outputBuffer_) << manipulator;
-
-        return *this;
+        return this->output_->output_.end();
     }
 
-    /**
-        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
-        @param manipulator A function, manipulating the outstream.
-        @return A reference to the OutputHandler itself
-    */
-    OutputHandler& OutputHandler::operator<<(std::ios& (*manipulator)(std::ios&))
+    int OutputHandler::getSoftDebugLevel(const std::string& name) const
     {
-        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
-            manipulator(std::cout);
-
-        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        for (std::list<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
         {
-            manipulator(this->logfile_);
-            this->logfile_.flush();
+            if ((*it)->name_ == name)
+                return (*it)->softDebugLevel_;
         }
-
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
-            (*this->outputBuffer_) << manipulator;
-
-        return *this;
+        return -1;
     }
 
-    /**
-        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
-        @param manipulator A function, manipulating the outstream.
-        @return A reference to the OutputHandler itself
-    */
-    OutputHandler& OutputHandler::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
+    void OutputHandler::setSoftDebugLevel(const std::string& name, int level)
     {
-        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
-            manipulator(std::cout);
-
-        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        int globalSoftDebugLevel = -1;
+        for (std::list<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
         {
-            manipulator(this->logfile_);
-            this->logfile_.flush();
+            if ((*it)->name_ == name)
+                (*it)->softDebugLevel_ = level;
+            if ((*it)->softDebugLevel_ > globalSoftDebugLevel)
+                globalSoftDebugLevel = (*it)->softDebugLevel_;
         }
-
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
-            (*this->outputBuffer_) << manipulator;
-
-        return *this;
+        // Update global soft debug level
+        OutputHandler::softDebugLevel_s = globalSoftDebugLevel;
     }
 }

Modified: code/trunk/src/libraries/util/OutputHandler.h
===================================================================
--- code/trunk/src/libraries/util/OutputHandler.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/util/OutputHandler.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -22,16 +22,14 @@
  *   Author:
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Reto Grieder
  *
  */
 
 /**
-    @file
-    @brief Definition of the OutputHandler class.
-
-    The OutputHandler acts like std::cout, but output isn't only shown in the console,
-    but also written to the logfile and the ingame shell.
+ at file
+ at brief
+    Declaration of classes related to output (logging).
 */
 
 #ifndef _OutputHandler_H__
@@ -39,167 +37,245 @@
 
 #include "UtilPrereqs.h"
 
-#include <iostream>
-#include <fstream>
+#include <list>
+#include <ostream>
 #include <string>
+#include <vector>
+#include <utility>
 
-#include "OutputBuffer.h"
-
 namespace orxonox
 {
-    //! The OutputHandler acts like std::cout, but redirects output to the console, the logfile and the ingame shell.
+    /**
+    @brief
+        Denotes different levels of text output (log output)
+
+        0, None   : Very important output
+        1, Error  : Errors
+        2, Warning: Warnings
+        3, Info   : Information
+        4, Debug  : Debug information
+        5, Verbose: More debug information
+        6, Ultra  : Crazy debug information
+    */
+    namespace OutputLevel
+    {
+        enum Value
+        {
+            None    = 0,
+            Error   = 1,
+            Warning = 2,
+            Info    = 3,
+            Debug   = 4,
+            Verbose = 5,
+            Ultra   = 6,
+        };
+    }
+
+    // Forward declarations for classes in the source file
+    class LogFileWriter;
+    class ConsoleWriter;
+    class MemoryLogWriter;
+
+    /**
+    @brief
+        The OutputHandler acts like std::cout, but output isn't only shown in the console.
+
+        You can register your own listener for output by inheriting from OutputListner.
+        And if you need the output previously processed, iterate over it with
+        OutputHandler::getOutputVector[Begin/End].
+        The way to output text is to first set the desired output level with
+        OutputHandler::getOutStream(level) and then use the "<<" operator like with std::cout.
+    */
     class _UtilExport OutputHandler
     {
         public:
-            enum OutputDevice
-            {
-                LD_All = 0,
-                LD_Console = 1,
-                LD_Logfile = 2,
-                LD_Shell = 3
-            };
+            //! Returns a reference to the only existing instance of the OutputHandler class.
+            static OutputHandler& getInstance();
 
-            static OutputHandler& getOutStream();
+            //! Sets the output level and returns a stream to be used with "<<"
+            static inline OutputHandler& getOutStream(int level)
+                { return OutputHandler::getInstance().setOutputLevel(level); }
 
-            /** @brief Puts some text on the outstream. @param text The text */
+            typedef std::vector<std::pair<int, std::string> >::const_iterator OutputVectorIterator;
+            //! Returns an iterator to the beginning of the all-output vector
+            OutputVectorIterator getOutputVectorBegin() const;
+            //! Returns an iterator to the end of the all-output vector
+            OutputVectorIterator getOutputVectorEnd() const;
+
+            //! Writes to all output devices
             static inline const std::string& log(const std::string& text)
-                { OutputHandler::getOutStream().setOutputLevel(0); OutputHandler::getOutStream().output(text + "\n"); return text; }
+                { OutputHandler::getOutStream(0).output(text) << std::endl; return text; }
 
-            /** @brief Puts an error on the outstream. @param text The text */
+            //! Writes an error message to the output
             static inline const std::string& error(const std::string& text)
-                { OutputHandler::getOutStream().setOutputLevel(1); OutputHandler::getOutStream().output(text + "\n"); return text; }
+                { OutputHandler::getOutStream(1).output(text) << std::endl; return text; }
 
-            /** @brief Puts a warning on the outstream. @param text The text */
+            //! Writes a warning message to the output
             static inline const std::string& warning(const std::string& text)
-                { OutputHandler::getOutStream().setOutputLevel(2); OutputHandler::getOutStream().output(text + "\n"); return text; }
+                { OutputHandler::getOutStream(2).output(text) << std::endl; return text; }
 
-            /** @brief Puts an info on the outstream. @param text The text */
+            //! Writes an informational message to the output
             static inline const std::string& info(const std::string& text)
-                { OutputHandler::getOutStream().setOutputLevel(3); OutputHandler::getOutStream().output(text + "\n"); return text; }
+                { OutputHandler::getOutStream(3).output(text) << std::endl; return text; }
 
-            /** @brief Puts some debug output on the outstream. @param text The text */
+            //! Writes a debug message to the output
             static inline const std::string& debug(const std::string& text)
-                { OutputHandler::getOutStream().setOutputLevel(4); OutputHandler::getOutStream().output(text + "\n"); return text; }
+                { OutputHandler::getOutStream(4).output(text) << std::endl; return text; }
 
-            /** @brief Returns a reference to the logfile. @return The logfile */
-            inline std::ofstream& getLogfile()
-                { return this->logfile_; }
+            //! Registers an object that receives output via a provided std::ostream
+            void registerOutputListener(OutputListener* listener);
+            //! Unregisters an object that receives output via a provided std::ostream
+            void unregisterOutputListener(OutputListener* listener);
 
-            /** @brief Returns a pointer to the OutputBuffer. @return The OutputBuffer */
-            inline OutputBuffer* getOutputBuffer()
-                { return this->outputBuffer_; }
+            //! Set the log path once the program has been properly initialised
+            void setLogPath(const std::string& path);
+            //! Disables the std::cout stream for output
+            void disableCout();
+            //! Enables the std::cout stream for output (startup behaviour)
+            void enableCout();
 
-            /** @brief Sets the level of the incoming output. @param level The level of the incoming output @return The OutputHandler itself */
+            //! Sets the level of the incoming output and returns the OutputHandler
             inline OutputHandler& setOutputLevel(int level)
                 { this->outputLevel_ = level; return *this; }
 
-            /** @brief Returns the level of the incoming output. @return The level */
+            //! Returns the level of the incoming output
             inline int getOutputLevel() const
                 { return this->outputLevel_; }
 
-            static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
-            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
+            //! Returns the maximum debug level over all registered listeners (devices)
+            static int getSoftDebugLevel() { return softDebugLevel_s; }
+            //! Returns the soft debug level for a device by its name   @return The level or -1 if the listener was not found
+            int  getSoftDebugLevel(const std::string& name) const;
+            //! Sets the soft debug level for a listener by its name   @remarks Only works for registered listeners!
+            void setSoftDebugLevel(const std::string& name, int level);
 
-            static void setLogPath(const std::string& path);
-
-            void setOutputBuffer(OutputBuffer* buffer);
-
+            /**
+            @brief
+                General template that copes with all output.
+                Required because operator << might be ambiguous.
+                @a output will be streamed into every listener with an appropriate debug level
+            @return
+                Returns a reference to the OutputHandler so you can use it again directly
+            */
             template <class T>
             OutputHandler& output(const T& output);
 
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(unsigned char val)      { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(short val)              { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(unsigned short val)     { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(int val)                { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(unsigned int val)       { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(long val)               { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(unsigned long val)      { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(long long val)          { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(unsigned long long val) { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(float val)              { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(double val)             { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(long double val)        { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(const void* val)        { return this->output(val); }
-            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            //! Overloaded << operator, redirects the output to the listeners
             inline OutputHandler& operator<<(bool val)               { return this->output(val); }
 
-            OutputHandler& operator<<(std::streambuf* sb);
+            //! Overloaded << operator, redirects the output to the listeners
+            inline OutputHandler& operator<<(std::streambuf* sb)     { return this->output(sb); }
 
-            OutputHandler& operator<<(std::ostream& (*manipulator)(std::ostream&));
-            OutputHandler& operator<<(std::ios& (*manipulator)(std::ios&));
-            OutputHandler& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
+            //! Overloaded << operator, redirect the output of classes with self defined 'operator <<' to the listeners
+            template <class T>
+            inline OutputHandler& operator<<(const T& val)           { return this->output(val); }
 
+            //! Overloaded << operator for std manipulators like std::endl, redirects the output to the listeners
+            inline OutputHandler& operator<<(std::ostream&  (*manip)(std::ostream&))  { return this->output(manip); }
+            //! Overloaded << operator for std manipulators like std::endl, redirects the output to the listeners
+            inline OutputHandler& operator<<(std::ios&      (*manip)(std::ios&))      { return this->output(manip); }
+            //! Overloaded << operator for std manipulators like std::endl, redirects the output to the listeners
+            inline OutputHandler& operator<<(std::ios_base& (*manip)(std::ios_base&)) { return this->output(manip); }
+
+            //! Dummy operator required by Debug.h for the ternary operator
+            inline operator int() const { return 0; }
+
+            //! Name of the OutputListener that writes to the log file
+            static const std::string logFileOutputListenerName_s;
+
         private:
-            explicit OutputHandler();
-            OutputHandler(const OutputHandler& oh);
-            virtual ~OutputHandler();
+            OutputHandler();
+            ~OutputHandler();
+            OutputHandler(const OutputHandler& rhs); //! Unused and undefined
 
-            std::ofstream logfile_;              //!< The logfile where the output is logged
-            std::string logfilename_;            //!< The name of the logfile
-            OutputBuffer fallbackBuffer_;        //!< The OutputBuffer that gets used if there is no other OutputBuffer
-            OutputBuffer* outputBuffer_;         //!< The OutputBuffer to put output in (usually used by the Shell)
-            int outputLevel_;                    //!< The level of the incoming output
-            int softDebugLevel_[4];              //!< The soft debug level for each OutputDevice - the configurable maximal output level
+            std::list<OutputListener*> listeners_;        //!< Array with all registered output listeners
+            int                        outputLevel_;      //!< The level of the incoming output
+            LogFileWriter*             logFile_;          //!< Listener that writes to the log file
+            ConsoleWriter*             consoleWriter_;    //!< Listener for std::cout (just program beginning)
+            MemoryLogWriter*           output_;           //!< Listener that Stores ALL output below the current soft debug level
+            static int                 softDebugLevel_s;  //!< Maximum of all soft debug levels. @note This is only static for faster access
     };
 
     /**
-        @brief Redirects the output to the console and the logfile.
-        @param output The value that should be shown in the console
-        @return A reference to the OutputHandler itself
+    @brief
+        Interface for listening to output.
+    @remarks
+        Remember to register the listener (not done automatically!)
     */
-    template<class T>
-    OutputHandler& OutputHandler::output(const T& output)
+    class OutputListener
     {
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
-            std::cout << output;
+        friend class OutputHandler;
 
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+    public:
+        OutputListener(const std::string& name)
+            : outputStream_(NULL)
+            , name_(name)
+            , softDebugLevel_(OutputLevel::Info)
+        {}
+        virtual ~OutputListener() {}
+
+        //! Gets called whenever output is put into the stream
+        virtual void outputChanged(int level) {}
+        //! Returns the name of this output listener
+        const std::string& getOutputListenerName() const { return this->name_; }
+        //! Returns the soft debug level of the listener
+        int getSoftDebugLevel() const { return this->softDebugLevel_; }
+        //! Sets the soft debug level of the listener
+        void setSoftDebugLevel(int level)
         {
-            this->logfile_ << output;
-            this->logfile_.flush();
+            this->softDebugLevel_ = level;
+            OutputHandler::getInstance().setSoftDebugLevel(this->name_, level);
         }
 
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
-            (*this->outputBuffer_) << output;
+    protected:
+        std::ostream*     outputStream_;   //!< Pointer to the associated output stream, can be NULL
 
-        return *this;
-    }
+    private:
+        const std::string name_;           //!< Name of the listener, constant and unique!
+        int               softDebugLevel_; //!< Current soft debug level that defines what kind of output is written to the stream
+    };
 
-    /**
-        @brief Overloading of the non-member << operator to redirect the output of classes with self defined '<< to std::ostream' operators to the console and the logfile.
-        @param out The OutputHandler itself
-        @param output The class that should be shown in the console
-        @return The OutputHandler itself
-    */
     template<class T>
-    OutputHandler& operator<<(OutputHandler& out, const T& output)
+    inline OutputHandler& OutputHandler::output(const T& output)
     {
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Console) >= out.getOutputLevel())
-            std::cout << output;
-
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Logfile) >= out.getOutputLevel())
+        for (std::list<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
         {
-            out.getLogfile() << output;
-            out.getLogfile().flush();
+            if (this->outputLevel_ <= (*it)->softDebugLevel_ && (*it)->outputStream_ != NULL)
+            {
+                std::ostream& stream = *((*it)->outputStream_);
+                stream << output;
+                stream.flush();
+                (*it)->outputChanged(this->outputLevel_);
+            }
         }
 
-        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= out.getOutputLevel())
-            (*out.getOutputBuffer()) << output;
-
-        return out;
+        return *this;
     }
 }
 

Modified: code/trunk/src/libraries/util/UtilPrereqs.h
===================================================================
--- code/trunk/src/libraries/util/UtilPrereqs.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/libraries/util/UtilPrereqs.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -86,9 +86,8 @@
     class IntVector2;
     class IntVector3;
     class MultiType;
-    class OutputBuffer;
-    class OutputBufferListener;
     class OutputHandler;
+    class OutputListener;
     template <ScopeID::Value>
     class Scope;
     template <class, ScopeID::Value>

Modified: code/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/Main.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -67,9 +67,8 @@
         "  mainMenu"
         "  standalone,server,client"
         "   level"
-        " dedicated,dedicatedClient"
+        " server,client"
         "  level"
-        " ioConsole"
         );
 
         game->requestState("root");
@@ -82,13 +81,14 @@
         else if (CommandLineParser::getValue("client").getBool())
             Game::getInstance().requestStates("graphics, client, level");
         else if (CommandLineParser::getValue("dedicated").getBool())
-            Game::getInstance().requestStates("dedicated, level");
+            Game::getInstance().requestStates("server, level");
         else if (CommandLineParser::getValue("dedicatedClient").getBool())
-            Game::getInstance().requestStates("dedicatedClient, level");
-        else if (CommandLineParser::getValue("console").getBool())
-            Game::getInstance().requestStates("ioConsole");
+            Game::getInstance().requestStates("client, level");
         else
-            Game::getInstance().requestStates("graphics, mainMenu");
+        {
+            if (!CommandLineParser::getValue("console").getBool())
+                Game::getInstance().requestStates("graphics, mainMenu");
+        }
 
         game->run();
         delete game;

Modified: code/trunk/src/orxonox/gamestates/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/gamestates/CMakeLists.txt	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/CMakeLists.txt	2009-11-20 15:55:40 UTC (rev 6105)
@@ -1,9 +1,6 @@
 ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   GSClient.cc
-  GSDedicated.cc
-  GSDedicatedClient.cc
   GSGraphics.cc
-  GSIOConsole.cc
   GSLevel.cc
   GSMainMenu.cc
   GSRoot.cc

Modified: code/trunk/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/GSClient.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -28,7 +28,7 @@
 
 #include "GSClient.h"
 
-#include "util/Clock.h"
+#include "util/Debug.h"
 #include "util/Exception.h"
 #include "core/CommandLineParser.h"
 #include "core/Game.h"
@@ -37,7 +37,7 @@
 
 namespace orxonox
 {
-    DeclareGameState(GSClient, "client", false, true);
+    DeclareGameState(GSClient, "client", false, false);
 
     SetCommandLineArgument(ip, "127.0.0.1").information("Sever IP as string in the form #.#.#.#");
 

Deleted: code/trunk/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -1,85 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _GSDedicated_H__
-#define _GSDedicated_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <cstring>
-#include <queue>
-#include <boost/thread/thread.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/recursive_mutex.hpp>
-
-#include "core/GameState.h"
-#include "network/NetworkPrereqs.h"
-
-struct termios;
-
-namespace orxonox
-{
-
-    class _OrxonoxExport GSDedicated : public GameState
-    {
-    public:
-        GSDedicated(const GameStateInfo& info);
-        ~GSDedicated();
-
-        void activate();
-        void deactivate();
-        void update(const Clock& time);
-
-    private:
-        void inputThread();
-        void printLine();
-        void processQueue();
-        void setTerminalMode();
-        static void resetTerminalMode();
-
-        void insertCharacter( unsigned int position, char c );
-        void deleteCharacter( unsigned int position );
-
-        Server*                 server_;
-
-        boost::thread           *inputThread_;
-        boost::recursive_mutex  inputLineMutex_;
-        boost::recursive_mutex  inputQueueMutex_;
-        bool                    closeThread_;
-        bool                    cleanLine_;
-        unsigned char*          commandLine_;
-        unsigned int            inputIterator_;
-        std::queue<std::string> commandQueue_;
-        static termios*         originalTerminalSettings_;
-
-        unsigned int            cursorX_;
-        unsigned int            cursorY_;
-    };
-}
-
-#endif /* _GSDedicated_H__ */

Deleted: code/trunk/src/orxonox/gamestates/GSDedicatedClient.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicatedClient.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/GSDedicatedClient.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -1,84 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      Oliver Scheuss
- *
- */
-
-#ifndef _GSDedicatedClient_H__
-#define _GSDedicatedClient_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "core/GameState.h"
-#include "network/NetworkPrereqs.h"
-#include <queue>
-#include <cstring>
-#include <boost/thread/thread.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/recursive_mutex.hpp>
-
-struct termios;
-
-namespace orxonox
-{
-
-    class _OrxonoxExport GSDedicatedClient : public GameState
-    {
-    public:
-        GSDedicatedClient(const GameStateInfo& info);
-        ~GSDedicatedClient();
-
-        void activate();
-        void deactivate();
-        void update(const Clock& time);
-
-    private:
-        void inputThread();
-        void printLine();
-        void processQueue();
-        void setTerminalMode();
-        static void resetTerminalMode();
-
-        void insertCharacter( unsigned int position, char c );
-        void deleteCharacter( unsigned int position );
-
-        Client*                 client_;
-
-        boost::thread           *inputThread_;
-        boost::recursive_mutex  inputLineMutex_;
-        boost::recursive_mutex  inputQueueMutex_;
-        bool                    closeThread_;
-        bool                    cleanLine_;
-        unsigned char*          commandLine_;
-        unsigned int            inputIterator_;
-        std::queue<std::string> commandQueue_;
-        static termios*         originalTerminalSettings_;
-
-        unsigned int            cursorX_;
-        unsigned int            cursorY_;
-    };
-}
-
-#endif /* _GSDedicatedClient_H__ */

Deleted: code/trunk/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSIOConsole.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/GSIOConsole.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -1,71 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#include "GSIOConsole.h"
-
-#include <iostream>
-#include "core/ConsoleCommand.h"
-#include "core/CommandExecutor.h"
-#include "core/Game.h"
-
-namespace orxonox
-{
-    DeclareGameState(GSIOConsole, "ioConsole", false, false);
-
-    GSIOConsole::GSIOConsole(const GameStateInfo& info)
-        : GameState(info)
-    {
-    }
-
-    GSIOConsole::~GSIOConsole()
-    {
-    }
-
-    void GSIOConsole::activate()
-    {
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSIOConsole::loadMenu, this), "loadMenu"));
-    }
-
-    void GSIOConsole::deactivate()
-    {
-    }
-
-    void GSIOConsole::update(const Clock& time)
-    {
-        std::cout << ">";
-        std::string command;
-        std::getline(std::cin, command);
-        CommandExecutor::execute(command, true);
-    }
-
-    void GSIOConsole::loadMenu()
-    {
-        Game::getInstance().popState();
-        Game::getInstance().requestStates("graphics, mainMenu");
-    }
-}

Deleted: code/trunk/src/orxonox/gamestates/GSIOConsole.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSIOConsole.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/GSIOConsole.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -1,52 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _GSIOConsole_H__
-#define _GSIOConsole_H__
-
-#include "OrxonoxPrereqs.h"
-#include "core/GameState.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport GSIOConsole : public GameState
-    {
-    public:
-        GSIOConsole(const GameStateInfo& info);
-        ~GSIOConsole();
-
-        void activate();
-        void deactivate();
-        void update(const Clock& time);
-
-    private:
-        void loadMenu();
-    };
-}
-
-#endif /* _GSIOConsole_H__ */

Modified: code/trunk/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -90,7 +90,6 @@
         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startClient), "startClient"));
         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startDedicated), "startDedicated"));
         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu"));
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startIOConsole), "startIOConsole"));
 
         KeyBinderManager::getInstance().setToDefault();
         InputManager::getInstance().enterState("mainMenu");
@@ -145,7 +144,7 @@
         // HACK - HACK
         Game::getInstance().popState();
         Game::getInstance().popState();
-        Game::getInstance().requestStates("dedicated, level");
+        Game::getInstance().requestStates("server, level");
     }
     void GSMainMenu::startMainMenu()
     {
@@ -154,11 +153,4 @@
         Game::getInstance().popState();
         Game::getInstance().requestStates("mainmenu");
     }
-    void GSMainMenu::startIOConsole()
-    {
-        // HACK - HACK
-        Game::getInstance().popState();
-        Game::getInstance().popState();
-        Game::getInstance().requestStates("ioConsole");
-    }
 }

Modified: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -89,13 +89,6 @@
 
     void GSRoot::update(const Clock& time)
     {
-        if (this->getActivity().topState)
-        {
-            // This state can not 'survive' on its own.
-            // Load a user interface therefore
-            Game::getInstance().requestState("ioConsole");
-        }
-
         for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; )
             (it++)->tick(time);
 

Modified: code/trunk/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/gamestates/GSServer.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -36,7 +36,7 @@
 
 namespace orxonox
 {
-    DeclareGameState(GSServer, "server", false, true);
+    DeclareGameState(GSServer, "server", false, false);
 
     SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)");
 

Modified: code/trunk/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/overlays/InGameConsole.cc	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/overlays/InGameConsole.cc	2009-11-20 15:55:40 UTC (rev 6105)
@@ -67,7 +67,8 @@
         @brief Constructor: Creates and initializes the InGameConsole.
     */
     InGameConsole::InGameConsole()
-        : consoleOverlay_(0)
+        : shell_(new Shell("InGameConsole", true, true))
+        , consoleOverlay_(0)
         , consoleOverlayContainer_(0)
         , consoleOverlayNoise_(0)
         , consoleOverlayCursor_(0)
@@ -99,6 +100,9 @@
         // destroy the input state previously created (InputBuffer gets destroyed by the Shell)
         InputManager::getInstance().destroyState("console");
 
+        // destroy the underlaying shell
+        this->shell_->destroy();
+
         Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
         if (ovMan)
         {
@@ -173,7 +177,7 @@
     {
         // create the corresponding input state
         inputState_ = InputManager::getInstance().createInputState("console", false, false, InputStatePriority::Console);
-        inputState_->setKeyHandler(Shell::getInstance().getInputBuffer());
+        inputState_->setKeyHandler(this->shell_->getInputBuffer());
         bHidesAllInputChanged();
 
         // create overlay and elements
@@ -251,8 +255,6 @@
         // we take -1.3 because the border makes the panel bigger
         this->consoleOverlayContainer_->setTop(-1.3 * this->relativeHeight);
 
-        Shell::getInstance().addOutputLevel(true);
-
         COUT(4) << "Info: InGameConsole initialized" << std::endl;
     }
 
@@ -265,11 +267,11 @@
     */
     void InGameConsole::linesChanged()
     {
-        std::list<std::string>::const_iterator it = Shell::getInstance().getNewestLineIterator();
+        std::list<std::string>::const_iterator it = this->shell_->getNewestLineIterator();
         int max = 0;
         for (int i = 1; i < LINES; ++i)
         {
-            if (it != Shell::getInstance().getEndIterator())
+            if (it != this->shell_->getEndIterator())
             {
                 ++it;
                 max = i;
@@ -294,7 +296,7 @@
     void InGameConsole::onlyLastLineChanged()
     {
         if (LINES > 1)
-            this->print(*Shell::getInstance().getNewestLineIterator(), 1);
+            this->print(*this->shell_->getNewestLineIterator(), 1);
     }
 
     /**
@@ -313,9 +315,9 @@
     void InGameConsole::inputChanged()
     {
         if (LINES > 0)
-            this->print(Shell::getInstance().getInput(), 0);
+            this->print(this->shell_->getInput(), 0);
 
-        if (Shell::getInstance().getInput() == "" || Shell::getInstance().getInput().size() == 0)
+        if (this->shell_->getInput() == "" || this->shell_->getInput().size() == 0)
             this->inputWindowStart_ = 0;
     }
 
@@ -324,7 +326,7 @@
     */
     void InGameConsole::cursorChanged()
     {
-        unsigned int pos = Shell::getInstance().getCursorPosition() - inputWindowStart_;
+        unsigned int pos = this->shell_->getCursorPosition() - inputWindowStart_;
         if (pos > maxCharsPerLine_)
             pos = maxCharsPerLine_;
 
@@ -333,6 +335,14 @@
     }
 
     /**
+        @brief Called if a command is about to be executed
+    */
+    void InGameConsole::executed()
+    {
+        this->shell_->addOutputLine(this->shell_->getInput());
+    }
+
+    /**
         @brief Called if the console gets closed.
     */
     void InGameConsole::exit()
@@ -481,10 +491,10 @@
             {
                 if (output.size() > this->maxCharsPerLine_)
                 {
-                    if (Shell::getInstance().getInputBuffer()->getCursorPosition() < this->inputWindowStart_)
-                        this->inputWindowStart_ = Shell::getInstance().getInputBuffer()->getCursorPosition();
-                    else if (Shell::getInstance().getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1))
-                        this->inputWindowStart_ = Shell::getInstance().getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1;
+                    if (this->shell_->getInputBuffer()->getCursorPosition() < this->inputWindowStart_)
+                        this->inputWindowStart_ = this->shell_->getInputBuffer()->getCursorPosition();
+                    else if (this->shell_->getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1))
+                        this->inputWindowStart_ = this->shell_->getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1;
 
                     output = output.substr(this->inputWindowStart_, this->maxCharsPerLine_);
                 }
@@ -505,7 +515,7 @@
         {
             this->bActive_ = true;
             InputManager::getInstance().enterState("console");
-            Shell::getInstance().registerListener(this);
+            this->shell_->registerListener(this);
 
             this->windowResized(this->windowW_, this->windowH_);
             this->linesChanged();
@@ -527,7 +537,7 @@
         {
             this->bActive_ = false;
             InputManager::getInstance().leaveState("console");
-            Shell::getInstance().unregisterListener(this);
+            this->shell_->unregisterListener(this);
 
             // scroll up
             this->scroll_ = -1;
@@ -587,9 +597,9 @@
         }
     }
 
-    // ###############################
-    // ###      satic methods      ###
-    // ###############################
+    // ################################
+    // ###      static methods      ###
+    // ################################
 
     /**
         @brief Activates the console.

Modified: code/trunk/src/orxonox/overlays/InGameConsole.h
===================================================================
--- code/trunk/src/orxonox/overlays/InGameConsole.h	2009-11-20 15:44:51 UTC (rev 6104)
+++ code/trunk/src/orxonox/overlays/InGameConsole.h	2009-11-20 15:55:40 UTC (rev 6105)
@@ -67,6 +67,7 @@
         void lineAdded();
         void inputChanged();
         void cursorChanged();
+        void executed();
         void exit();
 
         void shiftLines();
@@ -80,6 +81,7 @@
         void bHidesAllInputChanged();
 
     private: // variables
+        Shell* shell_;
         bool bActive_;
         int windowW_;
         int windowH_;




More information about the Orxonox-commit mailing list