Index: code/branches/kicklib2/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/kicklib2/src/libraries/core/CMakeLists.txt	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/CMakeLists.txt	(revision 8283)
@@ -58,5 +58,4 @@
   command/ArgumentCompletionFunctions.cc
   ConfigFileManager.cc
-  MemoryArchive.cc
   PathConfig.cc
 COMPILATION_END
@@ -98,10 +97,10 @@
     ${CEGUI_LIBRARY}
     ${CEGUILUA_LIBRARY}
-    ${LUA_LIBRARIES}
+    ${CEGUI_TOLUA_LIBRARY}
+    ${CEGUI_OGRE_RENDERER_LIBRARY}
+    ${LUA5.1_LIBRARY}
     cpptcl_orxonox
-    ogreceguirenderer_orxonox
     ois_orxonox
     tinyxml_orxonox
-    tolua_orxonox
     util
   SOURCE_FILES
Index: code/branches/kicklib2/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/CorePrereqs.h	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/CorePrereqs.h	(revision 8283)
@@ -38,4 +38,5 @@
 #include "OrxonoxConfig.h"
 #include <boost/version.hpp>
+#include <CEGUIVersion.h>
 
 //-----------------------------------------------------------------------
@@ -306,7 +307,13 @@
     class LuaScriptModule;
 
+#if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7
     class OgreCEGUIRenderer;
     class OgreCEGUIResourceProvider;
     class OgreCEGUITexture;
+#else
+    class OgreRenderer;
+    class OgreResourceProvider;
+    class OgreImageCodec;
+#endif
 }
 
Index: code/branches/kicklib2/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/GUIManager.cc	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/GUIManager.cc	(revision 8283)
@@ -30,6 +30,8 @@
 #include "GUIManager.h"
 
+#include <memory>
 #include <boost/bind.hpp>
-#include <memory>
+#include <OgreRenderQueue.h>
+#include <OgreRenderWindow.h>
 
 #include <CEGUIDefaultLogger.h>
@@ -43,11 +45,16 @@
 #include <elements/CEGUIListbox.h>
 #include <elements/CEGUIListboxItem.h>
-#include <ogreceguirenderer/OgreCEGUIRenderer.h>
-
-#include "SpecialConfig.h" // Configures the macro below
-#ifdef CEGUILUA_USE_INTERNAL_LIBRARY
-#   include <ceguilua/CEGUILua.h>
+
+#ifdef ORXONOX_OLD_CEGUI
+#  include <CEGUILua.h>
+#  include <ogreceguirenderer/OgreCEGUIRenderer.h>
+extern "C" {
+#  include <lauxlib.h>
+}
 #else
-#   include <CEGUILua.h>
+#  include <ScriptingModules/LuaScriptModule/CEGUILua.h>
+#  include <RendererModules/Ogre/CEGUIOgreImageCodec.h>
+#  include <RendererModules/Ogre/CEGUIOgreRenderer.h>
+#  include <RendererModules/Ogre/CEGUIOgreResourceProvider.h>
 #endif
 
@@ -89,5 +96,5 @@
                 case CEGUI::Informative: orxonoxLevel = 5; break;
                 case CEGUI::Insane:      orxonoxLevel = 6; break;
-                default: OrxAssert(false, "CEGUI log level out of range, inpect immediately!");
+                default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!");
             }
             OutputHandler::getOutStream(orxonoxLevel)
@@ -97,4 +104,26 @@
         }
     };
+
+#ifdef ORXONOX_OLD_CEGUI
+    /** Class with the same memory layout as CEGUI::LuaScriptModule. <br>
+        We need this to fix a problem with an uninitialised member variable
+        in CEGUI < 0.7 <br>
+        Notice that "public" modifier for the otherwise private variables.
+    */
+    class CEGUILUA_API LuaScriptModuleWorkaround : public CEGUI::ScriptModule
+    {
+    public:
+        LuaScriptModuleWorkaround();
+        ~LuaScriptModuleWorkaround();
+
+    public:
+        bool d_ownsState;
+        lua_State* d_state;
+        CEGUI::String d_errFuncName;
+        int d_errFuncIndex;
+        CEGUI::String d_activeErrFuncName;
+        int d_activeErrFuncIndex;
+    };
+#endif
 
     static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
