Changeset 9521 in orxonox.OLD for branches/proxy/src/lib
- Timestamp:
- Jul 27, 2006, 7:51:06 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/message_manager.cc
r9520 r9521 229 229 // call the handler function and handle errors 230 230 if ( !(*(messageHandlerMap[(MessageType)messageType].cb))( (MessageType)messageType, data + i, messageLength, 231 messageHandlerMap[(MessageType)messageType].someData, userId ) )231 messageHandlerMap[(MessageType)messageType].someData, senderId, destinationId ) ) 232 232 { 233 233 // if the message is not handled correctly, bush it back to the incoming packets … … 255 255 for ( std::list<NetworkMessage>::iterator it = incomingMessageQueue.begin(); it != incomingMessageQueue.end(); ) 256 256 { 257 if ( (*(messageHandlerMap[it->messageType].cb))( it->messageType, it->data, it->length, messageHandlerMap[it->messageType].someData, it->number ) ) 257 if ( (*(messageHandlerMap[it->messageType].cb))( it->messageType, it->data, it->length, messageHandlerMap[it->messageType].someData, 258 /*it->number, */it->senderId, it->destinationId ) ) 258 259 { 259 260 std::list<NetworkMessage>::iterator delIt = it; -
branches/proxy/src/lib/network/message_manager.h
r9519 r9521 40 40 41 41 42 typedef bool (*MessageCallback)( MessageType messageType, byte * data, int dataLength, void * someData, int userId );42 typedef bool (*MessageCallback)( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); 43 43 44 44 enum RecieverType -
branches/proxy/src/lib/network/network_game_manager.cc
r9508 r9521 166 166 * @return true on successfull handling else handler will be called again 167 167 */ 168 bool NetworkGameManager::delSynchronizeableHandler( MessageType messageType, byte * data, int dataLength, void * someData, int userId)168 bool NetworkGameManager::delSynchronizeableHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ) 169 169 { 170 170 … … 172 172 173 173 if ( SharedNetworkData::getInstance()->isMasterServer() || 174 SharedNetworkData::getInstance()->isProxyServerActive() && SharedNetworkData::getInstance()->isUserClient( userId))175 { 176 PRINTF(0)("Recieved DeleteSynchronizeable message from client %d!\n", userId);174 SharedNetworkData::getInstance()->isProxyServerActive() && SharedNetworkData::getInstance()->isUserClient(senderId)) 175 { 176 PRINTF(0)("Recieved DeleteSynchronizeable message from client %d!\n", senderId); 177 177 return true; 178 178 } … … 183 183 if ( len != dataLength ) 184 184 { 185 PRINTF(2)("Recieved DeleteSynchronizeable message with incorrect size (%d) from client %d!\n", dataLength, userId);185 PRINTF(2)("Recieved DeleteSynchronizeable message with incorrect size (%d) from client %d!\n", dataLength, senderId); 186 186 return true; 187 187 } … … 231 231 * @return 232 232 */ 233 bool NetworkGameManager::preferedTeamHandler( MessageType messageType, byte * data, int dataLength, void * someData, int userId)233 bool NetworkGameManager::preferedTeamHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ) 234 234 { 235 235 assert( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/); … … 240 240 if ( len != dataLength ) 241 241 { 242 PRINTF(2)("Recieved DeleteSynchronizeable message with incorrect size (%d) from client %d!\n", dataLength, userId);242 PRINTF(2)("Recieved DeleteSynchronizeable message with incorrect size (%d) from client %d!\n", dataLength, senderId); 243 243 return true; 244 244 } 245 245 246 NetworkGameManager::getInstance()->setPreferedTeam( userId, teamId );246 NetworkGameManager::getInstance()->setPreferedTeam( senderId, teamId ); 247 247 248 248 return true; … … 314 314 315 315 316 bool NetworkGameManager::chatMessageHandler( MessageType messageType, byte * data, int dataLength, void * someData, int userId)317 { 318 PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() );319 if ( (SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) && userId != SharedNetworkData::getInstance()->getHostID() )316 bool NetworkGameManager::chatMessageHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ) 317 { 318 PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", senderId, SharedNetworkData::getInstance()->getHostID() ); 319 if ( (SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) && senderId != SharedNetworkData::getInstance()->getHostID() ) 320 320 { 321 321 MessageManager::getInstance()->sendMessage( messageType, data, dataLength, RT_ALL_BUT_ME, 0, MP_HIGHBANDWIDTH ); … … 329 329 if ( dataLength < 3*INTSIZE ) 330 330 { 331 PRINTF(2)("got too small chatmessage from client %d\n", userId);331 PRINTF(2)("got too small chatmessage from client %d\n", senderId); 332 332 333 333 return true; -
branches/proxy/src/lib/network/network_game_manager.h
r9508 r9521 70 70 NetworkGameManager(); 71 71 72 static bool delSynchronizeableHandler( MessageType messageType, byte * data, int dataLength, void * someData, int userId);73 static bool preferedTeamHandler( MessageType messageType, byte * data, int dataLength, void * someData, int userId);74 static bool chatMessageHandler( MessageType messageType, byte * data, int dataLength, void * someData, int userId);72 static bool delSynchronizeableHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); 73 static bool preferedTeamHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); 74 static bool chatMessageHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); 75 75 76 76 void setPreferedTeam( int userId, int teamId ); -
branches/proxy/src/lib/network/player_stats.cc
r9508 r9521 212 212 } 213 213 214 bool PlayerStats::changeNickHandler( MessageType messageType, byte * data, int dataLength, void * someData, int userId)214 bool PlayerStats::changeNickHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ) 215 215 { 216 216 std::string newNick; … … 219 219 if ( res != dataLength ) 220 220 { 221 PRINTF(2)("invalid message size from user %d\n", userId);221 PRINTF(2)("invalid message size from user %d\n", senderId); 222 222 newNick = "invalid"; 223 223 } 224 224 225 if ( PlayerStats::getStats( userId) )226 PlayerStats::getStats( userId )->setNickName( newNick );225 if ( PlayerStats::getStats( senderId) ) 226 PlayerStats::getStats( senderId )->setNickName( newNick ); 227 227 228 228 return true; -
branches/proxy/src/lib/network/player_stats.h
r9508 r9521 66 66 inline std::string getNickName(){ return this->nickName; } 67 67 void setNickName( std::string nick ); 68 static bool changeNickHandler( MessageType messageType, byte * data, int dataLength, void * someData, int userId);68 static bool changeNickHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); 69 69 void shellNick( const std::string& newNick ); 70 70
Note: See TracChangeset
for help on using the changeset viewer.