Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 31, 2011, 9:09:23 PM (14 years ago)
Author:
landauf
Message:

Replaced COUT with orxout in network library. Tried to set levels and contexts in a more or less useful way, but not really optimized. Used contexts network, packets, and master_server.
Please use endl instead of \n in the future (@smerkli) ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/network/Server.cc

    r8788 r8807  
    114114  {
    115115    Host::setActive(true);
    116     COUT(4) << "opening server" << endl;
     116    orxout(verbose, context::network) << "opening server" << endl;
    117117    this->openListener();
    118118   
     
    137137  {
    138138    Host::setActive(false);
    139     COUT(4) << "closing server" << endl;
     139    orxout(verbose, context::network) << "closing server" << endl;
    140140    this->disconnectClients();
    141141    this->closeListener();
    142142
    143143    /* tell master server we're closing */
    144     COUT(2) << "disconnecting." << endl;
     144    orxout(internal_info, context::network) << "disconnecting." << endl;
    145145    WANDiscoverable::setActivity(false);   
    146     COUT(2) << "disconnecting done" << endl;
     146    orxout(internal_info, context::network) << "disconnecting done" << endl;
    147147
    148148    LANDiscoverable::setActivity(false);
     
    158158    chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
    159159    chat->send( static_cast<Host*>(this) );
    160 //         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
     160//         orxout(internal_warning, context::network) << "could not send Chat message to client ID: " << temp->getID() << endl;
    161161//       temp = temp->next();
    162162//     }
    163 //    COUT(1) << "Player " << playerID << ": " << message << std::endl;
     163//    orxout(message) << "Player " << playerID << ": " << message << endl;
    164164    return true;
    165165  }
     
    246246  {
    247247//     for( ClientInformation* temp=ClientInformation::getBegin(); temp!=0; temp=temp->next() )
    248 //       COUT(0) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
     248//       orxout(message) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
    249249  }
    250250
     
    268268      return;
    269269    GamestateManager::update();
    270 //     COUT(5) << "Server: one gamestate update complete, goig to sendGameState" << std::endl;
    271     //std::cout << "updated gamestate, sending it" << std::endl;
     270//     orxout(verbose_more, context::network) << "Server: one gamestate update complete, goig to sendGameState" << endl;
     271    //orxout(verbose_more, context::network) << "updated gamestate, sending it" << endl;
    272272    //if(clients->getGamestateID()!=GAMESTATEID_INITIAL)
    273273    sendGameStates();
    274274    sendObjectDeletes();
    275 //     COUT(5) << "Server: one sendGameState turn complete, repeat in next tick" << std::endl;
    276     //std::cout << "sent gamestate" << std::endl;
     275//     orxout(verbose_more, context::network) << "Server: one sendGameState turn complete, repeat in next tick" << endl;
     276    //orxout(verbose_more, context::network) << "sent gamestate" << endl;
    277277  }
    278278
     
    305305      return true;  //everything ok (no deletes this tick)
    306306    }
    307 //     COUT(3) << "sending DeleteObjects" << std::endl;
     307//     orxout(verbose, context::network) << "sending DeleteObjects" << endl;
    308308//     while(temp != NULL){
    309309//       if( !(temp->getSynched()) )
    310310//       {
    311 //         COUT(5) << "Server: not sending gamestate" << std::endl;
     311//         orxout(verbose_more, context::network) << "Server: not sending gamestate" << endl;
    312312//         temp=temp->next();
    313313//         continue;
     
    318318    del->setPeerID(NETWORK_PEER_ID_BROADCAST);
    319319    if ( !del->send( static_cast<Host*>(this) ) )
    320       COUT(3) << "Server: could not broadcast deleteObjects packet" << std::endl;
     320      orxout(internal_warning, context::network) << "Server: could not broadcast deleteObjects packet" << endl;
    321321//       temp=temp->next();
    322322      // gs gets automatically deleted by enet callback
     
    331331//     static unsigned int newid=1;
    332332//
    333 //     COUT(2) << "Server: adding client" << std::endl;
     333//     orxout(internal_info, context::network) << "Server: adding client" << endl;
    334334//     ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
    335335//     if(!temp)
    336336//     {
    337 //       COUT(2) << "Server: could not add client" << std::endl;
     337//       orxout(internal_warning, context::network) << "Server: could not add client" << endl;
    338338//     }
    339339//     temp->setID(newid);
     
    347347//     ++newid;
    348348
    349     COUT(3) << "Server: added client id: " << peerID << std::endl;
     349    orxout(internal_info, context::network) << "Server: added client id: " << peerID << endl;
    350350    createClient(peerID);
    351351}
     
    353353  void Server::removePeer(uint32_t peerID)
    354354  {
    355     COUT(4) << "removing client from list" << std::endl;
     355    orxout(verbose, context::network) << "removing client from list" << endl;
    356356//     ClientInformation *client = ClientInformation::findClient(&event->peer->address);
    357357//     if(!client)
     
    395395//     if(!temp)
    396396//     {
    397 //       COUT(2) << "Server. could not create client with id: " << clientID << std::endl;
     397//       orxout(internal_error, context::network) << "Server. could not create client with id: " << clientID << endl;
    398398//       return false;
    399399//     }
    400 //     COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
     400//     orxout(verbose, context::network) << "Con.Man: creating client id: " << temp->getID() << endl;
    401401
    402402    // synchronise class ids
     
    412412    GamestateManager::setSynched(clientID);
    413413   
    414     COUT(4) << "sending welcome" << std::endl;
     414    orxout(verbose, context::network) << "sending welcome" << endl;
    415415    packet::Welcome *w = new packet::Welcome(clientID);
    416416    w->setPeerID(clientID);
     
    457457      chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
    458458      chat->send( static_cast<Host*>(this) );
    459 //         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
     459//         orxout(internal_warning, context::network) << "could not send Chat message to client ID: " << temp->getID() << endl;
    460460//       temp = temp->next();
    461461    }
    462 //    COUT(1) << "Player " << Host::getPlayerID() << ": " << message << std::endl;
     462//    orxout(message) << "Player " << Host::getPlayerID() << ": " << message << endl;
    463463    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    464464      it->incomingChat(message, clientID);
     
    476476    }
    477477    assert(failures<10);
    478     COUT(4) << "syncClassid:\tall synchClassID packets have been sent" << std::endl;
     478    orxout(verbose, context::network) << "syncClassid:\tall synchClassID packets have been sent" << endl;
    479479  }
    480480
Note: See TracChangeset for help on using the changeset viewer.