@@ -118,5 +147,13 @@
     */
     GUIManager::GUIManager(const std::pair<int, int>& mousePosition)
-        : resourceProvider_(NULL)
+        : destroyer_(*this, &GUIManager::cleanup)
+        , guiRenderer_(NULL)
+        , luaState_(NULL)
+        , scriptModule_(NULL)
+        , guiSystem_(NULL)
+        , resourceProvider_(NULL)
+#ifndef ORXONOX_OLD_CEGUI
+        , imageCodec_(NULL)
+#endif
         , camera_(NULL)
     {
@@ -129,14 +166,30 @@
 
         // Note: No SceneManager specified yet
-        guiRenderer_.reset(new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000));
+#ifdef ORXONOX_OLD_CEGUI
+        guiRenderer_ = new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000);
         resourceProvider_ = guiRenderer_->createResourceProvider();
+#else
+        guiRenderer_ = &OgreRenderer::create(*GraphicsManager::getInstance().getRenderWindow());
+        resourceProvider_ = &OgreRenderer::createOgreResourceProvider();
+        imageCodec_ = &OgreRenderer::createOgreImageCodec();
+#endif
         resourceProvider_->setDefaultResourceGroup("General");
 
         // Setup scripting
-        luaState_.reset(new LuaState());
+        luaState_ = new LuaState();
         rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua");
         // This is necessary to ensure that input events also use the right resource info when triggering lua functions
         luaState_->setDefaultResourceInfo(this->rootFileInfo_);
-        scriptModule_.reset(new LuaScriptModule(luaState_->getInternalLuaState()));
+#ifdef ORXONOX_OLD_CEGUI
+        scriptModule_ = new LuaScriptModule(luaState_->getInternalLuaState());
+        // Ugly workaround: older CEGUILua versions don't initialise the member
+        // d_activeErrFuncIndex at all. That leads to "error in error handling"
+        // problems when a Lua error occurs.
+        // We fix this by setting the member manually.
+        reinterpret_cast<LuaScriptModuleWorkaround*>(scriptModule_)->d_activeErrFuncIndex = LUA_NOREF;
+        luaState_->doString("ORXONOX_OLD_CEGUI = true");
+#else
+        scriptModule_ = &LuaScriptModule::create(luaState_->getInternalLuaState());
+#endif
         scriptModule_->setDefaultPCallErrorHandler(LuaState::ERROR_HANDLER_NAME);
 
@@ -144,5 +197,5 @@
         std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
         ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
-        // set the log level according to ours (translate by subtracting 1)
+        // Set the log level according to ours (translate by subtracting 1)
         ceguiLogger->setLoggingLevel(
             static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
@@ -150,5 +203,12 @@
 
         // Create the CEGUI system singleton
-        guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get()));
+#ifdef ORXONOX_OLD_CEGUI
+        guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_);
+        // Add functions that have been renamed in newer versions
+        luaState_->doString("CEGUI.SchemeManager.create = CEGUI.SchemeManager.loadScheme");
+        luaState_->doString("CEGUI.Window.getUnclippedOuterRect = CEGUI.Window.getUnclippedPixelRect");
+#else
+        guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_);
+#endif
 
         // Align CEGUI mouse with OIS mouse
@@ -175,10 +235,20 @@
     }
 
