Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2706


Ignore:
Timestamp:
Feb 28, 2009, 12:35:04 PM (15 years ago)
Author:
scheusso
Message:

fixed a bug when building in release mode

Location:
code/branches/buildsystem3/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem3/src/core/Identifier.h

    r2667 r2706  
    6161#include <utility>
    6262#include <typeinfo>
    63 #include <stdlib.h>
     63#include <cstdlib>
    6464#include <cassert>
    6565
  • code/branches/buildsystem3/src/network/GamestateManager.cc

    r2662 r2706  
    118118      return 0;
    119119    gs = reference->doSelection(clientID, 10000);
    120 //     gs = new packet::Gamestate(*reference);
    121120    // save the (undiffed) gamestate in the clients gamestate map
    122121    gamestateMap_[clientID][gs->getID()]=gs;
  • code/branches/buildsystem3/src/network/packet/Gamestate.cc

    r2662 r2706  
    110110  for(it = ObjectList<Synchronisable>::begin(); it; ++it){
    111111   
     112    tempsize=it->getSize(id, mode);
    112113#ifndef NDEBUG
    113     tempsize=it->getSize(id, mode);
    114114    if(currentsize+tempsize > size){
    115115      assert(0); // if we don't use multithreading this part shouldn't be neccessary
     
    184184    {
    185185      bool b = s->updateData(mem, mode);
     186      if(!b)
     187        COUT(0) << "data could not be updated" << endl;
    186188      assert(b);
    187189    }
  • code/branches/buildsystem3/src/network/synchronisable/Synchronisable.cc

    r2662 r2706  
    236236    return NULL;
    237237  }
    238 
    239 
    240   /**
    241   * This function is used to register a variable to be synchronized
    242   * also counts the total datasize needed to save the variables
    243   * @param var pointer to the variable
    244   * @param size size of the datatype the variable consists of
    245   * @param t the type of the variable (DATA or STRING
    246   * @param mode same as in getData
    247   * @param cb callback object that should get called, if the value of the variable changes
    248   */
    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 struct
    253     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 time
    265       }
    266       else
    267       {
    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 NDEBUG
    277     std::list<synchronisableVariable *>::iterator it = syncList->begin();
    278     while(it!=syncList->end()){
    279       assert(*it!=var);
    280       it++;
    281     }
    282 #endif
    283   }*/
    284238
    285239
  • code/branches/buildsystem3/src/network/synchronisable/SynchronisableVariable.cc

    r2662 r2706  
    362362{
    363363  double temp;
    364   *(uint64_t*)(&temp) = *(uint64_t*)(mem);
     364  memcpy(&temp, mem, sizeof(uint64_t));
     365  //*(uint64_t*)(&temp) = *(uint64_t*)(mem);
    365366  *(long double*)(&this->variable_) = static_cast<const long double>(temp);
    366367  mem += SynchronisableVariable<const long double>::returnSize();
     
    370371{
    371372  double temp = static_cast<double>(this->variable_);
    372   *(uint64_t*)(mem) = *(uint64_t*)(&temp);
     373  memcpy(mem, &temp, sizeof(uint64_t));
    373374  mem += SynchronisableVariable<const long double>::returnSize();
    374375}
     
    377378{
    378379  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);
    380382}
    381383
Note: See TracChangeset for help on using the changeset viewer.