Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2031


Ignore:
Timestamp:
Oct 28, 2008, 9:11:02 PM (16 years ago)
Author:
landauf
Message:

some small adjustments in the network

Location:
code/branches/objecthierarchy/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/network/Synchronisable.cc

    r2028 r2031  
    142142          // update data and create object/entity...
    143143    bool b = no->updateData(mem, mode, true);
    144     assert(b);
    145     b = no->create();
    146     assert(b);
     144//    assert(b);
     145    if (b)
     146    {
     147        b = no->create();
     148        assert(b);
     149    }
    147150    return no;
    148151  }
  • code/branches/objecthierarchy/src/network/packet/Gamestate.cc

    r1990 r2031  
    4646#define HEADER GAMESTATE_HEADER(data_)
    4747
    48  
     48
    4949#define PACKET_FLAG_GAMESTATE  ENET_PACKET_FLAG_RELIABLE
    50  
     50
    5151Gamestate::Gamestate()
    5252{
     
    8585    return false;
    8686  }
    87  
     87
    8888#ifndef NDEBUG
    8989  std::list<Synchronisable*> slist;
     
    115115    slist.push_back(*it);
    116116#endif
    117    
     117
    118118    //if(it->doSelection(id))
    119119    dataMap_[mem-data_]=(*it);  // save the mem location of the synchronisable data
     
    165165    {
    166166      bool b = s->updateData(mem, mode);
    167       assert(b);
     167//      assert(b);
    168168      //if(!s->updateData(mem, mode))
    169169        //return false;
     
    339339  assert(data_);
    340340  std::map<unsigned int, Synchronisable *>::iterator it;
    341  
     341
    342342  // allocate memory for new data
    343343  uint8_t *gdata = new uint8_t[HEADER->datasize+sizeof(GamestateHeader)];
     
    346346  uint8_t *newdata = gdata + sizeof(GamestateHeader);
    347347  uint8_t *origdata = GAMESTATE_START(data_);
    348  
     348
    349349  //copy the GamestateHeader
    350350  *(GamestateHeader*)gdata = *HEADER;
    351  
     351
    352352  synchronisableHeader *oldobjectheader, *newobjectheader;
    353353  unsigned int objectOffset;
    354  
     354
    355355  //copy in the zeros
    356356  for(it=dataMap_.begin(); it!=dataMap_.end(); it++){
     
    390390  assert(!HEADER->compressed);
    391391  assert(!HEADER->diffed);
    392  
     392
    393393  //preparations
    394394  std::map<unsigned int, Synchronisable *>::iterator it;
    395395  uint8_t *origdata, *basedata, *destdata, *ndata;
    396396  unsigned int objectOffset, streamOffset=0;    //data offset
    397   unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 
     397  unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize;
    398398  synchronisableHeader *origheader;
    399399  synchronisableHeader *destheader;
    400  
     400
    401401  origdata = GAMESTATE_START(this->data_);
    402402  basedata = GAMESTATE_START(base->data_);
    403403  ndata = new uint8_t[HEADER->datasize + sizeof(GamestateHeader)];
    404404  destdata = ndata + sizeof(GamestateHeader);
    405  
     405
    406406  // do the diff
    407407  for(it=dataMap_.begin(); it!=dataMap_.end(); it++){
     
    410410    origheader = (synchronisableHeader *)(origdata+streamOffset);
    411411    destheader = (synchronisableHeader *)(destdata+streamOffset);
    412    
     412
    413413    //copy and partially diff the object header
    414414    assert(sizeof(synchronisableHeader)==3*sizeof(unsigned int)+sizeof(bool));
     
    420420    }else{
    421421      *(uint32_t*)(destdata+sizeof(uint32_t)+sizeof(bool)) = 0;
    422       *(uint32_t*)(destdata+2*sizeof(uint32_t)+sizeof(bool)) = 0; 
     422      *(uint32_t*)(destdata+2*sizeof(uint32_t)+sizeof(bool)) = 0;
    423423    }
    424424    objectOffset=sizeof(synchronisableHeader);
    425425    streamOffset+=sizeof(synchronisableHeader);
    426    
     426
    427427    //now handle the object data or fill with zeros
    428428    while(objectOffset<origheader->size ){
    429      
     429
    430430      if(sendData && streamOffset<minsize)
    431431        *(destdata+objectOffset)=*(basedata+objectOffset)^*(origdata+objectOffset); // do the xor
     
    434434      else
    435435        *(destdata+objectOffset)=0; // set to 0 because this object should not be transfered
    436      
     436
    437437      objectOffset++;
    438438      streamOffset++;
     
    442442    basedata+=objectOffset;
    443443  }
    444  
     444
    445445  //copy over the gamestate header and set the diffed flag
    446446  *(GamestateHeader *)ndata = *HEADER; //copy over the header
     
    458458  assert(!HEADER->compressed);
    459459  assert(HEADER->diffed);
    460  
     460
    461461  //preparations
    462462  std::map<unsigned int, Synchronisable *>::iterator it;
    463463  uint8_t *origdata, *basedata, *destdata, *ndata;
    464464  unsigned int objectOffset, streamOffset=0;    //data offset
    465   unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 
     465  unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize;
    466466  synchronisableHeader *origheader;
    467467  synchronisableHeader *destheader;
    468  
     468
    469469  origdata = GAMESTATE_START(this->data_);
    470470  basedata = GAMESTATE_START(base->data_);
    471471  ndata = new uint8_t[HEADER->datasize + sizeof(GamestateHeader)];
    472472  destdata = ndata + sizeof(GamestateHeader);
    473  
     473
    474474  // do the undiff
    475475  for(it=dataMap_.begin(); it!=dataMap_.end(); it++){
     
    478478    destheader = (synchronisableHeader *)(destdata+streamOffset);
    479479    bool sendData;
    480    
     480
    481481    //copy and partially diff the object header
    482482    assert(sizeof(synchronisableHeader)==3*sizeof(unsigned int)+sizeof(bool));
     
    489489    }else{
    490490      *(unsigned int*)(destdata+sizeof(unsigned int)+sizeof(bool)) = 0;
    491       *(unsigned int*)(destdata+2*sizeof(unsigned int)+sizeof(bool)) = 0; 
     491      *(unsigned int*)(destdata+2*sizeof(unsigned int)+sizeof(bool)) = 0;
    492492    }
    493493    objectOffset=sizeof(synchronisableHeader);
    494494    streamOffset+=sizeof(synchronisableHeader);
    495    
     495
    496496    //now handle the object data or fill with zeros
    497497    while(objectOffset<origheader->size ){
    498      
     498
    499499      if(sendData && streamOffset<minsize)
    500500        *(destdata+objectOffset)=*(basedata+objectOffset)^*(origdata+objectOffset); // do the xor
     
    503503      else
    504504        *(destdata+objectOffset)=0; // set to 0 because this object should not be transfered
    505      
     505
    506506      objectOffset++;
    507507      streamOffset++;
     
    511511    basedata+=objectOffset;
    512512  }
    513  
     513
    514514  //copy over the gamestate header and set the diffed flag
    515515  *(GamestateHeader *)ndata = *HEADER; //copy over the header
  • code/branches/objecthierarchy/src/orxonox/objects/infos/Level.cc

    r2019 r2031  
    5252
    5353        this->registerVariables();
    54         this->xmlfilename_ = this->getFilename();
     54        this->xmlfilename_ = this->getFilename().substr(Settings::getDataPath().length());
    5555
    5656        COUT(0) << "created Level" << std::endl;
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/Trigger.cc

    r2029 r2031  
    6969
    7070    this->getNode()->attachObject(this->debugBillboard_.getBillboardSet());
     71    this->setObjectMode(0x0);
    7172  }
    7273
  • code/branches/objecthierarchy/src/orxonox/tools/Timer.cc

    r1968 r2031  
    112112    void TimerBase::run() const
    113113    {
     114        bool temp = this->bKillAfterCall_; // to avoid errors with bKillAfterCall_=false and an exutors which destroy the timer
     115
    114116        (*this->executor_)();
    115117
    116         if (this->bKillAfterCall_)
     118        if (temp)
    117119            delete this;
    118120    }
Note: See TracChangeset for help on using the changeset viewer.