-    /**
-    @brief
-        Basically shuts down CEGUI (member smart pointers) but first unloads our Tolua modules.
-    */
-    GUIManager::~GUIManager()
-    {
+    void GUIManager::cleanup()
+    {
+        using namespace CEGUI;
+
+#ifdef ORXONOX_OLD_CEGUI
+        delete guiSystem_;
+        delete guiRenderer_;
+        delete scriptModule_;
+#else
+        System::destroy();
+        OgreRenderer::destroyOgreResourceProvider(*resourceProvider_);
+        OgreRenderer::destroyOgreImageCodec(*imageCodec_);
+        OgreRenderer::destroy(*guiRenderer_);
+        LuaScriptModule::destroy(*scriptModule_);
+#endif
+        delete luaState_;
     }
 
@@ -222,8 +292,10 @@
     {
         this->camera_ = camera;
+#ifdef ORXONOX_OLD_CEGUI
         if (camera == NULL)
             this->guiRenderer_->setTargetSceneManager(0);
         else
             this->guiRenderer_->setTargetSceneManager(camera->getSceneManager());
+#endif
     }
 
@@ -522,5 +594,5 @@
         The Listbox for which to enable (or disable) tooltips.
     @param enabled
-        Whether to enable or disabel the tooltips.
+        Whether to enable or disable the tooltips.
     */
     void GUIManager::setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled)
@@ -535,4 +607,7 @@
     {
         this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight));
+#else
+        this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight));
+#endif
     }
 
Index: code/branches/kicklib2/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/GUIManager.h	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/GUIManager.h	(revision 8283)
@@ -42,6 +42,7 @@
 #include <string>
 #include <CEGUIForwardRefs.h>
-#include <boost/scoped_ptr.hpp>
+#include <CEGUIVersion.h>
 #include <boost/shared_ptr.hpp>
+#include <loki/ScopeGuard.h>
 
 #include "util/OgreForwardRefs.h"
@@ -57,4 +58,8 @@
 $cfile "../util/TriBool.h" // tolua_export
 */
+
+#if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7
+#  define ORXONOX_OLD_CEGUI
+#endif
 
 namespace orxonox // tolua_export
@@ -78,5 +83,6 @@
     public:
         GUIManager(const std::pair<int, int>& mousePosition);
-        ~GUIManager();
+        //! Leave empty and use cleanup() instead
+        ~GUIManager() {}
 
         void setConfigValues(void);
