Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 29, 2008, 5:19:02 PM (16 years ago)
Author:
scheusso
Message:

client→server synchronisation of controllable entities works now

Location:
code/branches/objecthierarchy/src/network
Files:
2 edited

Legend:

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

    r2041 r2062  
    147147    synchronisableHeader *header = (synchronisableHeader *)mem;
    148148
     149    if(!header->dataAvailable)
     150    {
     151      mem += header->size;
     152      return 0;
     153    }
     154   
    149155    COUT(4) << "fabricating object with id: " << header->objectID << std::endl;
    150156
     
    314320      }
    315321      // if the variable gets synchronised bidirectional, then add the reference to the bytestream
    316       if( ( (*i)->mode & direction::bidirectional ) )
     322      if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional )
    317323      {
    318324        *(uint8_t*)mem = (*i)->varReference;
    319325        mem += sizeof( (*i)->varReference );
     326        tempsize += sizeof( (*i)->varReference );
    320327      }
    321328      switch((*i)->type){
     
    323330          memcpy( (void *)(mem), (void*)((*i)->var), (*i)->size);
    324331          mem+=(*i)->size;
    325           tempsize+=(*i)->size + sizeof( (*i)->varReference );
     332          tempsize+=(*i)->size;
    326333          break;
    327334        case STRING:
     
    332339          COUT(5) << "synchronisable: char: " << (const char *)(mem) << " data: " << data << " string: " << *(std::string *)((*i)->var) << std::endl;
    333340          mem+=(*i)->size;
    334           tempsize+=(*i)->size + sizeof( (*i)->varReference ) + sizeof(size_t);
     341          tempsize+=(*i)->size + sizeof(size_t);
    335342          break;
    336343      }
     
    381388      switch((*i)->type){
    382389        case DATA:
    383           if( ( (*i)->mode & direction::bidirectional ) )
     390          if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional )
    384391          {
    385392            if( ( mode == 0x1 && (*i)->mode == direction::serverMaster ) || \
     
    406413          break;
    407414        case STRING:
    408           if( ( (*i)->mode & direction::bidirectional ) )
     415          if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional )
    409416          {
    410417            if( ( mode == 0x1 && (*i)->mode == direction::serverMaster ) || \
     
    469476        break;
    470477      }
    471       if( ( (*i)->mode & direction::bidirectional ) != 0)
     478      if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional )
    472479      {
    473480        tsize+=sizeof( (*i)->varReference );
  • code/branches/objecthierarchy/src/network/packet/Gamestate.cc

    r2041 r2062  
    357357    assert(it->second->objectID==oldobjectheader->objectID);
    358358    *newobjectheader = *oldobjectheader;
    359     objectOffset=sizeof(uint8_t)+sizeof(bool); //skip the size and the availableDate variables in the objectheader
     359    objectOffset=sizeof(uint8_t)+sizeof(bool); //skip the size and the availableData variables in the objectheader
    360360    if(it->second->doSelection(HEADER->id)){
    361361      newobjectheader->dataAvailable=true; //TODO: probably not neccessary
Note: See TracChangeset for help on using the changeset viewer.