Changeset 1856 for code/trunk/src/network
- Timestamp:
- Sep 29, 2008, 4:15:03 AM (16 years ago)
- Location:
- code/trunk/src/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/ConnectionManager.cc
r1842 r1856 345 345 std::string classname; 346 346 orxonox::Identifier *id; 347 std::map<std::string, orxonox::Identifier*>::const_iterator it = orxonox::Factory::getFactory Begin();348 while(it != orxonox::Factory::getFactory End()){347 std::map<std::string, orxonox::Identifier*>::const_iterator it = orxonox::Factory::getFactoryMapBegin(); 348 while(it != orxonox::Factory::getFactoryMapEnd()){ 349 349 id = (*it).second; 350 350 if(id == NULL) -
code/trunk/src/network/Server.cc
r1785 r1856 340 340 if(!client) 341 341 return false; 342 orxonox::Identifier* id = GetIdentifier("SpaceShip");342 orxonox::Identifier* id = ClassByName("SpaceShip"); 343 343 if(!id){ 344 344 COUT(4) << "We could not create the SpaceShip for client: " << client->getID() << std::endl; -
code/trunk/src/network/Synchronisable.cc
r1837 r1856 83 83 } 84 84 85 85 86 86 void Synchronisable::setClient(bool b){ 87 87 if(b) // client … … 90 90 state_=0x1; 91 91 } 92 92 93 93 bool Synchronisable::fabricate(unsigned char*& mem, int mode) 94 94 { … … 97 97 objectID = *(unsigned int*)(mem+sizeof(unsigned int)); 98 98 classID = *(unsigned int*)(mem+2*sizeof(unsigned int)); 99 99 100 100 if(size==3*sizeof(unsigned int)){ //not our turn, dont do anything 101 101 mem+=3*sizeof(unsigned int); 102 102 return true; 103 103 } 104 105 orxonox::Identifier* id = GetIdentifier(classID);104 105 orxonox::Identifier* id = ClassByID(classID); 106 106 if(!id){ 107 107 COUT(3) << "We could not identify a new object; classid: " << classID << " uint: " << (unsigned int)classID << " objectID: " << objectID << " size: " << size << std::endl; … … 149 149 syncList->push_back(temp); 150 150 } 151 151 152 152 /** 153 153 * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct … … 171 171 unsigned int size; 172 172 size=getSize2(id, mode); 173 173 174 174 // start copy header 175 175 memcpy(mem, &size, sizeof(unsigned int)); … … 181 181 tempsize+=12; 182 182 // end copy header 183 183 184 184 //if this tick is we dont synchronise, then abort now 185 185 if(!isMyTick(id)) 186 186 return true; 187 187 188 188 COUT(5) << "Synchronisable getting data from objectID: " << objectID << " classID: " << classID << " length: " << size << std::endl; 189 189 // copy to location … … 215 215 } 216 216 217 217 218 218 /** 219 219 * This function takes a syncData struct and takes it to update the variables … … 230 230 return false; 231 231 } 232 232 233 233 // start extract header 234 234 unsigned int objectID, classID, size; … … 245 245 return true; 246 246 //assert(0); 247 247 248 248 COUT(5) << "Synchronisable: objectID " << objectID << ", classID " << classID << " size: " << size << " synchronising data" << std::endl; 249 249 for(i=syncList->begin(); i!=syncList->end() && mem <= data+size; i++){ … … 317 317 return sizeof(synchronisableHeader) + getSize( id, mode ); 318 318 } 319 320 /** 321 * 322 * @param id 323 * @return 319 320 /** 321 * 322 * @param id 323 * @return 324 324 */ 325 325 bool Synchronisable::isMyTick(unsigned int id){ … … 327 327 return ( id==0 || id%objectFrequency_==objectID%objectFrequency_ ) && ((objectMode_&state_)!=0); 328 328 } 329 329 330 330 bool Synchronisable::isMyData(unsigned char* mem) 331 331 { … … 337 337 classID = *(int *)mem; 338 338 mem+=sizeof(classID); 339 339 340 340 assert(classID == this->classID); 341 341 return (objectID == this->objectID); 342 342 } 343 343 344 344 void Synchronisable::setObjectMode(int mode){ 345 345 assert(mode==0x1 || mode==0x2 || mode==0x3); -
code/trunk/src/network/packet/ClassID.cc
r1837 r1856 42 42 #define _CLASSNAMELENGTH _CLASSID + sizeof(unsigned int) 43 43 #define _CLASSNAME _CLASSNAMELENGTH + sizeof(classNameLength_) 44 44 45 45 ClassID::ClassID( unsigned int classID, std::string className ) 46 46 : Packet() … … 73 73 bool ClassID::process(){ 74 74 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) )); 76 76 if(id==NULL) 77 77 return false;
Note: See TracChangeset
for help on using the changeset viewer.