@@ -104,5 +110,5 @@
         const std::string& createInputState(const std::string& name, TriBool::Value showCursor = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export
         LuaState* getLuaState(void)
-            { return this->luaState_.get(); }
+            { return this->luaState_; }
 
         //! Returns the root window for all menu sheets
@@ -127,4 +133,8 @@
     private:
         GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
+
+        /// Destructor that also executes when object fails to construct
+        void cleanup();
+
         void executeCode(const std::string& str);
 
@@ -147,10 +157,19 @@
         virtual void windowFocusChanged(bool bFocus);
 
-        scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
-        scoped_ptr<LuaState>                 luaState_;         //!< LuaState, access point to the Lua engine
-        scoped_ptr<CEGUI::LuaScriptModule>   scriptModule_;     //!< CEGUI's script module to use Lua
-        scoped_ptr<CEGUI::System>            guiSystem_;        //!< CEGUI's main system
+        /// Surrogate for the destructor
+        Loki::ObjScopeGuardImpl0<GUIManager, void (GUIManager::*)()> destroyer_;
+
+#ifdef ORXONOX_OLD_CEGUI
+        CEGUI::OgreCEGUIRenderer*            guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
+        CEGUI::ResourceProvider*             resourceProvider_; //!< CEGUI's resource provider
+#else
+        CEGUI::OgreRenderer*                 guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
+        CEGUI::OgreResourceProvider*         resourceProvider_; //!< CEGUI's resource provider
+        CEGUI::OgreImageCodec*               imageCodec_;
+#endif
+        LuaState*                            luaState_;         //!< LuaState, access point to the Lua engine
+        CEGUI::LuaScriptModule*              scriptModule_;     //!< CEGUI's script module to use Lua
+        CEGUI::System*                       guiSystem_;        //!< CEGUI's main system
         shared_ptr<ResourceInfo>             rootFileInfo_;     //!< Resource information about the root script
-        CEGUI::ResourceProvider*             resourceProvider_; //!< CEGUI's resource provider
         CEGUI::Logger*                       ceguiLogger_;      //!< CEGUI's logger to be able to log CEGUI errors in our log
         CEGUI::Window*                       rootWindow_;       //!< Root node for all windows
Index: code/branches/kicklib2/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/GraphicsManager.cc	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/GraphicsManager.cc	(revision 8283)
@@ -35,6 +35,4 @@
 #include <boost/shared_array.hpp>
 
-#include <OgreArchiveFactory.h>
-#include <OgreArchiveManager.h>
 #include <OgreFrameListener.h>
 #include <OgreRoot.h>
@@ -60,5 +58,4 @@
 #include "GUIManager.h"
 #include "Loader.h"
-#include "MemoryArchive.h"
 #include "PathConfig.h"
 #include "ViewportEventListener.h"
@@ -102,7 +99,4 @@
     GraphicsManager::GraphicsManager(bool bLoadRenderer)
         : ogreWindowEventListener_(new OgreWindowEventListener())
-#if OGRE_VERSION < 0x010600
-        , memoryArchiveFactory_(new MemoryArchiveFactory())
-#endif
         , renderWindow_(0)
         , viewport_(0)
@@ -195,52 +189,4 @@
 
         this->loadRenderer();
-
-#if OGRE_VERSION < 0x010600
-        // WORKAROUND: There is an incompatibility for particle scripts when trying
-        // to support both Ogre 1.4 and 1.6. The hacky solution is to create
-        // scripts for the 1.6 version and then remove the inserted "particle_system"
-        // keyword. But we need to supply these new scripts as well, which is why
-        // there is an extra Ogre::Archive dealing with it in the memory.
-        using namespace Ogre;
-        ArchiveManager::getSingleton().addArchiveFactory(memoryArchiveFactory_.get());
-        const StringVector& groups = ResourceGroupManager::getSingleton().getResourceGroups();
-        // Travers all groups
-        for (StringVector::const_iterator itGroup = groups.begin(); itGroup != groups.end(); ++itGroup)
-        {
-            FileInfoListPtr files = ResourceGroupManager::getSingleton().findResourceFileInfo(*itGroup, "*.particle");
-            for (FileInfoList::const_iterator itFile = files->begin(); itFile != files->end(); ++itFile)
-            {
-                // open file
-                Ogre::DataStreamPtr input = ResourceGroupManager::getSingleton().openResource(itFile->filename, *itGroup, false);
-                std::stringstream output;
-                // Parse file and replace "particle_system" with nothing
-                while (!input->eof())
-                {
-                    std::string line = input->getLine();
-                    size_t pos = line.find("particle_system");
-                    if (pos != std::string::npos)
-                    {
-                        // 15 is the length of "particle_system"
-                        line.replace(pos, 15, "");
-                    }
-                    output << line << std::endl;
-                }
-                // Add file to the memory archive
-                shared_array<char> data(new char[output.str().size()]);
-                // Debug optimisations
-                const std::string& outputStr = output.str();
-                char* rawData = data.get();
-                for (unsigned i = 0; i < outputStr.size(); ++i)
-                    rawData[i] = outputStr[i];
-                MemoryArchive::addFile("particle_scripts_ogre_1.4_" + *itGroup, itFile->filename, data, output.str().size());
-            }
-            if (!files->empty())
-            {
-                // Declare the files, but using a new group
-                ResourceGroupManager::getSingleton().addResourceLocation("particle_scripts_ogre_1.4_" + *itGroup,
-                    "Memory", "particle_scripts_ogre_1.4_" + *itGroup);
-            }
-        }
-#endif
 
         // Initialise all resources (do this AFTER the renderer has been loaded!)
Index: code/branches/kicklib2/src/libraries/core/GraphicsManager.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/GraphicsManager.h	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/GraphicsManager.h	(revision 8283)
@@ -114,7 +114,4 @@
 
         scoped_ptr<OgreWindowEventListener> ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
-#if OGRE_VERSION < 0x010600
-        scoped_ptr<MemoryArchiveFactory>    memoryArchiveFactory_;    //!< Stores the modified particle scripts
-#endif
         scoped_ptr<Ogre::LogManager>        ogreLogger_;
         scoped_ptr<Ogre::Root>              ogreRoot_;                //!< Ogre's root
Index: code/branches/kicklib2/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/LuaState.cc	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/LuaState.cc	(revision 8283)
@@ -30,5 +30,5 @@
 #include "LuaState.h"
 
-#include <tolua/tolua++.h>
+#include <tolua++.h>
 extern "C" {
 #include <lua.h>
@@ -60,14 +60,5 @@
         luaState_ = lua_open();
         Loki::ScopeGuard luaStateGuard = Loki::MakeGuard(&lua_close, luaState_);
-#if LUA_VERSION_NUM == 501
         luaL_openlibs(luaState_);
-#else
-        luaopen_base(luaState_);
-        luaopen_string(luaState_);
-        luaopen_table(luaState_);
-        luaopen_math(luaState_);
-        luaopen_io(luaState_);
-        luaopen_debug(luaState_);
-#endif
 
         // Open all available tolua interfaces
@@ -187,12 +178,5 @@
         }
 
-#if LUA_VERSION_NUM != 501
-        LoadS ls;
-        ls.s = code.c_str();
-        ls.size = code.size();
-        int error = lua_load(luaState_, &orxonox::LuaState::lua_Chunkreader, &ls, chunkname.c_str());
-#else
         int error = luaL_loadbuffer(luaState_, code.c_str(), code.size(), chunkname.c_str());
-#endif
 
         switch (error)
@@ -293,16 +277,4 @@
     }
 
