Changeset 8822 for code/branches/output/src/libraries/network
- Timestamp:
- Aug 4, 2011, 12:45:06 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/output/src/libraries/network/Host.cc
r8408 r8822 91 91 void Host::Chat(const std::string& message) 92 92 { 93 if(instances_s.size()==0) 93 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 94 it->incomingChat(message, 0); 95 96 bool result = true; 97 for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it ) 94 98 { 95 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 96 it->incomingChat(message, 0); 97 // return true; 99 if( (*it)->isActive() ) 100 { 101 if( !(*it)->chat(message) ) 102 result = false; 103 } 98 104 } 99 else 100 { 101 bool result = true; 102 for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it ) 103 { 104 if( (*it)->isActive() ) 105 { 106 if( !(*it)->chat(message) ) 107 result = false; 108 } 109 } 110 // return result; 111 } 105 // return result; 112 106 } 113 107 114 108 bool Host::Broadcast(const std::string& message) 115 109 { 116 if(instances_s.size()==0) 110 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 111 it->incomingChat(message, NETWORK_PEER_ID_BROADCAST); 112 113 bool result = true; 114 for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it ) 117 115 { 118 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 119 it->incomingChat(message, NETWORK_PEER_ID_BROADCAST); 120 return true; 116 if( (*it)->isActive() ) 117 { 118 if( !(*it)->broadcast(message) ) 119 result = false; 120 } 121 121 } 122 else 123 { 124 bool result = true; 125 for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it ) 126 { 127 if( (*it)->isActive() ) 128 { 129 if( !(*it)->broadcast(message) ) 130 result = false; 131 } 132 } 133 return result; 134 } 122 return result; 135 123 } 136 124 … … 161 149 return false; 162 150 } 163 151 164 152 Host* Host::getActiveInstance() 165 153 {
Note: See TracChangeset
for help on using the changeset viewer.