Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1730


Ignore:
Timestamp:
Sep 7, 2008, 3:30:52 PM (16 years ago)
Author:
scheusso
Message:

more progress (still not ok)

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

Legend:

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

    r1711 r1730  
    151151    if(client_connection.isConnected() && isSynched_){
    152152      COUT(4) << "popping partial gamestate: " << std::endl;
    153       packet::Gamestate *gs = gamestate.getGamestate();
     153      /*packet::Gamestate *gs = gamestate.getGamestate();
    154154      if(gs){
    155155        COUT(4) << "client tick: sending gs " << gs << std::endl;
     
    157157          COUT(3) << "Problem adding partial gamestate to queue" << std::endl;
    158158        // gs gets automatically deleted by enet callback
    159       }
     159      }*/
    160160    }
    161161    ENetEvent *event;
     
    168168    }
    169169    int gameStateID = gamestate.processGamestates();
    170     if(gameStateID==GAMESTATEID_INITIAL)
     170    /*if(gameStateID==GAMESTATEID_INITIAL)
    171171      if(gameStateFailure_){
    172172        packet::Acknowledgement ack(GAMESTATEID_INITIAL, 0);
     
    186186      if(!ack.send())
    187187        COUT(3) << "could not ack gamestate" << std::endl;
    188     }// otherwise we had no gamestate to load
     188    }*/// otherwise we had no gamestate to load
    189189    gamestate.cleanup();
    190190    return;
  • code/branches/network/src/network/GamestateManager.cc

    r1712 r1730  
    6262  bool GamestateManager::update(){
    6363    cleanup();
    64     getSnapshot();
    65     return true;
     64    return getSnapshot();
    6665  }
    6766 
  • code/branches/network/src/network/Server.cc

    r1712 r1730  
    259259      //std::cout << "adding gamestate" << std::endl;
    260260      gs->setClientID(cid);
     261      assert(gs->compressData());
    261262      if ( !gs->send() ){
    262263        COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl;
  • code/branches/network/src/network/Synchronisable.cc

    r1699 r1730  
    9090  bool Synchronisable::fabricate(unsigned char*& mem, int mode)
    9191  {
    92     int size, objectID, classID;
    93     size = *(int *)mem;
    94     objectID = *(int*)(mem+sizeof(int));
    95     classID = *(int*)(mem+2*sizeof(int));
    96    
    97     orxonox::Identifier* id = ID((unsigned int)classID);
     92    unsigned int size, objectID, classID;
     93    size = *(unsigned int *)mem;
     94    objectID = *(unsigned int*)(mem+sizeof(unsigned int));
     95    classID = *(unsigned int*)(mem+2*sizeof(unsigned int));
     96   
     97    orxonox::Identifier* id = ID(classID);
    9898    if(!id){
    9999      COUT(3) << "We could not identify a new object; classid: " << classID << " uint: " << (unsigned int)classID << " objectID: " << objectID << " size: " << size << std::endl;
    100100      return false; // most probably the gamestate is corrupted
    101101    }
    102     Synchronisable *no = dynamic_cast<Synchronisable *>(id->fabricate());
    103     if(!no){
    104       COUT(2) << "coudl not frabricate classid: " << classID << " objectID: " << objectID << " identifier: " << id << std::endl;
    105       return false;
    106     }
     102    orxonox::BaseObject *bo = id->fabricate();
     103    Synchronisable *no = dynamic_cast<Synchronisable *>(bo);
     104    assert(no);
    107105    no->objectID=objectID;
    108106    no->classID=classID;
     107    COUT(3) << "fabricate objectID: " << no->objectID << " classID: " << no->classID << std::endl;
    109108          // update data and create object/entity...
    110109    if( !no->updateData(mem, mode) ){
  • code/branches/network/src/network/packet/Gamestate.cc

    r1715 r1730  
    128128  while(mem < data_+sizeof(GamestateHeader)+HEADER->normsize){
    129129      // extract synchronisable header
    130     size = *(int *)mem;
    131     objectID = *(int*)(mem+sizeof(int));
    132     classID = *(int*)(mem+2*sizeof(int));
    133 
    134     if(!it || it->objectID!=objectID){
     130    size = *(unsigned int *)mem;
     131    objectID = *(unsigned int*)(mem+sizeof(unsigned int));
     132    classID = *(unsigned int*)(mem+2*sizeof(unsigned int));
     133
     134    if(!it || it->objectID!=objectID || it->classID!=classID){
    135135        // bad luck ;)
    136136        // delete the synchronisable (obviously seems to be deleted on the server)
     
    141141        //fabricate the new synchronisable
    142142        if(!Synchronisable::fabricate(mem, mode))
    143           return false;
     143          /*return false*/;
    144144        it=orxonox::ObjectList<Synchronisable>::end();
    145145      }
     
    208208  //save new data
    209209  data_ = ndata;
     210  assert(HEADER->compressed);
     211  COUT(3) << "gamestate compress normsize: " << HEADER->normsize << " compsize: " << HEADER->compsize << std::endl;
    210212  return true;
    211213}
  • code/branches/network/src/network/packet/Packet.cc

    r1715 r1730  
    8282  enetPacket_=p.enetPacket_;
    8383  flags_=p.flags_;
     84  packetDirection_ = p.packetDirection_;
     85  clientID_ = p.clientID_;
    8486  if(p.data_){
    8587    data_ = new unsigned char[p.getSize()];
     
    9799
    98100bool Packet::send(){
    99   /*if(packetDirection_ != ENUM::Outgoing && packetDirection_ != ENUM::Bidirectional ){
     101  if(packetDirection_ != ENUM::Outgoing && packetDirection_ != ENUM::Bidirectional ){
    100102    assert(0);
    101103    return false;
    102   }*/
     104  }
    103105  if(!enetPacket_){
    104106    if(!data_){
  • code/branches/network/src/orxonox/objects/SpaceShip.cc

    r1669 r1730  
    244244            this->chFarNode_->setScale(0.4, 0.4, 0.4);
    245245        }
     246        // END of testing crosshair
    246247
    247248        createCamera();
    248         // END of testing crosshair
    249249    }
    250250
     
    322322        this->setBacksync(true);
    323323        //CameraHandler::getInstance()->requestFocus(cam_);
    324         if(this->isExactlyA(Class(SpaceShip)))
     324        if(this->isExactlyA(Class(SpaceShip))){
    325325          getFocus();
    326       }
     326          COUT(3) << "getting focus for obj id: " << objectID << std::endl;
     327        }else
     328          COUT(3) << "not getting focus (not exactly spaceship) for obj id: " << objectID << std::endl;
     329      }else
     330        COUT(3) << "not getting focus (not my ship) for obj id: " << objectID << std::endl;
    327331
    328332    }
Note: See TracChangeset for help on using the changeset viewer.