Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 2, 2011, 10:20:45 AM (14 years ago)
Author:
dafrick
Message:

Changes in notifications module structure. Notifications can now be sent through the NotificationListener, meaning, they can be sent from anywhere within orxonox (and the modules of course).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.cc

    r8371 r8374  
    9090        this->create(); // Creates the NotificationQueue in lua.
    9191
    92         // Register the NotificationQueue as NotificationListener with the NotificationManager.
    93         bool listenerRegistered = NotificationManager::getInstance().registerListener(this);
    94         if(!listenerRegistered) // If the registration has failed.
    95         {
    96             this->registered_ = false;
    97             // Remove the NotificationQueue in lua.
    98             if(GameMode::showsGraphics())
    99                 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
    100             NotificationManager::getInstance().unregisterQueue(this);
    101             COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl;
    102             return;
    103         }
    104 
    10592        COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl;
    10693    }
     
    119106
    120107            // Unregister with the NotificationManager.
    121             NotificationManager::getInstance().unregisterListener(this);
    122108            NotificationManager::getInstance().unregisterQueue(this);
    123109        }
     
    181167        Updates the NotificationQueue.
    182168        Updates by clearing the queue and requesting all relevant Notifications from the NotificationManager and inserting them into the queue.
     169        This is called by the NotificationManager when the Notifications have changed so much, that the NotificationQueue may have to re-initialize his operations.
    183170    */
    184171    void NotificationQueue::update(void)
     
    418405            this->targets_.insert(string[i]);
    419406
     407        // TODO: Why?
    420408        if(this->registered_)
    421409        {
    422             NotificationManager::getInstance().unregisterListener(this);
    423             NotificationManager::getInstance().registerListener(this);
     410            NotificationManager::getInstance().unregisterQueue(this);
     411            NotificationManager::getInstance().registerQueue(this);
    424412        }
    425413    }
Note: See TracChangeset for help on using the changeset viewer.