- Timestamp:
- Feb 28, 2009, 12:35:04 PM (16 years ago)
- Location:
- code/branches/buildsystem3/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem3/src/core/Identifier.h
r2667 r2706 61 61 #include <utility> 62 62 #include <typeinfo> 63 #include < stdlib.h>63 #include <cstdlib> 64 64 #include <cassert> 65 65 -
code/branches/buildsystem3/src/network/GamestateManager.cc
r2662 r2706 118 118 return 0; 119 119 gs = reference->doSelection(clientID, 10000); 120 // gs = new packet::Gamestate(*reference);121 120 // save the (undiffed) gamestate in the clients gamestate map 122 121 gamestateMap_[clientID][gs->getID()]=gs; -
code/branches/buildsystem3/src/network/packet/Gamestate.cc
r2662 r2706 110 110 for(it = ObjectList<Synchronisable>::begin(); it; ++it){ 111 111 112 tempsize=it->getSize(id, mode); 112 113 #ifndef NDEBUG 113 tempsize=it->getSize(id, mode);114 114 if(currentsize+tempsize > size){ 115 115 assert(0); // if we don't use multithreading this part shouldn't be neccessary … … 184 184 { 185 185 bool b = s->updateData(mem, mode); 186 if(!b) 187 COUT(0) << "data could not be updated" << endl; 186 188 assert(b); 187 189 } -
code/branches/buildsystem3/src/network/synchronisable/Synchronisable.cc
r2662 r2706 236 236 return NULL; 237 237 } 238 239 240 /**241 * This function is used to register a variable to be synchronized242 * also counts the total datasize needed to save the variables243 * @param var pointer to the variable244 * @param size size of the datatype the variable consists of245 * @param t the type of the variable (DATA or STRING246 * @param mode same as in getData247 * @param cb callback object that should get called, if the value of the variable changes248 */249 250 /* void Synchronisable::registerVariable(void *var, int size, variableType t, uint8_t mode, NetworkCallbackBase *cb){251 assert( mode==variableDirection::toclient || mode==variableDirection::toserver || mode==variableDirection::serverMaster || mode==variableDirection::clientMaster);252 // create temporary synch.Var struct253 synchronisableVariable *temp = new synchronisableVariable;254 temp->size = size;255 temp->var = var;256 temp->mode = mode;257 temp->type = t;258 temp->callback = cb;259 if( ( mode & variableDirection::bidirectional ) )260 {261 if(t!=STRING)262 {263 temp->varBuffer = new uint8_t[size];264 memcpy(temp->varBuffer, temp->var, size); //now fill the buffer for the first time265 }266 else267 {268 temp->varBuffer=new std::string( *static_cast<std::string*>(var) );269 }270 temp->varReference = 0;271 }272 COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl;273 //std::cout << "push temp to syncList (at the bottom) " << datasize << std::endl;274 COUT(5) << "Syncronisable::objectID: " << objectID << " this: " << this << " name: " << this->getIdentifier()->getName() << " networkID: " << this->getIdentifier()->getNetworkID() << std::endl;275 syncList->push_back(temp);276 #ifndef NDEBUG277 std::list<synchronisableVariable *>::iterator it = syncList->begin();278 while(it!=syncList->end()){279 assert(*it!=var);280 it++;281 }282 #endif283 }*/284 238 285 239 -
code/branches/buildsystem3/src/network/synchronisable/SynchronisableVariable.cc
r2662 r2706 362 362 { 363 363 double temp; 364 *(uint64_t*)(&temp) = *(uint64_t*)(mem); 364 memcpy(&temp, mem, sizeof(uint64_t)); 365 //*(uint64_t*)(&temp) = *(uint64_t*)(mem); 365 366 *(long double*)(&this->variable_) = static_cast<const long double>(temp); 366 367 mem += SynchronisableVariable<const long double>::returnSize(); … … 370 371 { 371 372 double temp = static_cast<double>(this->variable_); 372 *(uint64_t*)(mem) = *(uint64_t*)(&temp);373 memcpy(mem, &temp, sizeof(uint64_t)); 373 374 mem += SynchronisableVariable<const long double>::returnSize(); 374 375 } … … 377 378 { 378 379 double temp = static_cast<double>(this->variable_); 379 return *(uint64_t*)(mem) == *(uint64_t*)(&temp); 380 return memcmp(&temp, mem, sizeof(uint64_t))==0; 381 //return *(uint64_t*)(mem) == *(uint64_t*)(&temp); 380 382 } 381 383
Note: See TracChangeset
for help on using the changeset viewer.