Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9532 in orxonox.OLD


Ignore:
Timestamp:
Jul 27, 2006, 10:16:34 PM (18 years ago)
Author:
patrick
Message:

the synchronizeable now got the correct id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/network_stream.cc

    r9531 r9532  
    799799      assert( offset + INTSIZE <= UDP_PACKET_SIZE );
    800800
    801       // server fakes uniqueid == 0 for handshake
     801      // server fakes uniqueid == 0 for handshake synchronizeable
    802802      if ( ( SharedNetworkData::getInstance()->isMasterServer() ||
    803803             SharedNetworkData::getInstance()->isProxyServerActive() &&  peer->second.isClient() ) &&
    804804             sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it
    805         n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
     805        n = Converter::intToByteArray( SharedNetworkData::getInstance()->getHostID()*1000, buf + offset, UDP_PACKET_SIZE - offset );
    806806      else
    807807        n = Converter::intToByteArray( sync.getUniqueID(), buf + offset, UDP_PACKET_SIZE - offset );
     
    936936      while ( offset + 2 * INTSIZE < length )
    937937      {
     938        // read the unique id of the sync
    938939        assert( offset > 0 );
    939940        assert( Converter::byteArrayToInt( buf + offset, &uniqueId ) == INTSIZE );
    940941        offset += INTSIZE;
    941942
     943        // read the data length
    942944        assert( Converter::byteArrayToInt( buf + offset, &syncDataLength ) == INTSIZE );
    943945        offset += INTSIZE;
     
    951953        for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ )
    952954        {
    953           // client thinks his handshake has id 0!!!!!
    954           if ( (*it)->getUniqueID() == uniqueId || ( uniqueId == 0 && (*it)->getUniqueID() == peer->second.userId ) )
     955          // client thinks his handshake has a special id: hostId * 1000 (host id of this server)
     956          if ( (*it)->getUniqueID() == uniqueId ||
     957                 ( uniqueId == 0  && (*it)->getUniqueID() == peer->second.userId ) )
    955958          {
    956959            sync = *it;
Note: See TracChangeset for help on using the changeset viewer.