Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8589 in orxonox.OLD


Ignore:
Timestamp:
Jun 19, 2006, 8:36:11 PM (18 years ago)
Author:
rennerc
Message:

chat works now

Location:
branches/network/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/message_manager.cc

    r8273 r8589  
    319319    {
    320320      NetworkMessage msg;
    321      
     321
    322322      msg.data = new byte[dataLength];
    323323      memcpy( msg.data, data, dataLength );
     
    326326      msg.number = newNumber++;
    327327      msg.priority = messagePriority;
    328      
     328
    329329      it->second.messages.push_back( msg );
    330330     
    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  
    6060  MessageManager::getInstance()->registerMessageHandler( MSGID_DELETESYNCHRONIZEABLE, delSynchronizeableHandler, NULL );
    6161  MessageManager::getInstance()->registerMessageHandler( MSGID_PREFEREDTEAM, preferedTeamHandler, NULL );
     62  MessageManager::getInstance()->registerMessageHandler( MSGID_CHATMESSAGE, chatMessageHandler, NULL );
    6263 
    6364  this->gameState = 0;
     
    300301 
    301302  rules.handleChatMessage( userId, message, messageType );
    302  
     303
    303304  return true;
    304305}
     
    312313void NetworkGameManager::sendChatMessage( const std::string & message, int messageType, int userId )
    313314{
    314   byte * buf = new byte[message.length()]+2*INTSIZE;
    315  
     315  byte * buf = new byte[message.length()+2*INTSIZE];
     316
    316317  assert( Converter::intToByteArray( messageType, buf, INTSIZE ) == INTSIZE );
    317318  assert( Converter::stringToByteArray(message, buf+INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE );
    318319 
    319320  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 );
    321322  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 );
    323324 
    324325  delete [] buf;
  • branches/network/src/lib/shell/some_shell_commands.cc

    r8244 r8589  
    2828using namespace OrxShell;
    2929
     30#include "network_game_rules.h"
     31  SHELL_COMMAND(say, NetworkGameRules, shellSay)->setAlias("say");
     32
    3033#include "player_stats.h"
    3134  SHELL_COMMAND(nick, PlayerStats, shellNick)->setAlias("nick");
  • branches/network/src/util/multiplayer_team_deathmatch.h

    r8588 r8589  
    1212#include "network_game_rules.h"
    1313
    14 #include "glgui_box.h"
     14#include "glgui.h"
    1515
    1616class TiXmlElement;
     
    8181
    8282    OrxGui::GLGuiBox* box;
    83 
    84 
     83   
    8584    void calculateTeamScore();
    8685    void nextGameState();
  • branches/network/src/util/network_game_rules.cc

    r8147 r8589  
    1717
    1818#include "network_game_rules.h"
     19
     20#include "network_game_manager.h"
    1921
    2022using namespace std;
     
    5355}
    5456
     57
     58void 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  
    2727   
    2828    virtual void handleChatMessage( int userId, const std::string & message, int messageType ) = 0;
     29   
     30    void shellSay( const std::string & message );
    2931
    3032
Note: See TracChangeset for help on using the changeset viewer.