Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 29, 2008, 4:15:03 AM (16 years ago)
Author:
landauf
Message:
  • some small adjustments in identifier and co.
  • renamed GetIdentifier to ClassByName and ClassByID
Location:
code/trunk/src/network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/network/ConnectionManager.cc

    r1842 r1856  
    345345    std::string classname;
    346346    orxonox::Identifier *id;
    347     std::map<std::string, orxonox::Identifier*>::const_iterator it = orxonox::Factory::getFactoryBegin();
    348     while(it != orxonox::Factory::getFactoryEnd()){
     347    std::map<std::string, orxonox::Identifier*>::const_iterator it = orxonox::Factory::getFactoryMapBegin();
     348    while(it != orxonox::Factory::getFactoryMapEnd()){
    349349      id = (*it).second;
    350350      if(id == NULL)
  • code/trunk/src/network/Server.cc

    r1785 r1856  
    340340    if(!client)
    341341      return false;
    342     orxonox::Identifier* id = GetIdentifier("SpaceShip");
     342    orxonox::Identifier* id = ClassByName("SpaceShip");
    343343    if(!id){
    344344      COUT(4) << "We could not create the SpaceShip for client: " << client->getID() << std::endl;
  • code/trunk/src/network/Synchronisable.cc

    r1837 r1856  
    8383  }
    8484
    85  
     85
    8686  void Synchronisable::setClient(bool b){
    8787    if(b) // client
     
    9090      state_=0x1;
    9191  }
    92  
     92
    9393  bool Synchronisable::fabricate(unsigned char*& mem, int mode)
    9494  {
     
    9797    objectID = *(unsigned int*)(mem+sizeof(unsigned int));
    9898    classID = *(unsigned int*)(mem+2*sizeof(unsigned int));
    99    
     99
    100100    if(size==3*sizeof(unsigned int)){ //not our turn, dont do anything
    101101      mem+=3*sizeof(unsigned int);
    102102      return true;
    103103    }
    104    
    105     orxonox::Identifier* id = GetIdentifier(classID);
     104
     105    orxonox::Identifier* id = ClassByID(classID);
    106106    if(!id){
    107107      COUT(3) << "We could not identify a new object; classid: " << classID << " uint: " << (unsigned int)classID << " objectID: " << objectID << " size: " << size << std::endl;
     
    149149    syncList->push_back(temp);
    150150  }
    151  
     151
    152152  /**
    153153   * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct
     
    171171    unsigned int size;
    172172    size=getSize2(id, mode);
    173    
     173
    174174    // start copy header
    175175    memcpy(mem, &size, sizeof(unsigned int));
     
    181181    tempsize+=12;
    182182    // end copy header
    183    
     183
    184184    //if this tick is we dont synchronise, then abort now
    185185    if(!isMyTick(id))
    186186      return true;
    187    
     187
    188188    COUT(5) << "Synchronisable getting data from objectID: " << objectID << " classID: " << classID << " length: " << size << std::endl;
    189189    // copy to location
     
    215215  }
    216216
    217  
     217
    218218  /**
    219219   * This function takes a syncData struct and takes it to update the variables
     
    230230      return false;
    231231    }
    232    
     232
    233233    // start extract header
    234234    unsigned int objectID, classID, size;
     
    245245      return true;
    246246      //assert(0);
    247    
     247
    248248    COUT(5) << "Synchronisable: objectID " << objectID << ", classID " << classID << " size: " << size << " synchronising data" << std::endl;
    249249    for(i=syncList->begin(); i!=syncList->end() && mem <= data+size; i++){
     
    317317    return sizeof(synchronisableHeader) + getSize( id, mode );
    318318  }
    319  
    320   /**
    321    * 
    322    * @param id 
    323    * @return 
     319
     320  /**
     321   *
     322   * @param id
     323   * @return
    324324   */
    325325  bool Synchronisable::isMyTick(unsigned int id){
     
    327327    return ( id==0 || id%objectFrequency_==objectID%objectFrequency_ ) && ((objectMode_&state_)!=0);
    328328  }
    329  
     329
    330330  bool Synchronisable::isMyData(unsigned char* mem)
    331331  {
     
    337337    classID = *(int *)mem;
    338338    mem+=sizeof(classID);
    339    
     339
    340340    assert(classID == this->classID);
    341341    return (objectID == this->objectID);
    342342  }
    343  
     343
    344344  void Synchronisable::setObjectMode(int mode){
    345345    assert(mode==0x1 || mode==0x2 || mode==0x3);
  • code/trunk/src/network/packet/ClassID.cc

    r1837 r1856  
    4242#define _CLASSNAMELENGTH      _CLASSID + sizeof(unsigned int)
    4343#define _CLASSNAME            _CLASSNAMELENGTH + sizeof(classNameLength_)
    44  
     44
    4545  ClassID::ClassID( unsigned int classID, std::string className )
    4646 : Packet()
     
    7373bool ClassID::process(){
    7474  COUT(3) << "processing classid: " << getClassID() << " name: " << (const char*)(data_+_CLASSNAME) << std::endl;
    75   orxonox::Identifier *id=GetIdentifier( std::string((const char*)(data_+_CLASSNAME) ));
     75  orxonox::Identifier *id=ClassByID( std::string((const char*)(data_+_CLASSNAME) ));
    7676  if(id==NULL)
    7777    return false;
Note: See TracChangeset for help on using the changeset viewer.