Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 18, 2009, 6:23:31 PM (15 years ago)
Author:
rgrieder
Message:

Merged netp6 branch back to the trunk.

Location:
code/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/network/synchronisable/NetworkCallbackManager.cc

    r3214 r3304  
    4444    if (it != callbackSet_.end())
    4545    {
    46       delete (*it);
    4746      callbackSet_.erase(it);
     47      delete cb;
    4848    }
    4949  }
  • code/trunk/src/network/synchronisable/Synchronisable.cc

    r3280 r3304  
    9696      if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))
    9797        deletedObjects_.push(objectID);
    98       // delete all Synchronisable Variables from syncList ( which are also in stringList )
    99       for(std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin(); it!=syncList.end(); it++)
    100         delete (*it);
    101       syncList.clear();
    102       stringList.clear();
    103     }
     98    }
     99    // delete all Synchronisable Variables from syncList ( which are also in stringList )
     100    for(std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin(); it!=syncList.end(); it++)
     101      delete (*it);
     102    syncList.clear();
     103    stringList.clear();
    104104    std::map<uint32_t, Synchronisable*>::iterator it;
    105105    it = objectMap_.find(objectID);
     
    247247      return 0;
    248248    uint32_t tempsize = 0;
     249#ifndef NDEBUG
    249250    if (this->classID==0)
    250251      COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl;
     252#endif
    251253
    252254    if (this->classID == static_cast<uint32_t>(-1))
  • code/trunk/src/network/synchronisable/Synchronisable.h

    r3301 r3304  
    4343#include "NetworkCallback.h"
    4444
    45 /*#define REGISTERDATA(varname, ...) \
    46     registerVariable(static_cast<void*>(&varname), sizeof(varname), DATA, __VA_ARGS__)
    47 #define REGISTERSTRING(stringname, ...) \
    48     registerVariable(&stringname, stringname.length()+1, STRING, __VA_ARGS__)*/
    4945
    5046namespace orxonox
  • code/trunk/src/network/synchronisable/SynchronisableSpecialisations.cc

    r3214 r3304  
    3838namespace orxonox{
    3939 
    40 //   template <> void Synchronisable::registerVariable( const std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
    41 //   {
    42 //     if (bidirectional)
    43 //       syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb));
    44 //     else
    45 //       syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb));
    46 //     stringList.push_back(syncList.back());
    47 //   }
    48  
    4940  template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
    5041  {
     42    SynchronisableVariableBase* sv;
    5143    if (bidirectional)
    52       syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb));
     44      sv = new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb);
    5345    else
    54       syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb));
    55     stringList.push_back(syncList.back());
     46      sv = new SynchronisableVariable<const std::string>(variable, mode, cb);
     47    syncList.push_back(sv);
     48    stringList.push_back(sv);
    5649  }
    5750 
     
    7366    registerVariable(variable.y, mode, cb, bidirectional);
    7467  }
    75 //   template <> void Synchronisable::registerVariable( Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
    76 //   {
    77 //     registerVariable( (const ColourValue&)variable, mode, cb, bidirectional);
    78 //   }
    7968 
    8069  template <> void Synchronisable::registerVariable( const Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
  • code/trunk/src/network/synchronisable/SynchronisableVariable.h

    r3301 r3304  
    117117  {
    118118    if (this->callback_ != 0)
     119    {
    119120      NetworkCallbackManager::deleteCallback(this->callback_); //safe call for deletion
     121      // this is neccessary because for example for a Vector3 all 3 components of the vector use the same callback
     122    }
    120123  }
    121124
Note: See TracChangeset for help on using the changeset viewer.