Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 21, 2010, 11:15:44 PM (14 years ago)
Author:
dafrick
Message:

Synchronizing Notifications.
In the course of that, notifications are not longer sent by creating a Notification and the calling notification.send() bur by letting the NotificationManager handle all this: NotificationManager::getInstance().sendNotification(message)
This made QuestNotification obsolete, thus it was removde.

Also did some work on synchronizing the Script class. It should work properly most of the time, but the current solution is unreliable and unsatisfactory. So this will change as soon as I know how.

File:
1 edited

Legend:

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

    r7463 r7474  
    4242{
    4343
    44     CreateUnloadableFactory(Notification);
    45 
    46     registerMemberNetworkFunction(Notification, send);
    47 
    4844    /**
    4945    @brief
    5046        Default constructor. Initializes the object.
    51     @param creator
    52         The object that created this Notification
    5347    */
    54     Notification::Notification(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
     48    Notification::Notification()
    5549    {
    56         RegisterObject(Notification);
     50        RegisterRootObject(Notification);
    5751        this->initialize();
    5852        this->registerVariables();
     
    6761        The message of the Notification.
    6862    */
    69     Notification::Notification(BaseObject* creator, const std::string & message) : BaseObject(creator), Synchronisable(creator)
     63    Notification::Notification(const std::string & message)
    7064    {
    71         RegisterObject(Notification);
     65        RegisterRootObject(Notification);
    7266        this->initialize();
    7367        this->message_ = message;
    74         this->registerVariables();
    7568    }
    7669
     
    9588    }
    9689
    97     void Notification::registerVariables(void)
    98     {
    99         registerVariable(this->message_);
    100         registerVariable(this->sender_);
    101         registerVariable(this->sent_);
    102     }
    103 
    10490    /**
    10591    @brief
    10692        Sends the Notification to the Notificationmanager, which then in turn distributes it to the different NotificationQueues.
    107     @param clientId
    108         The id of the client that this Notification is sent to.
    10993    @param sender
    11094        The sender the Notification was sent by. Used by the NotificationManager to distributes the notification to the correct NotificationQueues.
     
    11296        Returns true if successful.
    11397    */
    114     bool Notification::send(unsigned int clientId, const std::string & sender = NotificationManager::NONE)
    115     {
    116         COUT(0) << "MUP: " << Host::getPlayerID() << "|" << clientId << std::endl;
    117         if(GameMode::isStandalone() || Host::getPlayerID() == clientId)
    118         {
    119             this->sendHelper(sender);
    120         }
    121         else if(GameMode::isServer())
    122         {
    123             callMemberNetworkFunction(Notification, send, this->getObjectID(), clientId, clientId, sender);
    124         }
    125 
    126         return true;
    127     }
    128 
    129     bool Notification::sendHelper(const std::string& sender)
     98    bool Notification::send(const std::string & sender)
    13099    {
    131100        if(this->isSent()) //TODO: Needed?
Note: See TracChangeset for help on using the changeset viewer.