-#if LUA_VERSION_NUM != 501
-    const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size)
-    {
-        LoadS* ls = static_cast<LoadS*>(data);
-        if (ls->size == 0)
-            return NULL;
-        *size = ls->size;
-        ls->size = 0;
-        return ls->s;
-    }
-#endif
-
     /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
     {
Index: code/branches/kicklib2/src/libraries/core/LuaState.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/LuaState.h	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/LuaState.h	(revision 8283)
@@ -113,14 +113,4 @@
         shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
 
-#if LUA_VERSION_NUM != 501
-        struct LoadS
-        {
-            const char* s;
-            size_t size;
-        };
-
-        static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);
-#endif
-
         std::stringstream output_;
         lua_State* luaState_;
Index: code/branches/kicklib2/src/libraries/core/MemoryArchive.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/MemoryArchive.cc	(revision 8282)
+++ 	(revision )
@@ -1,141 +1,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 "MemoryArchive.h"
-
-#if OGRE_VERSION < 0x010600
-
-#include <OgreException.h>
-#include <boost/filesystem.hpp>
-#include <boost/version.hpp>
-
-// Boost 1.36 has some issues with deprecated functions that have been omitted
-#if (BOOST_VERSION == 103600)
-#  define BOOST_HAS_BRANCH_PATH_FUNCTION has_parent_path
-#else
-#  define BOOST_HAS_BRANCH_PATH_FUNCTION has_branch_path
-#endif
-
-namespace orxonox
-{
-    using namespace Ogre;
-
-    MemoryArchive::ArchiveMap MemoryArchive::archives_s;
-
-    void MemoryArchive::load()
-    {
-        if (archives_s.find(this->getName()) == archives_s.end())
-            OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR, this->getName() + " - MemoryArchive not found.", "MemoryArchive");
-    }
-
-    DataStreamPtr MemoryArchive::open(const Ogre::String& filename) const
-    {
-        const FileMap& files = archives_s[this->getName()];
-        FileMap::const_iterator itFile = files.find(filename);
-        if (itFile == files.end())
-            return DataStreamPtr();
-        else
-            return MemoryDataStreamPtr(new MemoryDataStream(itFile->second.first.get(), itFile->second.second));
-    }
-
-    void MemoryArchive::findFiles(const Ogre::String& pattern, bool bRecursive,
-        bool bDirs, Ogre::StringVector* simpleList, Ogre::FileInfoList* detailList)
-    {
-        const FileMap& files = archives_s[this->getName()];
-
-        for (FileMap::const_iterator it = files.begin(); it != files.end(); ++it)
-        {
-            boost::filesystem::path file = it->first;
-            // Check pattern
-            if (!StringUtil::match(file.string(), pattern, true))
-                continue;
-            if (bDirs)
-                file = file.branch_path();
-            if (file.empty())
-                continue;
-            if (file.BOOST_HAS_BRANCH_PATH_FUNCTION() && !bRecursive)
-                continue;
-            if (simpleList)
-                simpleList->push_back(file.string());
-            if (detailList)
-            {
-                FileInfo fi;
-                fi.archive = this;
-                fi.filename = file.string();
-                fi.basename = file.leaf();
-                fi.path = file.branch_path().string();
-                fi.compressedSize = it->second.second;
-                fi.uncompressedSize = it->second.second;
-                detailList->push_back(fi);
-            }
-        }
-    }
-    StringVectorPtr MemoryArchive::list(bool recursive, bool dirs)
-    {
-        StringVectorPtr ret(new StringVector());
-        findFiles("*", recursive, dirs, ret.getPointer(), 0);
-        return ret;
-    }
-
-    FileInfoListPtr MemoryArchive::listFileInfo(bool recursive, bool dirs)
-    {
-        FileInfoListPtr ret(new FileInfoList());
-        findFiles("*", recursive, dirs, 0, ret.getPointer());
-        return ret;
-    }
-
-    StringVectorPtr MemoryArchive::find(const Ogre::String& pattern,
-                                            bool recursive, bool dirs)
-    {
-        StringVectorPtr ret(new StringVector());
-        findFiles(pattern, recursive, dirs, ret.getPointer(), 0);
-        return ret;
-    }
-
-    FileInfoListPtr MemoryArchive::findFileInfo(const Ogre::String& pattern,
-        bool recursive, bool dirs)
-    {
-        FileInfoListPtr ret(new FileInfoList());
-        findFiles(pattern, recursive, dirs, 0, ret.getPointer());
-        return ret;
-    }
-
-    bool MemoryArchive::exists(const Ogre::String& filename)
-    {
-        const FileMap& files = archives_s[this->getName()];
-        return files.find(filename) != files.end();
-    }
-
-    const Ogre::String& MemoryArchiveFactory::getType(void) const
-    {
-        static std::string result("Memory");
-        return result;
-    }
-}
-
-#endif /* OGRE_VERSION < 0x010600 */
Index: code/branches/kicklib2/src/libraries/core/MemoryArchive.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/MemoryArchive.h	(revision 8282)
+++ 	(revision )
@@ -1,106 +1,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:
- *      ...
- *
- */
-
-/**
-    @file
-    @ingroup Management Resources
-*/
-
-#ifndef _MemoryArchive_H__
-#define _MemoryArchive_H__
-
-#include "CorePrereqs.h"
-#include <OgrePrerequisites.h>
-
-#if OGRE_VERSION < 0x010600
-
-#include <map>
-#include <OgreArchive.h>
-#include <OgreArchiveFactory.h>
-#include <boost/shared_array.hpp>
-
-namespace orxonox
-{
-    /**
-    @brief
-        Provides a simple mechanism of 'memory mapped IO', but compatible for Ogre 1.4
-
-        Files are stored as shared_array<char> in a static map with the archive names
-        (imaging the different archives as resource locations). This map then contains
-        yet another map with the actual files.
-        If you want to know why we make such a fuss, contact GraphicsManager::upgradeToGraphics()
-        for more information.
-    */
-    class MemoryArchive : public Ogre::Archive
-    {
-    public:
-        MemoryArchive(const Ogre::String& name, const Ogre::String& archiveType) : Ogre::Archive(name, archiveType) { }
-        ~MemoryArchive() { }
-
-        bool isCaseSensitive(void) const { return true; }
-
-        void load();
-        void unload() { }
-
-        Ogre::DataStreamPtr open(const Ogre::String& filename) const;
-
-        Ogre::StringVectorPtr list(bool recursive = true, bool dirs = false);
-        Ogre::FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
-
-        Ogre::StringVectorPtr find(const Ogre::String& pattern, bool recursive = true,
-            bool dirs = false);
-        Ogre::FileInfoListPtr findFileInfo(const Ogre::String& pattern, bool recursive = true,
-            bool dirs = false);
-
-        bool exists(const Ogre::String& filename);
-
-        static void addFile(const std::string& archiveName, const std::string& filename, shared_array<char> content, size_t size)
-            { archives_s[archiveName][filename] = std::make_pair(content, size); }
-
-    private:
-        void findFiles(const Ogre::String& pattern, bool bRecursive,
-            bool bDirs, Ogre::StringVector* simpleList, Ogre::FileInfoList* detailList);
-
-        typedef std::map<std::string, std::pair<shared_array<char>, size_t> > FileMap;
-        typedef std::map<std::string, FileMap> ArchiveMap;
-        static ArchiveMap archives_s;
-    };
-
-    //! Specialisation of ArchiveFactory for MemoryArchive.
-    class _CoreExport MemoryArchiveFactory : public Ogre::ArchiveFactory
-    {
-    public:
-        const Ogre::String& getType(void) const;
-        Ogre::Archive* createInstance(const Ogre::String& name) { return new MemoryArchive(name, "Memory"); }
-        void destroyInstance(Ogre::Archive* arch)               { delete arch; }
-    };
-}
-
-#endif /* OGRE_VERSION < 0x010600 */
-
-#endif /* _MemoryArchive_H__ */
Index: code/branches/kicklib2/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/input/KeyBinder.cc	(revision 8282)
+++ code/branches/kicklib2/src/libraries/core/input/KeyBinder.cc	(revision 8283)
@@ -396,5 +396,5 @@
 
             // iterate over all modes
