Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 26, 2009, 9:45:23 PM (15 years ago)
Author:
dafrick
Message:

Done some documenting, and resolved some (possible) issues. So the Notifications are about finished…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationQueue.cc

    r2785 r2858  
    2727 */
    2828
     29/**
     30    @file NotificationQueue.cc
     31    @brief Implementation of the NotificationQueue class.
     32*/
     33
    2934#include "OrxonoxStableHeaders.h"
    3035#include "NotificationQueue.h"
     
    3338#include <OgreTextAreaOverlayElement.h>
    3439#include <list>
     40#include <iostream>
     41#include <sstream>
    3542
    3643#include "core/CoreIncludes.h"
     
    155162        this->clear();
    156163   
    157         std::multimap<std::time_t,Notification*>* notifications = NotificationManager::getInstance().getNotifications(this, this->displayTime_);
    158        
    159         if(notifications == NULL)
     164        std::multimap<std::time_t,Notification*>* notifications = new std::multimap<std::time_t,Notification*>;
     165        if(!NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_)) //!< Get the Notifications sent in the interval form now to minus the display time.
     166        {
     167            COUT(1) << "NotificationQueue update failed due to undetermined cause." << std::endl;
    160168            return;
    161        
    162         for(std::multimap<std::time_t,Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)
     169        }
     170       
     171        if(notifications->empty())
     172            return;
     173       
     174        for(std::multimap<std::time_t,Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++) //!> Add all Notifications.
    163175        {
    164176            this->addNotification(it->second, it->first);
    165177        }
     178       
     179        delete notifications;
    166180       
    167181        COUT(3) << "NotificationQueue updated." << std::endl;
     
    343357    }
    344358
     359    /**
     360    @brief
     361        Scrolls the NotificationQueue, meaning all NotificationOverlays are moved the input vector.
     362    @param pos
     363        The vector the NotificationQueue is scrolled.
     364    */
    345365    void NotificationQueue::scroll(const Vector2 pos)
    346366    {
     
    351371    }
    352372
    353     void NotificationQueue::positionChanged()
     373    /**
     374    @brief
     375        Aligns all the Notifications to the position of the NotificationQueue.
     376    */
     377    void NotificationQueue::positionChanged(void)
    354378    {
    355379        int counter = 0;
     
    379403        std::string timeString = std::ctime(&time);
    380404        timeString.erase(timeString.length()-1);
    381         char buffer[64]; //TDO: Very un-nice.
    382         std::sprintf(buffer,"%x",(unsigned long)notification); //TDO: Use other conversion to avoid 64bit problems.
    383         std::string addressString = buffer;
     405        std::ostringstream stream;
     406        stream << (unsigned long)notification;
     407        std::string addressString = stream.str() ;
    384408        container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
    385409       
Note: See TracChangeset for help on using the changeset viewer.