Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8024 in orxonox.OLD for branches/network


Ignore:
Timestamp:
May 31, 2006, 2:04:13 PM (18 years ago)
Author:
rennerc
Message:

added two missing files

Location:
branches/network/src
Files:
2 added
4 edited

Legend:

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

    r7984 r8024  
    2828enum MessageId
    2929{
    30   TESTMESSAGEID = 1
     30  TESTMESSAGEID = 1,
     31  MSGID_DELETESYNCHRONIZEABLE
    3132};
    3233
  • branches/network/src/lib/network/network_game_manager.cc

    r8014 r8024  
    5757
    5858  this->setSynchronized(true);
    59 
     59 
     60  MessageManager::getInstance()->registerMessageHandler( MSGID_DELETESYNCHRONIZEABLE, delSynchronizeableHandler, NULL );
    6061}
    6162
     
    121122
    122123
     124/**
     125 * handler for remove synchronizeable messages
     126 * @param messageId
     127 * @param data
     128 * @param dataLength
     129 * @param someData
     130 * @param userId
     131 * @return true on successfull handling else handler will be called again
     132 */
     133bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
     134{
     135  if ( getInstance()->isServer() )
     136  {
     137    PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId);
     138    return true;
     139  }
     140 
     141  int uniqueId = 0;
     142  int len = Converter::byteArrayToInt( data, &uniqueId );
     143 
     144  if ( len != dataLength )
     145  {
     146    PRINTF(2)("Recieved DeleteSynchronizeable message with incorrect size (%d) from client %d!\n", dataLength, userId);
     147    return true;
     148  }
     149 
     150  const std::list<BaseObject*> * list = ClassList::getList( CL_SYNCHRONIZEABLE );
     151 
     152  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     153  {
     154    if ( dynamic_cast<Synchronizeable*>(*it)->getUniqueID() == uniqueId )
     155    {
     156      delete dynamic_cast<Synchronizeable*>(*it);
     157      return true;
     158    }
     159  }
     160}
     161
     162/**
     163 * removes synchronizeable (also on clients)
     164 * @param uniqueId uniqueid to delete
     165 */
     166void NetworkGameManager::removeSynchronizeable( int uniqueId )
     167{
     168}
    123169
    124170
    125171
    126172
     173
  • branches/network/src/lib/network/network_game_manager.h

    r7984 r8024  
    5252
    5353
    54     bool signalNewPlayer(int userId);
    55     bool signalLeftPlayer(int userID);
     54    bool signalNewPlayer( int userId );
     55    bool signalLeftPlayer( int userID );
     56   
     57    void removeSynchronizeable( int uniqueId );
    5658
    5759
     
    5961    NetworkGameManager();
    6062   
    61     static bool youAreHandler(MessageId messageId, byte * data, int dataLength, void * someData, int userId );
     63    static bool delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
    6264
    6365    static NetworkGameManager*    singletonRef;
  • branches/network/src/util/signal_handler.cc

    r7461 r8024  
    8181  assert( pid != -1 );
    8282
     83
    8384  if ( pid == 0 )
    8485  {
    8586    getInstance()->dontCatch();
    86 
     87   
    8788    sleep(2);
    88 
    8989
    9090    return;
     
    9292  else
    9393  {
     94    getInstance()->dontCatch();
    9495    if ( getInstance()->type == GDB_RUN_WRITE_TO_FILE && fork() == 0 )
    9596    {
Note: See TracChangeset for help on using the changeset viewer.