Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 24, 2010, 12:01:57 PM (14 years ago)
Author:
dafrick
Message:

Some more documentation.
Making NotificationManager Root scope, cleaning up, especially in Notification (now it's just a data structure anymore).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/notifications/NotificationManager.cc

    r7486 r7488  
    5858    DeclareToluaInterface(Notifications);
    5959
    60     ManageScopedSingleton(NotificationManager, ScopeID::Graphics, false);
     60    ManageScopedSingleton(NotificationManager, ScopeID::Root, false);
    6161
    6262    // Setting console command to enter the edit mode.
     
    8888        ModifyConsoleCommand("enterEditMode").setObject(NULL);
    8989
     90        // Destroys all Notifications.
     91        for(std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it!= this->allNotificationsList_.end(); it++)
     92            it->second->destroy();
     93        this->allNotificationsList_.clear();
     94
    9095        COUT(3) << "NotificationManager destroyed." << std::endl;
    9196    }
     
    98103    {
    99104        // Destroys all NotificationQueues that have been registered with the NotificationManager.
    100         for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); )
    101         {
    102             NotificationQueue* queue = (*it).second;
    103             it++;
    104             queue->destroy();
     105        for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++)
     106        {
     107            it->second->destroy(true);
    105108        }
    106109        this->queues_.clear();
     
    124127        if(GameMode::isStandalone() || isLocal || Host::getPlayerID() == clientId)
    125128        {
    126             Notification* notification = new Notification(message);
    127             notification->send(sender);
     129            Notification* notification = new Notification(message, sender);
     130            if(NotificationManager::getInstance().registerNotification(notification))
     131                COUT(3) << "Notification \"" << notification->getMessage() << "\" sent." << std::endl;
    128132        }
    129133        // If we're on the server (and the server is not the intended recipient of the Notification) we send it over the network.
Note: See TracChangeset for help on using the changeset viewer.