- Timestamp:
- Jun 19, 2006, 8:36:11 PM (18 years ago)
- Location:
- branches/network/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/message_manager.cc
r8273 r8589 319 319 { 320 320 NetworkMessage msg; 321 321 322 322 msg.data = new byte[dataLength]; 323 323 memcpy( msg.data, data, dataLength ); … … 326 326 msg.number = newNumber++; 327 327 msg.priority = messagePriority; 328 328 329 329 it->second.messages.push_back( msg ); 330 330 331 if ( recieverType == RT_ALL_ME ) 332 incomingMessabeBuffer.push_back( msg ); 333 } 334 } 335 } 336 337 331 332 } 333 } 334 335 if ( recieverType == RT_ALL_ME ) 336 { 337 NetworkMessage msg; 338 339 msg.data = new byte[dataLength]; 340 memcpy( msg.data, data, dataLength ); 341 msg.length = dataLength; 342 msg.messageId = messageId; 343 msg.number = newNumber++; 344 msg.priority = messagePriority; 345 346 incomingMessabeBuffer.push_back( msg ); 347 } 348 } 349 350 -
branches/network/src/lib/network/network_game_manager.cc
r8588 r8589 60 60 MessageManager::getInstance()->registerMessageHandler( MSGID_DELETESYNCHRONIZEABLE, delSynchronizeableHandler, NULL ); 61 61 MessageManager::getInstance()->registerMessageHandler( MSGID_PREFEREDTEAM, preferedTeamHandler, NULL ); 62 MessageManager::getInstance()->registerMessageHandler( MSGID_CHATMESSAGE, chatMessageHandler, NULL ); 62 63 63 64 this->gameState = 0; … … 300 301 301 302 rules.handleChatMessage( userId, message, messageType ); 302 303 303 304 return true; 304 305 } … … 312 313 void NetworkGameManager::sendChatMessage( const std::string & message, int messageType, int userId ) 313 314 { 314 byte * buf = new byte[message.length() ]+2*INTSIZE;315 315 byte * buf = new byte[message.length()+2*INTSIZE]; 316 316 317 assert( Converter::intToByteArray( messageType, buf, INTSIZE ) == INTSIZE ); 317 318 assert( Converter::stringToByteArray(message, buf+INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE ); 318 319 319 320 if ( userId == -1 ) 320 MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, sizeof(buf), RT_ALL_ME, 0, MP_HIGHBANDWIDTH );321 MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+2*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH ); 321 322 else 322 MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, sizeof(buf), RT_USER, userId, MP_HIGHBANDWIDTH );323 MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+2*INTSIZE, RT_USER, userId, MP_HIGHBANDWIDTH ); 323 324 324 325 delete [] buf; -
branches/network/src/lib/shell/some_shell_commands.cc
r8244 r8589 28 28 using namespace OrxShell; 29 29 30 #include "network_game_rules.h" 31 SHELL_COMMAND(say, NetworkGameRules, shellSay)->setAlias("say"); 32 30 33 #include "player_stats.h" 31 34 SHELL_COMMAND(nick, PlayerStats, shellNick)->setAlias("nick"); -
branches/network/src/util/multiplayer_team_deathmatch.h
r8588 r8589 12 12 #include "network_game_rules.h" 13 13 14 #include "glgui _box.h"14 #include "glgui.h" 15 15 16 16 class TiXmlElement; … … 81 81 82 82 OrxGui::GLGuiBox* box; 83 84 83 85 84 void calculateTeamScore(); 86 85 void nextGameState(); -
branches/network/src/util/network_game_rules.cc
r8147 r8589 17 17 18 18 #include "network_game_rules.h" 19 20 #include "network_game_manager.h" 19 21 20 22 using namespace std; … … 53 55 } 54 56 57 58 void NetworkGameRules::shellSay( const std::string & message ) 59 { 60 NetworkGameManager::getInstance()->sendChatMessage( message, 0 ); 61 } 62 63 -
branches/network/src/util/network_game_rules.h
r8588 r8589 27 27 28 28 virtual void handleChatMessage( int userId, const std::string & message, int messageType ) = 0; 29 30 void shellSay( const std::string & message ); 29 31 30 32
Note: See TracChangeset
for help on using the changeset viewer.