Changeset 2858 for code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationQueue.cc
- Timestamp:
- Mar 26, 2009, 9:45:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationQueue.cc
r2785 r2858 27 27 */ 28 28 29 /** 30 @file NotificationQueue.cc 31 @brief Implementation of the NotificationQueue class. 32 */ 33 29 34 #include "OrxonoxStableHeaders.h" 30 35 #include "NotificationQueue.h" … … 33 38 #include <OgreTextAreaOverlayElement.h> 34 39 #include <list> 40 #include <iostream> 41 #include <sstream> 35 42 36 43 #include "core/CoreIncludes.h" … … 155 162 this->clear(); 156 163 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; 160 168 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. 163 175 { 164 176 this->addNotification(it->second, it->first); 165 177 } 178 179 delete notifications; 166 180 167 181 COUT(3) << "NotificationQueue updated." << std::endl; … … 343 357 } 344 358 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 */ 345 365 void NotificationQueue::scroll(const Vector2 pos) 346 366 { … … 351 371 } 352 372 353 void NotificationQueue::positionChanged() 373 /** 374 @brief 375 Aligns all the Notifications to the position of the NotificationQueue. 376 */ 377 void NotificationQueue::positionChanged(void) 354 378 { 355 379 int counter = 0; … … 379 403 std::string timeString = std::ctime(&time); 380 404 timeString.erase(timeString.length()-1); 381 char buffer[64]; //TDO: Very un-nice.382 st d::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() ; 384 408 container->name = "NotificationOverlay(" + timeString + ")&" + addressString; 385 409
Note: See TracChangeset
for help on using the changeset viewer.