Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9059 in orxonox.OLD for trunk/src/lib/network


Ignore:
Timestamp:
Jul 3, 2006, 6:30:42 PM (18 years ago)
Author:
patrick
Message:

merged the network branche with the trunk

Location:
trunk/src/lib/network
Files:
5 edited

Legend:

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

    r8708 r9059  
    5858 
    5959  messageQueue.clear();
     60 
     61  this->messageHandlerMap.clear();
     62 
     63  MessageManager::singletonRef = NULL;
    6064}
    6165
  • trunk/src/lib/network/network_game_manager.cc

    r9008 r9059  
    7777 
    7878  PlayerStats::deleteAllPlayerStats();
     79 
     80  NetworkGameManager::singletonRef = NULL;
    7981}
    8082
     
    274276    if ( State::getPlayer()->getPlayable() != *it )
    275277    {
    276       PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassName(), (*it)->getOwner() );
    277       std::list<Playable*>::iterator delit = it;
    278       it++;
    279       delete *delit;
    280       playablesToDelete.erase( delit );
    281       continue;
     278      const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
     279       
     280      if ( list && std::find( list->begin(), list->end(), *it ) != list->end() )
     281      {     
     282        PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassName(), (*it)->getOwner() );
     283        std::list<Playable*>::iterator delit = it;
     284        it++;
     285        delete *delit;
     286        playablesToDelete.erase( delit );
     287        continue;
     288      }
    282289    }
    283290    it++;
  • trunk/src/lib/network/network_manager.cc

    r8708 r9059  
    5252  /* initialize the references */
    5353  this->networkStream = NULL;
    54   this->sharedNetworkData = SharedNetworkData::getInstance();
    5554  this->elapsedTime = 0.0f;
    5655 
     
    7069NetworkManager::~NetworkManager()
    7170{
     71  PRINTF(0)("NetworkManager destructor\n");
    7272  if ( this->networkStream )
    7373  {
     
    7575    this->networkStream = NULL;
    7676  }
     77 
     78  NetworkManager::singletonRef = NULL;
    7779}
    7880
     
    103105{
    104106  this->networkStream = new NetworkStream( name, port );
    105   this->sharedNetworkData->setDefaultSyncStream(this->networkStream);
     107  SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream);
    106108  this->networkStream->startHandshake();
    107109  return 1;
     
    115117int NetworkManager::createServer(unsigned int port)
    116118{
    117   this->sharedNetworkData->setHostID(0);
    118   this->sharedNetworkData->setGameServer(true);
     119  SharedNetworkData::getInstance()->setHostID(0);
     120  SharedNetworkData::getInstance()->setGameServer(true);
    119121  this->networkStream = new NetworkStream(port);
    120   this->sharedNetworkData->setDefaultSyncStream(this->networkStream);
     122  SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream);
    121123  this->networkStream->createNetworkGameManager();
    122124  PRINTF(0)("CREATE SERVER\n");
     
    144146  this->elapsedTime = 0.0f;
    145147
    146 //  if ( networkStream->isActive() )
     148  if ( networkStream )
    147149    networkStream->processData();
    148150 
  • trunk/src/lib/network/network_manager.h

    r8228 r9059  
    4040
    4141    /** Returns the hostID @return The hostID of the object */
    42     inline int getHostID() { return this->sharedNetworkData->getHostID(); }
    43     inline bool isGameServer() { return this->sharedNetworkData->isGameServer(); }
     42    inline int getHostID() { return SharedNetworkData::getInstance()->getHostID(); }
     43    inline bool isGameServer() { return SharedNetworkData::getInstance()->isGameServer(); }
    4444
    4545
     
    5858    NetworkStream*                   networkStream;       //!< pointer to network stream
    5959
    60     SharedNetworkData*               sharedNetworkData;       //!< reference to the shared data
    6160    float                            elapsedTime;             //!< elapsed time since the last network update
    6261};
  • trunk/src/lib/network/network_stream.cc

    r8623 r9059  
    111111    serverSocket = NULL;
    112112  }
    113 
    114113  for ( PeerList::iterator i = peers.begin(); i!=peers.end(); i++)
    115114  {
     
    133132    }
    134133  }
    135  
    136134  for ( SynchronizeableList::const_iterator it = getSyncBegin(); it != getSyncEnd(); it ++ )
    137135    (*it)->setNetworkStream( NULL );
Note: See TracChangeset for help on using the changeset viewer.