Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6659 in orxonox.OLD for branches/network


Ignore:
Timestamp:
Jan 23, 2006, 3:15:07 PM (19 years ago)
Author:
patrick
Message:

network: the Synchronizeables now all get connected

Location:
branches/network/src/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/coord/p_node.cc

    r6634 r6659  
    4242 */
    4343PNode::PNode (PNode* parent, long nodeFlags)
     44  : Synchronizeable(), BaseObject()
    4445{
    4546  this->setClassID(CL_PARENT_NODE, "PNode");
  • branches/network/src/lib/network/network_manager.cc

    r6658 r6659  
    114114  this->bGameServer = true;
    115115  this->defaultSyncStream = new NetworkStream(port);
     116  this->defaultSyncStream->createNetworkGameManager();
    116117  PRINTF(0)("CREATE SERVER\n");
    117118  this->bGameServer = true;
  • branches/network/src/lib/network/network_stream.cc

    r6658 r6659  
    8181  this->handshakes.push_back( NULL );
    8282  this->bActive = true;
    83   this->networkGameManager = NetworkGameManager::getInstance();
    84   // setUniqueID( maxCon+2 ) because we need one id for every handshake
    85   // and one for handshake to reject client maxCon+1
    86   this->networkGameManager->setUniqueID( this->maxConnections + 2 );
    87   this->connectSynchronizeable( *(this->networkGameManager) );
    88 
    89   this->setMaxConnections( 10 );
    9083}
    9184
     
    129122  delete connectionMonitor;
    130123  delete networkProtocol;
     124}
     125
     126
     127void NetworkStream::createNetworkGameManager()
     128{
     129  this->networkGameManager = NetworkGameManager::getInstance();
     130  // setUniqueID( maxCon+2 ) because we need one id for every handshake
     131  // and one for handshake to reject client maxCon+1
     132  this->networkGameManager->setUniqueID( this->maxConnections + 2 );
     133  this->connectSynchronizeable( *(this->networkGameManager) );
     134  this->setMaxConnections( 10 );
    131135}
    132136
     
    425429  PRINT(0)(" Host ID: %i\n", this->myHostId);
    426430
    427   PRINT(0)(" Connected Synchronizeables:\n");
     431  PRINT(0)(" Got %i connected Synchronizeables:\n", this->synchronizeables.size());
    428432  for (SynchronizeableList::iterator it = synchronizeables.begin(); it!=synchronizeables.end(); it++)
    429433  {
    430     PRINT(0)("  Synchronizeable of class: %s::%s, with unique ID: %i\n", (*it)->getClassName(), (*it)->getName(), (*it)->getUniqueID());
     434    PRINT(0)("  Synchronizeable of class: %s::%s, with unique ID: %i, Synchronize: %i\n", (*it)->getClassName(), (*it)->getName(), (*it)->getUniqueID(), (*it)->beSynchronized());
    431435  }
    432436
  • branches/network/src/lib/network/network_stream.h

    r6658 r6659  
    3939    ~NetworkStream();
    4040    void init();
     41
     42    void createNetworkGameManager();
    4143
    4244    void connectSynchronizeable(Synchronizeable& sync);
  • branches/network/src/lib/network/synchronizeable.cc

    r6658 r6659  
    4343
    4444  this->bSynchronize = false;
    45   NetworkStream* nd;
    46   if( this->isA(CL_NETWORK_GAME_MANAGER))
    47   {
    48     nd = NetworkGameManager::getInstance()->getNetworkStream();
    49     assert(nd != NULL);
    50     nd->connectSynchronizeable(*this);
    51   }
     45  NetworkStream* nd = NetworkManager::getInstance()->getDefaultSyncStream();
     46  assert(nd != NULL);
     47  nd->connectSynchronizeable(*this);
    5248}
    5349
  • branches/network/src/lib/network/synchronizeable.h

    r6658 r6659  
    167167  public:
    168168    Synchronizeable();
    169     ~Synchronizeable();
     169    virtual ~Synchronizeable();
    170170
    171171    virtual int       writeBytes(const byte* data, int length, int sender);
Note: See TracChangeset for help on using the changeset viewer.