- Timestamp:
- Sep 11, 2010, 10:20:44 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/notifications (added) merged: 7319,7324,7326,7338-7343,7348-7349,7351,7354-7355,7358-7360,7362,7395,7398-7400
- Property svn:mergeinfo changed
-
code/trunk/src/modules/notifications/NotificationDispatcher.cc
r7285 r7403 39 39 #include "Notification.h" 40 40 #include "NotificationManager.h" 41 #include "interfaces/PlayerTrigger.h" 42 #include "infos/PlayerInfo.h" 43 #include "worldentities/pawns/Pawn.h" 41 44 42 45 namespace orxonox … … 86 89 @brief 87 90 Dispatches a Notification with a message supplied by the createNotificationMessage() method, which can be overloaded. 91 @param clientId 92 The id of the client the notification should be dispatched to. 88 93 */ 89 void NotificationDispatcher::dispatch( void)94 void NotificationDispatcher::dispatch(unsigned int clientId) 90 95 { 91 96 const std::string message = this->createNotificationMessage(); 92 97 Notification* notification = new Notification(this, message); 93 98 94 notification->send( this->getSender());99 notification->send(clientId, this->getSender()); 95 100 } 96 101 … … 103 108 Returns true if the NotificationDispatcher was successfully triggered. 104 109 */ 105 bool NotificationDispatcher::trigger(bool triggered )110 bool NotificationDispatcher::trigger(bool triggered, BaseObject* trigger) 106 111 { 107 112 if(!triggered || !this->isActive()) // If the NotificationDispatcher is inactive it cannot be executed. … … 110 115 COUT(4) << "NotificationDispatcher (&" << this << ") triggered." << std::endl; 111 116 112 this->dispatch(); 117 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 118 Pawn* pawn = NULL; 119 120 // If the trigger is a PlayerTrigger. 121 if(pTrigger != NULL) 122 { 123 if(!pTrigger->isForPlayer()) //!< The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. 124 return false; 125 else 126 pawn = pTrigger->getTriggeringPlayer(); 127 } 128 else 129 return false; 130 131 if(pawn == NULL) 132 { 133 COUT(4) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl; 134 return false; 135 } 136 137 //! Extract the PlayerInfo from the Pawn. 138 PlayerInfo* player = pawn->getPlayer(); 139 140 if(player == NULL) 141 { 142 COUT(3) << "The PlayerInfo* is NULL." << std::endl; 143 return false; 144 } 145 146 this->dispatch(player->getClientID()); 113 147 114 148 return true;
Note: See TracChangeset
for help on using the changeset viewer.