-            for (size_t mode_index = 0; mode_index < 3; ++mode_index)
+            for (int mode_index = 0; mode_index < 3; ++mode_index)
             {
                 if (mode_index == (unsigned int)new_mode) // skip commands that are already in the desired mode
Index: code/branches/kicklib2/src/libraries/tools/Mesh.cc
===================================================================
--- code/branches/kicklib2/src/libraries/tools/Mesh.cc	(revision 8282)
+++ code/branches/kicklib2/src/libraries/tools/Mesh.cc	(revision 8283)
@@ -69,15 +69,4 @@
                 this->entity_ = this->scenemanager_->createEntity("Mesh" + multi_cast<std::string>(Mesh::meshCounter_s++), meshsource);
                 this->entity_->setCastShadows(this->bCastShadows_);
-
-#if OGRE_VERSION < 0x010600
-                this->entity_->setNormaliseNormals(true);
-                /*
-                    Excerpt from Ogre forum:
-                    "Note that the above is only for the fixed function pipeline.
-                    If/when you get into shaders, you'll need to manually normalize() the normal inside the vertex or pixel shader."
-
-                    I don't know exactly what this means, but I put this here if there will be problems with shaders.
-                */
-#endif
             }
             catch (...)
Index: code/branches/kicklib2/src/libraries/util/Exception.cc
===================================================================
--- code/branches/kicklib2/src/libraries/util/Exception.cc	(revision 8282)
+++ code/branches/kicklib2/src/libraries/util/Exception.cc	(revision 8283)
@@ -95,16 +95,12 @@
             throw;
         }
+        catch (const CEGUI::Exception& ex)
+        {
+            return GeneralException(ex.getMessage().c_str(), ex.getLine(),
+                ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
+        }
         catch (const std::exception& ex)
         {
             return ex.what();
-        }
-        catch (const CEGUI::Exception& ex)
-        {
-#if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
-            return GeneralException(ex.getMessage().c_str()).getDescription();
-#else
-            return GeneralException(ex.getMessage().c_str(), ex.getLine(),
-                ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
-#endif
         }
         catch (...)
