[Orxonox-commit 726] r3256 - in branches/netp6/src: network orxonox/gamestates
scheusso at orxonox.net
scheusso at orxonox.net
Tue Jun 30 14:44:06 CEST 2009
Author: scheusso
Date: 2009-06-30 14:44:06 +0200 (Tue, 30 Jun 2009)
New Revision: 3256
Modified:
branches/netp6/src/network/NetworkFunction.cc
branches/netp6/src/network/NetworkFunction.h
branches/netp6/src/orxonox/gamestates/GSRoot.cc
Log:
added NetworkFunctionBase::destroyAllNetworkFunctions to cleanup premain created stuff
Modified: branches/netp6/src/network/NetworkFunction.cc
===================================================================
--- branches/netp6/src/network/NetworkFunction.cc 2009-06-29 21:59:29 UTC (rev 3255)
+++ branches/netp6/src/network/NetworkFunction.cc 2009-06-30 12:44:06 UTC (rev 3256)
@@ -55,7 +55,14 @@
}
+ void NetworkFunctionBase::destroyAllNetworkFunctions()
+ {
+ std::map<std::string, NetworkFunctionBase*>::iterator it;
+ for( it=NetworkFunctionBase::nameMap_.begin(); it!=NetworkFunctionBase::nameMap_.end(); ++it )
+ delete it->second;
+ }
+
NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p):
NetworkFunctionBase(name)
{
Modified: branches/netp6/src/network/NetworkFunction.h
===================================================================
--- branches/netp6/src/network/NetworkFunction.h 2009-06-29 21:59:29 UTC (rev 3255)
+++ branches/netp6/src/network/NetworkFunction.h 2009-06-30 12:44:06 UTC (rev 3256)
@@ -80,6 +80,8 @@
static inline void setNetworkID(const std::string& name, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); }
+ static void destroyAllNetworkFunctions();
+
protected:
static std::map<uint32_t, bool> isStaticMap_;
Modified: branches/netp6/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- branches/netp6/src/orxonox/gamestates/GSRoot.cc 2009-06-29 21:59:29 UTC (rev 3255)
+++ branches/netp6/src/orxonox/gamestates/GSRoot.cc 2009-06-30 12:44:06 UTC (rev 3256)
@@ -36,6 +36,7 @@
#include "tools/Timer.h"
#include "interfaces/TimeFactorListener.h"
#include "interfaces/Tickable.h"
+#include "network/NetworkFunction.h"
namespace orxonox
{
@@ -59,6 +60,7 @@
GSRoot::~GSRoot()
{
+ NetworkFunctionBase::destroyAllNetworkFunctions();
}
void GSRoot::activate()
More information about the Orxonox-commit
mailing list