Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 28, 2008, 5:30:11 AM (16 years ago)
Author:
landauf
Message:

merged console branch into network branch

after several heavy troubles it compiles, but there is still a bug I couldn't fix: orxonox crashes as soon as one presses a key after opening the console… maybe someone else sees the problem?

Location:
code/branches/network/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/GameStateClient.cc

    r1432 r1446  
    4242    int id;
    4343  };
    44  
     44
    4545  GameStateClient::GameStateClient() {
    4646    COUT(5) << "this: " << this << std::endl;
     
    9696    return false;
    9797  }
    98  
     98
    9999  GameStateCompressed *GameStateClient::popPartialGameState(){
    100100    GameState *gs = getPartialSnapshot();
     
    104104    return cgs;
    105105  }
    106  
     106
    107107  void GameStateClient::addGameState(GameStateCompressed *gs){
    108108    if(tempGameState_!=NULL){
     
    128128      return GAMESTATEID_INITIAL;
    129129  }
    130  
     130
    131131
    132132  /**
     
    193193          }
    194194          if( !no->create() )
     195          {
    195196            COUT(1) << "We couldn't manifest (create() ) the object: " << sync.objectID << std::endl;
     197          }
    196198          it=orxonox::ObjectList<Synchronisable>::end();
    197199        }
     
    199201        // we have our object
    200202        if(! it->updateData(sync))
     203        {
    201204          COUT(1) << "We couldn't update objectID: " \
    202205          << sync.objectID << "; classID: " << sync.classID << std::endl;
     206        }
    203207      }
    204208      ++it;
     
    272276    return retval;
    273277  }
    274  
    275  
     278
     279
    276280  GameState *GameStateClient::undiff(GameState *old, GameState *diff) {
    277281    if(!old || !diff)
     
    334338    switch ( retval ) {
    335339      case Z_OK: COUT(5) << "G.St.Cl: compress: successfully compressed" << std::endl; break;
    336       case Z_MEM_ERROR: COUT(1) << "G.St.Cl: compress: not enough memory available in gamestate.compress" << std::endl; 
     340      case Z_MEM_ERROR: COUT(1) << "G.St.Cl: compress: not enough memory available in gamestate.compress" << std::endl;
    337341      return NULL;
    338342      case Z_BUF_ERROR: COUT(2) << "G.St.Cl: compress: not enough memory available in the buffer in gamestate.compress" << std::endl;
     
    352356    return compressedGamestate;
    353357  }
    354  
    355  
     358
     359
    356360  GameState *GameStateClient::decompress(GameStateCompressed *a) {
    357361    //COUT(4) << "GameStateClient: uncompressing gamestate. id: " << a->id << ", baseid: " << a->base_id << ", normsize: " << a->normsize << ", compsize: " << a->compsize << std::endl;
     
    409413    return t;
    410414  }
    411  
     415
    412416  void GameStateClient::cleanup(){
    413417    std::map<int, GameState*>::iterator temp, it = gameStateMap.begin();
     
    431435    }
    432436    COUT(4) << std::endl;
    433    
    434   }
    435  
     437
     438  }
     439
    436440  bool GameStateClient::saveShipCache(){
    437441    if(myShip_==NULL)
     
    448452      return false;
    449453  }
    450  
     454
    451455  bool GameStateClient::loadShipCache(){
    452456    if(myShip_){
     
    459463      return false;
    460464  }
    461  
     465
    462466    //##### ADDED FOR TESTING PURPOSE #####
    463467  GameState* GameStateClient::testDecompress( GameStateCompressed* gc ) {
    464468    return decompress( gc );
    465469  }
    466  
     470
    467471  GameState* GameStateClient::testUndiff( GameState* g_old, GameState* g_diffed ) {
    468472    return undiff( g_old, g_diffed );
    469473  }
    470474  //##### ADDED FOR TESTING PURPOSE #####
    471  
    472  
     475
     476
    473477}
    474478
  • code/branches/network/src/network/PacketDecoder.cc

    r1440 r1446  
    8484    return false;
    8585  }
    86  
     86
    8787  bool PacketDecoder::testAndRemoveCRC(ENetPacket *packet){
    8888    uint32_t submittetcrc;
     
    102102    return false;
    103103  }
    104  
     104
    105105  // ATTENTION: TODO watch, that arguments we pass over to the processFunction gets deleted in THE PROCESSXXX function
    106106
     
    118118    enet_packet_destroy( packet );
    119119  }
    120  
     120
    121121  bool PacketDecoder::command( ENetPacket* packet, int clientId ){
    122122    int length = *(int*)((unsigned char *)packet->data+sizeof(int));
     
    175175    //since data is not allocated, because it's just a pointer, allocate it with size of gamestatedatastream
    176176    if(currentState->compsize==0)
     177    {
    177178      COUT(2) << "PacketDecoder: compsize is 0" << std::endl;
     179    }
    178180//     currentState->data = (unsigned char*)(malloc( currentState->compsize ));
    179181    if(currentState->compsize==0)
     
    181183    currentState->data = new unsigned char[currentState->compsize];
    182184    if(currentState->data==NULL)
     185    {
    183186      COUT(2) << "PacketDecoder: Gamestatepacket-decoder: memory leak" << std::endl;
     187    }
    184188    //copy the GameStateCompressed data
    185189    memcpy( (void*)(currentState->data), (const void*)(packet->data+5*sizeof( int ) + 2*sizeof(bool)), currentState->compsize );
     
    206210    processClassid(cid);
    207211  }
    208  
    209  
     212
     213
    210214  bool PacketDecoder::decodeWelcome( ENetPacket* packet, int clientID ){
    211215    welcome *w = new welcome;
     
    217221    return processWelcome(w);
    218222  }
    219  
     223
    220224  bool PacketDecoder::decodeConnectRequest( ENetPacket *packet, int clientID ){
    221225    connectRequest *con = new connectRequest;
     
    256260    return;
    257261  }
    258  
     262
    259263  bool PacketDecoder::processWelcome( welcome *w ){
    260264    delete w;
    261265    return true;
    262266  }
    263  
     267
    264268  bool PacketDecoder::processConnectRequest( connectRequest *con, int clientID ){
    265269    COUT(3) << "packetdecoder: processing connectRequest" << std::endl;
     
    280284  {
    281285    if(clientId!=CLIENTID_CLIENT)
     286    {
    282287      COUT(5) << "client: " << clientId << std::endl;
     288    }
    283289    COUT(5) << "data id: " << data->id << std::endl;
    284290    COUT(5) << "data:    " << data->message << std::endl;
  • code/branches/network/src/network/dummyclient3.cc

    r1293 r1446  
    5151  Client client( str, PORT );
    5252  if ( client.establishConnection() )
     53  {
    5354    COUT(3) << "connection established" << std::endl;
    54   else COUT(0) << "problems establishing connection" << std::endl;
     55  }
     56  else
     57  {
     58    COUT(0) << "problems establishing connection" << std::endl;
     59  }
    5560  char message[10000];
    5661  char signs[] = "abcdefghijklmnopqrstuvwxy";
Note: See TracChangeset for help on using the changeset viewer.