Changeset 7403 for code/trunk/src/modules/notifications/Notification.cc
- 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/Notification.cc
r7401 r7403 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "network/NetworkFunction.h" 37 38 #include "NotificationManager.h" 38 39 … … 42 43 CreateUnloadableFactory(Notification); 43 44 45 registerMemberNetworkFunction(Notification, sendHelper); 46 44 47 /** 45 48 @brief 46 49 Default constructor. Initializes the object. 50 @param creator 51 The object that created this Notification 47 52 */ 48 Notification::Notification(BaseObject* creator) : BaseObject(creator) 53 Notification::Notification(BaseObject* creator) : BaseObject(creator), Synchronisable(creator) 49 54 { 50 55 RegisterObject(Notification); 51 56 this->initialize(); 57 this->registerVariables(); 52 58 } 53 59 … … 56 62 Constructor. Creates a Notification with the input message. 57 63 @param creator 58 The object that created this Notification64 The creator. 59 65 @param message 60 66 The message of the Notification. 61 67 */ 62 Notification::Notification(BaseObject* creator, const std::string & message) : BaseObject(creator) 68 Notification::Notification(BaseObject* creator, const std::string & message) : BaseObject(creator), Synchronisable(creator) 63 69 { 64 70 RegisterObject(Notification); 65 71 this->initialize(); 66 72 this->message_ = message; 73 this->registerVariables(); 67 74 } 68 75 … … 87 94 } 88 95 89 /** 90 @brief 91 Sends the Notification to the Notificationmanager, with sender NetificationManager::NONE. 92 @return 93 Returns true if successful. 94 */ 95 bool Notification::send(void) 96 void Notification::registerVariables(void) 96 97 { 97 return this->send(NotificationManager::NONE); 98 registerVariable(this->message_); 99 registerVariable(this->sender_); 100 registerVariable(this->sent_); 98 101 } 99 102 … … 106 109 Returns true if successful. 107 110 */ 108 bool Notification::send(const std::string & sender) 111 bool Notification::send(unsigned int clientId, const std::string & sender = NotificationManager::NONE) 112 { 113 114 if(GameMode::isStandalone()) 115 { 116 this->sendHelper(sender); 117 } 118 else 119 { 120 callMemberNetworkFunction(Notification, sendHelper, this->getObjectID(), clientId, sender); 121 } 122 123 return true; 124 } 125 126 bool Notification::sendHelper(const std::string& sender) 109 127 { 110 128 if(this->isSent()) //TODO: Needed? 111 129 return false; 112 130 113 131 this->sender_ = sender; 114 132 bool successful = NotificationManager::getInstance().registerNotification(this);
Note: See TracChangeset
for help on using the changeset viewer.