Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2008, 11:08:19 PM (17 years ago)
Author:
scheusso
Message:

implemented some sort of buffer for the spaceship movements (makes the movements on the client smoother)

File:
1 edited

Legend:

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

    r1418 r1425  
    7070  bool Synchronisable::create(){
    7171    this->classID = this->getIdentifier()->getNetworkID();
     72    COUT(4) << "setting classid from " << this->getIdentifier()->getName() << " to: " << classID << std::endl;
    7273    return true;
    7374  }
     
    156157  * @return data containing all variables and their sizes
    157158  */
    158   syncData Synchronisable::getData(unsigned char *mem){
     159  syncData Synchronisable::getData(unsigned char *mem, int mode){
    159160    //std::cout << "inside getData" << std::endl;
     161    if(mode==0x0)
     162      mode=state_;
    160163    if(classID==0)
    161164      COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl;
     
    172175    for(i=syncList->begin(); n<datasize && i!=syncList->end(); ++i){
    173176      //(std::memcpy(retVal.data+n, (const void*)(&(i->size)), sizeof(int));
    174       if( ((*i)->mode & state_) == 0 ){
     177      if( ((*i)->mode & mode) == 0 ){
    175178        COUT(5) << "not getting data: " << std::endl;
    176179        continue;  // this variable should only be received
     
    199202  * @return true/false
    200203  */
    201   bool Synchronisable::updateData(syncData vars){
     204  bool Synchronisable::updateData(syncData vars, int mode){
     205    if(mode==0x0)
     206      mode=state_;
    202207    unsigned char *data=vars.data;
    203208    std::list<synchronisableVariable *>::iterator i;
     
    208213    COUT(5) << "Synchronisable: objectID " << vars.objectID << ", classID " << vars.classID << " size: " << vars.length << " synchronising data" << std::endl;
    209214    for(i=syncList->begin(); i!=syncList->end(); i++){
    210       if( ((*i)->mode ^ state_) == 0 ){
     215      if( ((*i)->mode ^ mode) == 0 ){
    211216        COUT(5) << "synchronisable: not updating variable " << std::endl;
    212         continue;  // this variable should only be updated
     217        continue;  // this variable should only be set
    213218      }
    214219      COUT(5) << "Synchronisable: element size: " << (*i)->size << " type: " << (*i)->type << std::endl;
     
    235240  * @return amount of bytes
    236241  */
    237   int Synchronisable::getSize(){
     242  int Synchronisable::getSize(int mode){
    238243    int tsize=0;
     244    if(mode==0x0)
     245      mode=state_;
    239246    std::list<synchronisableVariable *>::iterator i;
    240247    for(i=syncList->begin(); i!=syncList->end(); i++){
    241       if( ((*i)->mode & state_) == 0 )
     248      if( ((*i)->mode & mode) == 0 )
    242249        continue;  // this variable should only be received, so dont add its size to the send-size
    243250      switch((*i)->type){
Note: See TracChangeset for help on using the changeset viewer.