Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2832 for code/branches


Ignore:
Timestamp:
Mar 23, 2009, 2:53:10 PM (16 years ago)
Author:
scheusso
Message:

further improvements in network (eliminated double calls of Synchronisable::getSize)

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

Legend:

Unmodified
Added
Removed
  • code/branches/netp/src/network/packet/Gamestate.cc

    r2773 r2832  
    107107  for(it = ObjectList<Synchronisable>::begin(); it; ++it){
    108108   
    109     tempsize=it->getSize(id, mode);
     109//     tempsize=it->getSize(id, mode);
     110
     111    tempsize = it->getData(mem, id, mode);
     112    if ( it->doSync( id, mode ) )
     113      dataMap_.push_back( obj(it->getObjectID(), it->getCreatorID(), tempsize, mem-data_) );
     114   
    110115#ifndef NDEBUG
    111116    if(currentsize+tempsize > size){
     
    123128    }// stop allocate additional memory
    124129#endif
    125 
    126     if ( it->doSync( id, mode ) )
    127       dataMap_.push_back( obj(it->getObjectID(), it->getCreatorID(), tempsize, mem-data_) );
    128     if(!it->getData(mem, id, mode))
    129       return false; // mem pointer gets automatically increased because of call by reference
     130//     if(!it->getData(mem, id, mode))
     131//       return false; // mem pointer gets automatically increased because of call by reference
    130132    // increase size counter by size of current synchronisable
    131133    currentsize+=tempsize;
  • code/branches/netp/src/network/synchronisable/Synchronisable.cc

    r2823 r2832  
    238238   * @return true: if !doSync or if everything was successfully saved
    239239   */
    240   bool Synchronisable::getData(uint8_t*& mem, int32_t id, uint8_t mode){
     240  uint32_t Synchronisable::getData(uint8_t*& mem, int32_t id, uint8_t mode){
    241241    if(mode==0x0)
    242242      mode=state_;
    243243    //if this tick is we dont synchronise, then abort now
    244244    if(!doSync(id, mode))
    245       return true;
     245      return 0;
    246246    uint32_t tempsize = 0;
    247247    if (this->classID==0)
     
    279279    assert(tempsize==size);
    280280#endif
    281     return true;
     281    return tempsize;
    282282  }
    283283
  • code/branches/netp/src/network/synchronisable/Synchronisable.h

    r2823 r2832  
    147147
    148148  private:
    149     bool getData(uint8_t*& men, int32_t id, uint8_t mode=0x0);
     149    uint32_t getData(uint8_t*& men, int32_t id, uint8_t mode=0x0);
    150150    uint32_t getSize(int32_t id, uint8_t mode=0x0);
    151151    bool updateData(uint8_t*& mem, uint8_t mode=0x0, bool forceCallback=false);
Note: See TracChangeset for help on using the changeset viewer.