Index: code/branches/bugger/src/orxonox/overlays/CMakeLists.txt
===================================================================
--- code/branches/bugger/src/orxonox/overlays/CMakeLists.txt	(revision 2529)
+++ code/branches/bugger/src/orxonox/overlays/CMakeLists.txt	(revision 2533)
@@ -8,4 +8,5 @@
 ADD_SOURCE_DIRECTORY(SRC_FILES debug)
 ADD_SOURCE_DIRECTORY(SRC_FILES hud)
+ADD_SOURCE_DIRECTORY(SRC_FILES notifications)
 
 ADD_SOURCE_FILES(SRC_FILES)
Index: code/branches/bugger/src/orxonox/overlays/notifications/CMakeLists.txt
===================================================================
--- code/branches/bugger/src/orxonox/overlays/notifications/CMakeLists.txt	(revision 2533)
+++ code/branches/bugger/src/orxonox/overlays/notifications/CMakeLists.txt	(revision 2533)
@@ -0,0 +1,7 @@
+SET( SRC_FILES
+  Notification.cc
+  NotificationManager.cc
+  NotificationQueue.cc
+)
+
+ADD_SOURCE_FILES(SRC_FILES)
Index: code/branches/bugger/src/orxonox/overlays/notifications/Notification.cc
===================================================================
--- code/branches/bugger/src/orxonox/overlays/notifications/Notification.cc	(revision 2533)
+++ code/branches/bugger/src/orxonox/overlays/notifications/Notification.cc	(revision 2533)
@@ -0,0 +1,102 @@
+/*
+ *   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 thes
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Notification.h"
+
+#include "core/CoreIncludes.h"
+
+#include "NotificationManager.h"
+
+namespace orxonox
+{
+    Notification::Notification(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(Notification);
+    }
+    
+    Notification::Notification(BaseObject* creator, const std::string & message, const std::string & title, float time) : BaseObject(creator)
+    {
+        this->title_ = title;
+        this->message_ = message;
+        if(time > 0)
+            this->displayTime_ = time;
+    }
+    
+    Notification::~Notification()
+    {
+    }
+    
+    void Notification::initialize(void)
+    {
+        RegisterObject(Notification);
+        
+        this->title_ = "";
+        this->message_ = "";
+        this->displayTime_ = NOTIFICATION_DISPLAY_TIME;
+        this->sent_ = false;
+    }
+    
+    bool Notification::send(void)
+    {
+        bool successful = NotificationManager::insertNotification(this);
+        if(successful)
+            this->sent_ = true;
+        return successful;
+    }
+    
+    bool Notification::setTitle(const std::string & title)
+    {
+        if(this->isSent())
+            return false;
+        this->title_ = title;
+        return true;
+    }
+    
+    bool Notification::setMessage(const std::string & message)
+    {
+        if(this->isSent())
+            return false;
+        this->message_ = message;
+        return true;
+    }
+    
+    bool Notification::setDisplayTime(float time)
+    {
+        if(this->isSent())
+        {
+            return false;
+        }
+        if(time > 0)
+        {
+            this->displayTime_ = time;
+            return true;
+        }
+        return false;
+    }
+}
Index: code/branches/bugger/src/orxonox/overlays/notifications/Notification.h
===================================================================
--- code/branches/bugger/src/orxonox/overlays/notifications/Notification.h	(revision 2533)
+++ code/branches/bugger/src/orxonox/overlays/notifications/Notification.h	(revision 2533)
@@ -0,0 +1,80 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Notification_H__
+#define _Notification_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    static const float NOTIFICATION_DISPLAY_TIME = 4.0;
+
+    /**
+    @brief
+        This is rather temporary, so don't start relying on it, some better version will come soon but the Interface will not likely be the same.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport Notification : public BaseObject
+    {
+    public:
+        Notification(BaseObject* creator);
+        Notification(BaseObject* creator, const std::string & message, const std::string & title = "", float time = NOTIFICATION_DISPLAY_TIME);
+        virtual ~Notification();
+        
+        bool send(void);
+        
+        inline bool isSent(void) const
+            { return this->sent_; }
+        inline const std::string & getTitle(void) const
+            { return this->title_; }
+        inline const std::string & getMessage(void) const
+            { return this->message_; }
+        inline const float getDisplayTime(void) const
+            { return displayTime_; }
+        
+        bool setTitle(const std::string & title);
+        bool setMessage(const std::string & message);
+        bool setDisplayTime(float time);
+        
+    private:
+        std::string title_; //!< The title of the Notification.
+        std::string message_; //!< The Notification message.
+        float displayTime_; //!< The time duration the Notification is displayed in seconds.
+        bool sent_; //!< Whether Notification has been sent, if so it cannot be changed.
+        
+        void initialize(void);
+    };
+}
+
+#endif /* _Notification_H__ */
Index: code/branches/bugger/src/orxonox/overlays/notifications/NotificationManager.cc
===================================================================
--- code/branches/bugger/src/orxonox/overlays/notifications/NotificationManager.cc	(revision 2533)
+++ code/branches/bugger/src/orxonox/overlays/notifications/NotificationManager.cc	(revision 2533)
@@ -0,0 +1,171 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "NotificationManager.h"
+
+#include "core/CoreIncludes.h"
+
+#include "Notification.h"
+
+#include "NotificationQueue.h"
+
+namespace orxonox
+{
+    std::list<NotificationContainer*> NotificationManager::notifications_s;
+
+    NotificationManager::NotificationManager(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(NotificationManager);
+    }
+
+    NotificationManager::~NotificationManager()
+    {
+        //TDO: Destroy the containers
+    }
+    
+    void NotificationManager::tick(float dt)
+    {
+        bool update = false;
+    
+        for (std::list<NotificationContainer*>::iterator notification = notifications_s.begin(); notification != notifications_s.end(); ++notification)
+        {
+            NotificationContainer* container = *notification;
+            if(container->remainingTime == 0)
+            {
+                continue;
+            }
+            else if(container->remainingTime - dt <= 0)
+            {
+                container->remainingTime = 0;
+                update = true;
+            }
+            else
+            {
+                container->remainingTime = container->remainingTime -dt;
+            }
+        }
+    
+        if(update)
+            updateQueue();
+    }
+    
+    bool NotificationManager::insertNotification(Notification* notification)
+    {
+        if(notification == NULL)
+            return false;
+            
+        NotificationContainer* container = new NotificationContainer;
+        container->notification = notification;
+        container->remainingTime = notification->getDisplayTime();
+        notifications_s.push_front(container);
+        
+        updateQueue();
+        
+        COUT(4) << "Notification inserted. Title: " << notification->getTitle() << std::endl;
+        
+        return true;
+    }
+    
+    void NotificationManager::updateQueue(void)
+    {
+        std::string text = "";
+        
+        int i = NotificationQueue::queue_s->getLength();
+        for (std::list<NotificationContainer*>::iterator notification = notifications_s.begin(); notification != notifications_s.end() && i > 0; ++notification)
+        {
+            i--;
+            NotificationContainer* container = *notification;
+            if(container->remainingTime == 0.0)
+                continue;
+            
+            text = text + "\n\n\n------------\n\n" + clipMessage(container->notification->getTitle()) + "\n\n" + clipMessage(container->notification->getMessage());
+        }
+        
+        NotificationQueue::queue_s->setQueueText(text);
+    }
+    
+    const std::string NotificationManager::clipMessage(const std::string & str)
+    {
+    
+        std::string message = str;
+        unsigned int i = 0;
+        
+        unsigned int found = message.find("\\n", i);
+        while(found != std::string::npos)
+        {
+            message.replace(found, 2, "\n");
+            i = found+2;
+            found = message.find("\\n", i);
+        }
+    
+        std::string clippedMessage = "";
+        int wordLength = 0;
+        i = 0;
+        int widthLeft = NotificationQueue::queue_s->getWidth();
+        while(i < message.length())
+        {
+            while(i < message.length() && message[i] != ' ' && message[i] != '\n')
+            {
+                i++;
+                wordLength++;
+            }
+            
+            if(wordLength <= widthLeft)
+            {
+                clippedMessage = clippedMessage + message.substr(i-wordLength, wordLength);
+                if(i < message.length())
+                {
+                    clippedMessage = clippedMessage + message.substr(i,1);
+                }
+                widthLeft -= (wordLength+1);
+                if(message[i] == '\n')
+                {
+                    widthLeft = NotificationQueue::queue_s->getWidth() - (wordLength+1);
+                }
+                wordLength = 0;
+                i++;
+            }
+            else
+            {
+                clippedMessage.push_back('\n');
+                clippedMessage = clippedMessage + message.substr(i-wordLength, wordLength);
+                if(i < message.length())
+                {
+                    clippedMessage = clippedMessage + message.substr(i,1);
+                }
+                widthLeft = NotificationQueue::queue_s->getWidth() - (wordLength+1);
+                i++;
+                wordLength = 0;
+            }
+        }
+        
+        return clippedMessage;
+    }
+
+}
Index: code/branches/bugger/src/orxonox/overlays/notifications/NotificationManager.h
===================================================================
--- code/branches/bugger/src/orxonox/overlays/notifications/NotificationManager.h	(revision 2533)
+++ code/branches/bugger/src/orxonox/overlays/notifications/NotificationManager.h	(revision 2533)
@@ -0,0 +1,74 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _NotificationManager_H__
+#define _NotificationManager_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+
+#include <list>
+#include <string>
+
+namespace orxonox
+{
+    struct NotificationContainer
+    {
+        Notification* notification;
+        float remainingTime;
+    };
+
+    /**
+    @brief
+        
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport NotificationManager : public BaseObject
+    {
+    
+    public:
+        NotificationManager(BaseObject* creator);
+        virtual ~NotificationManager();
+        
+        static bool insertNotification(Notification* notification);
+        
+        static void tick(float dt);
+        
+    private:
+        static std::list<NotificationContainer*> notifications_s;
+        
+        static void updateQueue(void);
+        static const std::string clipMessage(const std::string & message);
+
+    };
+
+}
+
+#endif /* _NotificationManager_H__ */
Index: code/branches/bugger/src/orxonox/overlays/notifications/NotificationQueue.cc
===================================================================
--- code/branches/bugger/src/orxonox/overlays/notifications/NotificationQueue.cc	(revision 2533)
+++ code/branches/bugger/src/orxonox/overlays/notifications/NotificationQueue.cc	(revision 2533)
@@ -0,0 +1,110 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "NotificationQueue.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "NotificationManager.h"
+
+namespace orxonox
+{
+    NotificationQueue* NotificationQueue::queue_s = 0;
+    
+    CreateFactory(NotificationQueue);
+
+    NotificationQueue::NotificationQueue(BaseObject* creator) : OverlayText(creator)
+    {
+        RegisterObject(NotificationQueue);
+        //TDO: Does this work?
+        if(queue_s != NULL)
+        {
+                COUT(2) << "There is now more than one NotificationQueue, this shouldn't happen, since only the first NotificationQueue will be targeted by the NotificationManager." << std::endl;
+        }
+        else
+        {
+                queue_s = this;
+        }
+        
+        this->length_ = 3;
+        this->width_ = 50;
+    }
+    
+    NotificationQueue::~NotificationQueue()
+    {
+        
+    }
+    
+    void NotificationQueue::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    {
+        SUPER(NotificationQueue, XMLPort, xmlElement, mode);
+        
+        XMLPortParam(NotificationQueue, "length", setLength, getLength, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "width", setWidth, getWidth, xmlElement, mode);
+    }
+    
+    void NotificationQueue::tick(float dt)
+    {
+        NotificationManager::tick(dt);
+        
+        update();
+    }
+    
+    bool NotificationQueue::setLength(int length)
+    {
+        if(length > 0)
+        {
+            this->length_ = length;
+            return true;
+        }
+        return false;
+    }
+    
+    bool NotificationQueue::setWidth(int width)
+    {
+        if(width > 0)
+        {
+            this->width_ = width;
+            return true;
+        }
+        return false;
+    }
+    
+    void NotificationQueue::setQueueText(const std::string & text)
+    {
+        this->queueText_ = text;
+    }
+    
+    void NotificationQueue::update(void)
+    {
+        this->text_->setCaption(queueText_);
+    }
+
+}
Index: code/branches/bugger/src/orxonox/overlays/notifications/NotificationQueue.h
===================================================================
--- code/branches/bugger/src/orxonox/overlays/notifications/NotificationQueue.h	(revision 2533)
+++ code/branches/bugger/src/orxonox/overlays/notifications/NotificationQueue.h	(revision 2533)
@@ -0,0 +1,80 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _NotificationOueue_H__
+#define _NotificationOueue_H__
+
+#include "OrxonoxPrereqs.h"
+#include <OgreTextAreaOverlayElement.h>
+
+#include "orxonox/overlays/OverlayText.h"
+#include "orxonox/objects/Tickable.h"
+
+#include <string>
+
+namespace orxonox
+{
+    /**
+    @brief
+        
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport NotificationQueue : public OverlayText, public Tickable
+    {
+    public:
+        NotificationQueue(BaseObject* creator);
+        virtual ~NotificationQueue();
+        
+        static NotificationQueue* queue_s; //TDO Singleton? oder im level.
+        
+        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+        
+        virtual void tick(float dt);
+        
+        void update(void);
+        
+        int getLength(void) const
+                { return this->length_; }
+        int getWidth(void) const
+                { return this->width_; }
+        
+        void setQueueText(const std::string & text);
+        bool setLength(int length);
+        bool setWidth(int width);
+        
+    private:
+        Ogre::UTFString queueText_;
+        int length_;
+        int width_;
+    
+    };
+
+}
+
+#endif /* _NotificationOverlay_H__ */
