[Orxonox-commit 5818] r10478 - in code/branches/core7/src: libraries/network libraries/network/packet modules/docking modules/notifications modules/objects modules/pickup orxonox orxonox/infos orxonox/interfaces orxonox/worldentities
landauf at orxonox.net
landauf at orxonox.net
Mon May 25 17:37:15 CEST 2015
Author: landauf
Date: 2015-05-25 17:37:15 +0200 (Mon, 25 May 2015)
New Revision: 10478
Added:
code/branches/core7/src/libraries/network/NetworkFunctionIncludes.cc
Modified:
code/branches/core7/src/libraries/network/CMakeLists.txt
code/branches/core7/src/libraries/network/FunctionCall.cc
code/branches/core7/src/libraries/network/FunctionCall.h
code/branches/core7/src/libraries/network/FunctionCallManager.cc
code/branches/core7/src/libraries/network/FunctionCallManager.h
code/branches/core7/src/libraries/network/NetworkFunction.h
code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h
code/branches/core7/src/libraries/network/packet/FunctionCalls.cc
code/branches/core7/src/libraries/network/packet/FunctionCalls.h
code/branches/core7/src/modules/docking/Dock.cc
code/branches/core7/src/modules/notifications/NotificationDispatcher.cc
code/branches/core7/src/modules/objects/Script.cc
code/branches/core7/src/modules/pickup/PickupManager.cc
code/branches/core7/src/orxonox/Test.cc
code/branches/core7/src/orxonox/infos/GametypeInfo.cc
code/branches/core7/src/orxonox/interfaces/NotificationListener.cc
code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc
Log:
callStaticNetworkFunction() and callMemberNetworkFunction() are now template functions instead of macros.
simplified function call interface: always pass five MultiType-references. Check if MultiType.null() evaluates to true to see if the argument was defined.
moved references to NetworkFunctionManager to NetworkFunctionIncludes.cc.
this also fixed a linker error in MSVC by including NetworkFunctionIncludes.h in a build-unit inside the network library.
Modified: code/branches/core7/src/libraries/network/CMakeLists.txt
===================================================================
--- code/branches/core7/src/libraries/network/CMakeLists.txt 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/CMakeLists.txt 2015-05-25 15:37:15 UTC (rev 10478)
@@ -33,6 +33,7 @@
WANDiscovery.cc
MasterServerComm.cc
NetworkFunction.cc
+ NetworkFunctionIncludes.cc
NetworkFunctionManager.cc
Host.cc
Server.cc
Modified: code/branches/core7/src/libraries/network/FunctionCall.cc
===================================================================
--- code/branches/core7/src/libraries/network/FunctionCall.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/FunctionCall.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -68,36 +68,36 @@
}
}
-void FunctionCall::setCall( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){
+void FunctionCall::setCall( uint32_t networkID, uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5){
// first determine the size that has to be reserved for this call
uint32_t callsize = 3*sizeof(uint32_t); //size for network-function-id and nrOfArguments and the objectID
uint32_t nrOfArguments = 0;
- if(mt1)
+ if(!mt1.null())
{
nrOfArguments++;
- callsize += mt1->getNetworkSize();
- this->arguments_.push_back(*mt1);
- if(mt2)
+ callsize += mt1.getNetworkSize();
+ this->arguments_.push_back(mt1);
+ if(!mt2.null())
{
nrOfArguments++;
- callsize += mt2->getNetworkSize();
- this->arguments_.push_back(*mt2);
- if(mt3)
+ callsize += mt2.getNetworkSize();
+ this->arguments_.push_back(mt2);
+ if(!mt3.null())
{
nrOfArguments++;
- callsize += mt3->getNetworkSize();
- this->arguments_.push_back(*mt3);
- if(mt4)
+ callsize += mt3.getNetworkSize();
+ this->arguments_.push_back(mt3);
+ if(!mt4.null())
{
nrOfArguments++;
- callsize += mt4->getNetworkSize();
- this->arguments_.push_back(*mt4);
- if(mt5)
+ callsize += mt4.getNetworkSize();
+ this->arguments_.push_back(mt4);
+ if(!mt5.null())
{
nrOfArguments++;
- callsize += mt5->getNetworkSize();
- this->arguments_.push_back(*mt5);
+ callsize += mt5.getNetworkSize();
+ this->arguments_.push_back(mt5);
}
}
}
Modified: code/branches/core7/src/libraries/network/FunctionCall.h
===================================================================
--- code/branches/core7/src/libraries/network/FunctionCall.h 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/FunctionCall.h 2015-05-25 15:37:15 UTC (rev 10478)
@@ -51,7 +51,7 @@
inline unsigned int getSize() const { return this->size_; }
bool execute();
- void setCall( uint32_t networkID, uint32_t objectID, const MultiType* mt1=0, const MultiType* mt2=0, const MultiType* mt3=0, const MultiType* mt4=0, const MultiType* mt5=0);
+ void setCall( uint32_t networkID, uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5);
void saveData( uint8_t*& mem );
void loadData( uint8_t*& mem );
Modified: code/branches/core7/src/libraries/network/FunctionCallManager.cc
===================================================================
--- code/branches/core7/src/libraries/network/FunctionCallManager.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/FunctionCallManager.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -39,51 +39,6 @@
std::vector<std::pair<FunctionCall, std::pair<uint32_t, uint32_t> > > FunctionCallManager::sIncomingFunctionCallBuffer_;
-void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID)
-{
- if(sPeerMap_.find(peerID)==sPeerMap_.end())
- {
- FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls;
- FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID);
- }
- FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID);
-}
-void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1)
-{
- if(sPeerMap_.find(peerID)==sPeerMap_.end())
- {
- FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls;
- FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID);
- }
- FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1);
-}
-void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2)
-{
- if(sPeerMap_.find(peerID)==sPeerMap_.end())
- {
- FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls;
- FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID);
- }
- FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1, &mt2);
-}
-void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3)
-{
- if(sPeerMap_.find(peerID)==sPeerMap_.end())
- {
- FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls;
- FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID);
- }
- FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1, &mt2, &mt3);
-}
-void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)
-{
- if(sPeerMap_.find(peerID)==sPeerMap_.end())
- {
- FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls;
- FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID);
- }
- FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1, &mt2, &mt3, &mt4);
-}
void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)
{
if(sPeerMap_.find(peerID)==sPeerMap_.end())
@@ -91,7 +46,7 @@
FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls;
FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID);
}
- FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1, &mt2, &mt3, &mt4, &mt5);
+ FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, mt1, mt2, mt3, mt4, mt5);
}
// Send calls
Modified: code/branches/core7/src/libraries/network/FunctionCallManager.h
===================================================================
--- code/branches/core7/src/libraries/network/FunctionCallManager.h 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/FunctionCallManager.h 2015-05-25 15:37:15 UTC (rev 10478)
@@ -45,11 +45,6 @@
class _NetworkExport FunctionCallManager
{
public:
- static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID);
- static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1);
- static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2);
- static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3);
- static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4);
static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5);
static void sendCalls(orxonox::Host* host);
Modified: code/branches/core7/src/libraries/network/NetworkFunction.h
===================================================================
--- code/branches/core7/src/libraries/network/NetworkFunction.h 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/NetworkFunction.h 2015-05-25 15:37:15 UTC (rev 10478)
@@ -192,16 +192,6 @@
FunctorMemberPtr<T> functor_;
};
-template<class T> inline void copyPtr( T ptr, NetworkFunctionPointer& destptr)
-{
- if( sizeof(NetworkFunctionPointer)-sizeof(T) > 0)
- memset((uint8_t*)&destptr + sizeof(T), 0, sizeof(NetworkFunctionPointer)-sizeof(T));
- T p2 = ptr;
- memcpy( &destptr, &p2, sizeof(T) );
-// for(unsigned int i=0; i<(sizeof(T)-1/4)+1; i++)
-// *((uint32_t*)destptr+i) = p2>>32*i;
}
-}
-
#endif /* _NetworkFunction_H__ */
Added: code/branches/core7/src/libraries/network/NetworkFunctionIncludes.cc
===================================================================
--- code/branches/core7/src/libraries/network/NetworkFunctionIncludes.cc (rev 0)
+++ code/branches/core7/src/libraries/network/NetworkFunctionIncludes.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -0,0 +1,48 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss
+ * Co-authors:
+ * Fabian 'x3n' Landau
+ *
+ */
+
+#include "NetworkFunctionIncludes.h"
+#include "NetworkFunctionManager.h"
+
+namespace orxonox
+{
+ void StaticallyInitializedNetworkFunction::load()
+ {
+ NetworkFunctionManager::getInstance().registerFunction(this->function_);
+ }
+
+ void StaticallyInitializedNetworkFunction::unload()
+ {
+ NetworkFunctionManager::getInstance().unregisterFunction(this->function_);
+ }
+
+ uint32_t getNetworkIdForPointer(const NetworkFunctionPointer& pointer)
+ {
+ return NetworkFunctionManager::getInstance().getFunctionByFunctionPointer(pointer)->getNetworkID();
+ }
+}
Modified: code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h
===================================================================
--- code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h 2015-05-25 15:37:15 UTC (rev 10478)
@@ -35,7 +35,6 @@
#include <boost/static_assert.hpp>
#include "NetworkFunction.h"
-#include "NetworkFunctionManager.h"
#include "core/module/StaticallyInitializedInstance.h"
#define registerStaticNetworkFunction( functionPointer ) \
@@ -46,33 +45,15 @@
static orxonox::NetworkFunctionBase& BOOST_PP_CAT( NETWORK_FUNCTION_##class, __UNIQUE_NUMBER__ ) \
= (new orxonox::SI_NF(orxonox::registerMemberNetworkFunctionFct<class>( &class::function, #class "_" #function)))->getFunction()
-// call it with functionPointer, clientID, args
-#define callStaticNetworkFunction( functionPointer, ...) \
- { \
- NetworkFunctionPointer p1; \
- copyPtr( functionPointer, p1 ); \
- FunctionCallManager::addCall(NetworkFunctionManager::getInstance().getFunctionByFunctionPointer(p1)->getNetworkID(), OBJECTID_UNKNOWN, __VA_ARGS__); \
- }
-
-// call it with class, function, objectID, clientID, args
-#define callMemberNetworkFunction( class, function, objectID, ...) \
- { \
- NetworkFunctionPointer p1; \
- copyPtr( &class::function, p1 ); \
- FunctionCallManager::addCall(NetworkFunctionManager::getInstance().getFunctionByFunctionPointer(p1)->getNetworkID(), objectID, __VA_ARGS__); \
- }
-
namespace orxonox
{
- class _CoreExport StaticallyInitializedNetworkFunction : public StaticallyInitializedInstance
+ class _NetworkExport StaticallyInitializedNetworkFunction : public StaticallyInitializedInstance
{
public:
StaticallyInitializedNetworkFunction(NetworkFunctionBase* function) : function_(function) {}
- virtual void load()
- { NetworkFunctionManager::getInstance().registerFunction(this->function_); }
- virtual void unload()
- { NetworkFunctionManager::getInstance().unregisterFunction(this->function_); }
+ virtual void load();
+ virtual void unload();
inline NetworkFunctionBase& getFunction()
{ return *this->function_; }
@@ -83,21 +64,52 @@
typedef StaticallyInitializedNetworkFunction SI_NF;
- template<class T> inline NetworkFunctionBase* registerStaticNetworkFunctionFct( T ptr, const std::string& name )
+ template<class PT>
+ inline NetworkFunctionBase* registerStaticNetworkFunctionFct(PT ptr, const std::string& name)
{
- BOOST_STATIC_ASSERT( sizeof(T)<=sizeof(NetworkFunctionPointer) ); // if this fails your compiler uses bigger pointers for static functions than defined above
+ BOOST_STATIC_ASSERT(sizeof(PT) <= sizeof(NetworkFunctionPointer)); // if this fails your compiler uses bigger pointers for static functions than defined above
NetworkFunctionPointer destptr;
- copyPtr( ptr, destptr );
- return new NetworkFunctionStatic( createFunctor(ptr), name, destptr );
+ copyPtr(ptr, destptr);
+ return new NetworkFunctionStatic(createFunctor(ptr), name, destptr);
}
- template<class T, class PT> inline NetworkFunctionBase* registerMemberNetworkFunctionFct( PT ptr, const std::string& name )
+ template<class T, class PT>
+ inline NetworkFunctionBase* registerMemberNetworkFunctionFct(PT ptr, const std::string& name)
{
- BOOST_STATIC_ASSERT( sizeof(PT)<=sizeof(NetworkFunctionPointer) ); // if this fails your compiler uses bigger pointers for a specific kind of member functions than defined above
+ BOOST_STATIC_ASSERT(sizeof(PT) <= sizeof(NetworkFunctionPointer)); // if this fails your compiler uses bigger pointers for a specific kind of member functions than defined above
NetworkFunctionPointer destptr;
- copyPtr( ptr, destptr );
- return new NetworkMemberFunction<T>( createFunctor(ptr), name, destptr );
+ copyPtr(ptr, destptr);
+ return new NetworkMemberFunction<T>(createFunctor(ptr), name, destptr);
}
+
+ _NetworkExport uint32_t getNetworkIdForPointer(const NetworkFunctionPointer& pointer);
+
+ // call it with functionPointer, clientID, args
+ template<class PT>
+ void callStaticNetworkFunction(PT ptr, uint32_t clientID, const MultiType& mt1 = MultiType::Null, const MultiType& mt2 = MultiType::Null, const MultiType& mt3 = MultiType::Null, const MultiType& mt4 = MultiType::Null, const MultiType& mt5 = MultiType::Null)
+ {
+ NetworkFunctionPointer destptr;
+ copyPtr(ptr, destptr);
+ FunctionCallManager::addCall(getNetworkIdForPointer(destptr), OBJECTID_UNKNOWN, clientID, mt1, mt2, mt3, mt4, mt5);
+ }
+
+ // call it with class::function, objectID, clientID, args
+ template<class PT>
+ void callMemberNetworkFunction(PT ptr, uint32_t objectID, uint32_t clientID, const MultiType& mt1 = MultiType::Null, const MultiType& mt2 = MultiType::Null, const MultiType& mt3 = MultiType::Null, const MultiType& mt4 = MultiType::Null, const MultiType& mt5 = MultiType::Null)
+ {
+ NetworkFunctionPointer destptr;
+ copyPtr(ptr, destptr);
+ FunctionCallManager::addCall(getNetworkIdForPointer(destptr), objectID, clientID, mt1, mt2, mt3, mt4, mt5);
+ }
+
+ template<class PT>
+ inline void copyPtr(PT ptr, NetworkFunctionPointer& destptr)
+ {
+ if (sizeof(NetworkFunctionPointer) - sizeof(PT) > 0)
+ memset((uint8_t*)&destptr + sizeof(PT), 0, sizeof(NetworkFunctionPointer) - sizeof(PT));
+ PT p2 = ptr;
+ memcpy(&destptr, &p2, sizeof(PT));
+ }
}
#endif /* _NetworkFunctionIncludes_H__ */
Modified: code/branches/core7/src/libraries/network/packet/FunctionCalls.cc
===================================================================
--- code/branches/core7/src/libraries/network/packet/FunctionCalls.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/packet/FunctionCalls.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -81,7 +81,7 @@
return true;
}
-void FunctionCalls::addCall( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5)
+void FunctionCalls::addCall( uint32_t networkID, uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)
{
assert(!isDataENetAllocated());
Modified: code/branches/core7/src/libraries/network/packet/FunctionCalls.h
===================================================================
--- code/branches/core7/src/libraries/network/packet/FunctionCalls.h 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/libraries/network/packet/FunctionCalls.h 2015-05-25 15:37:15 UTC (rev 10478)
@@ -55,7 +55,7 @@
{ assert(!this->isDataENetAllocated()); return currentSize_; }
virtual bool process(orxonox::Host* host);
- void addCall( uint32_t networkID, uint32_t objectID, const MultiType* mt1=0, const MultiType* mt2=0, const MultiType* mt3=0, const MultiType* mt4=0, const MultiType* mt5=0);
+ void addCall( uint32_t networkID, uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5);
virtual bool send(orxonox::Host* host);
private:
std::queue<orxonox::FunctionCall> functionCalls_;
Modified: code/branches/core7/src/modules/docking/Dock.cc
===================================================================
--- code/branches/core7/src/modules/docking/Dock.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/modules/docking/Dock.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -183,7 +183,7 @@
GUIManager::showGUI("UndockingDialog");
}
else
- callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
+ callStaticNetworkFunction(&Dock::showDockingDialog, player->getClientID());
}
@@ -200,7 +200,7 @@
GUIManager::showGUI("DockingDialog");
}
else
- callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
+ callStaticNetworkFunction(&Dock::showDockingDialog, player->getClientID());
}
Modified: code/branches/core7/src/modules/notifications/NotificationDispatcher.cc
===================================================================
--- code/branches/core7/src/modules/notifications/NotificationDispatcher.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/modules/notifications/NotificationDispatcher.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -117,7 +117,7 @@
// Broadcast
if(!GameMode::isStandalone())
{
- callMemberNetworkFunction(NotificationDispatcher, broadcastHelper, this->getObjectID(), NETWORK_PEER_ID_BROADCAST);
+ callMemberNetworkFunction(&NotificationDispatcher::broadcastHelper, this->getObjectID(), NETWORK_PEER_ID_BROADCAST);
}
}
@@ -147,7 +147,7 @@
}
else if(GameMode::isServer())
{
- callMemberNetworkFunction(NotificationDispatcher, dispatch, this->getObjectID(), clientId, clientId);
+ callMemberNetworkFunction(&NotificationDispatcher::dispatch, this->getObjectID(), clientId, clientId);
}
}
Modified: code/branches/core7/src/modules/objects/Script.cc
===================================================================
--- code/branches/core7/src/modules/objects/Script.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/modules/objects/Script.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -197,7 +197,7 @@
const std::map<unsigned int, PlayerInfo*> clients = PlayerManager::getInstance().getClients();
for(std::map<unsigned int, PlayerInfo*>::const_iterator it = clients.begin(); it != clients.end(); it++)
{
- callStaticNetworkFunction(Script::executeHelper, it->first, this->getCode(), this->getMode(), this->getNeedsGraphics());
+ callStaticNetworkFunction(&Script::executeHelper, it->first, this->getCode(), this->getMode(), this->getNeedsGraphics());
if(this->times_ != Script::INF) // Decrement the number of remaining executions.
{
this->remainingExecutions_--;
@@ -209,7 +209,7 @@
// Else we execute the code just for the specified client.
else
{
- callStaticNetworkFunction(Script::executeHelper, clientId, this->getCode(), this->getMode(), this->getNeedsGraphics());
+ callStaticNetworkFunction(&Script::executeHelper, clientId, this->getCode(), this->getMode(), this->getNeedsGraphics());
if(this->times_ != Script::INF) // Decrement the number of remaining executions.
this->remainingExecutions_--;
}
@@ -247,7 +247,7 @@
// If this is the server and the Script is specified as being 'onLoad'.
if(GameMode::isServer() && this->isOnLoad())
{
- callStaticNetworkFunction(Script::executeHelper, clientId, this->getCode(), this->getMode(), this->getNeedsGraphics());
+ callStaticNetworkFunction(&Script::executeHelper, clientId, this->getCode(), this->getMode(), this->getNeedsGraphics());
}
}
Modified: code/branches/core7/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/core7/src/modules/pickup/PickupManager.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/modules/pickup/PickupManager.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -213,7 +213,7 @@
// If the concerned host is somewhere in the network, we call pickupChangedUsedNetwork() on its PickupManager.
else
{
- callStaticNetworkFunction(PickupManager::pickupChangedUsedNetwork, clientId, index, used, pickup->isUsable(), pickup->isUnusable());
+ callStaticNetworkFunction(&PickupManager::pickupChangedUsedNetwork, clientId, index, used, pickup->isUsable(), pickup->isUnusable());
}
}
@@ -317,11 +317,11 @@
// If there is no PickupRepresentation registered the default representation is used.
if(this->representations_.find(pickup->getRepresentationName()) == this->representations_.end())
{
- callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp);
+ callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp);
}
else
{
- callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickedUp);
+ callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickedUp);
}
}
@@ -408,7 +408,7 @@
// If we're neither server nor standalone we drop the pickup by calling dropPickupNetworked() of the PickupManager on the server.
else
{
- callStaticNetworkFunction(PickupManager::dropPickupNetworked, 0, pickup);
+ callStaticNetworkFunction(&PickupManager::dropPickupNetworked, 0, pickup);
}
}
@@ -451,7 +451,7 @@
// If we're neither server nor standalone we change the used status of the pickup by calling usePickupNetworked() of the PickupManager on the server.
else
{
- callStaticNetworkFunction(PickupManager::usePickupNetworked, 0, pickup, use);
+ callStaticNetworkFunction(&PickupManager::usePickupNetworked, 0, pickup, use);
}
}
Modified: code/branches/core7/src/orxonox/Test.cc
===================================================================
--- code/branches/core7/src/orxonox/Test.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/orxonox/Test.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -104,13 +104,13 @@
void Test::call(unsigned int clientID)
{
- callStaticNetworkFunction( &Test::printV1, clientID );
- callStaticNetworkFunction( &Test::printV1, clientID );
+ callStaticNetworkFunction(&Test::printV1, clientID );
+ callStaticNetworkFunction(&Test::printV1, clientID );
}
void Test::call2(unsigned int clientID, std::string s1, std::string s2, std::string s3, std::string s4)
{
- callMemberNetworkFunction( Test, printBlaBla, this->getObjectID(), clientID, s1, s2, s3, s4, s4 );
+ callMemberNetworkFunction( &Test::printBlaBla, this->getObjectID(), clientID, s1, s2, s3, s4, s4 );
}
void Test::tick(float dt)
@@ -129,7 +129,7 @@
// orxout() << mt2 << endl;
// if(!Core::isMaster())
// call2(0, "bal", "a", "n", "ce");
- // callMemberNetworkFunction( Test, checkU1, this->getObjectID(), 0 );
+ // callMemberNetworkFunction( &Test::checkU1, this->getObjectID(), 0 );
}
void Test::printBlaBla(std::string s1, std::string s2, std::string s3, std::string s4, std::string s5)
Modified: code/branches/core7/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/branches/core7/src/orxonox/infos/GametypeInfo.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/orxonox/infos/GametypeInfo.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -368,7 +368,7 @@
if(player->getClientID() == CLIENTID_SERVER)
this->changedReadyToSpawn(ready);
else
- callMemberNetworkFunction(GametypeInfo, changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready);
+ callMemberNetworkFunction(&GametypeInfo::changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready);
}
}
@@ -387,7 +387,7 @@
if(player->getClientID() == CLIENTID_SERVER)
this->changedSpawned(spawned);
else
- callMemberNetworkFunction(GametypeInfo, changedSpawned, this->getObjectID(), player->getClientID(), spawned);
+ callMemberNetworkFunction(&GametypeInfo::changedSpawned, this->getObjectID(), player->getClientID(), spawned);
}
}
@@ -398,7 +398,7 @@
{
if (GameMode::isMaster())
{
- callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
+ callMemberNetworkFunction(&GametypeInfo::dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
this->dispatchAnnounceMessage(message);
}
}
@@ -410,7 +410,7 @@
if (clientID == CLIENTID_SERVER)
this->dispatchAnnounceMessage(message);
else
- callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), clientID, message);
+ callMemberNetworkFunction(&GametypeInfo::dispatchAnnounceMessage, this->getObjectID(), clientID, message);
}
}
@@ -421,7 +421,7 @@
if (clientID == CLIENTID_SERVER)
this->dispatchKillMessage(message);
else
- callMemberNetworkFunction(GametypeInfo, dispatchKillMessage, this->getObjectID(), clientID, message);
+ callMemberNetworkFunction(&GametypeInfo::dispatchKillMessage, this->getObjectID(), clientID, message);
}
}
@@ -432,7 +432,7 @@
if (clientID == CLIENTID_SERVER)
this->dispatchDeathMessage(message);
else
- callMemberNetworkFunction(GametypeInfo, dispatchDeathMessage, this->getObjectID(), clientID, message);
+ callMemberNetworkFunction(&GametypeInfo::dispatchDeathMessage, this->getObjectID(), clientID, message);
}
}
@@ -443,7 +443,7 @@
if (clientID == CLIENTID_SERVER)
this->dispatchStaticMessage(message, colour);
else
- callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message, colour);
+ callMemberNetworkFunction(&GametypeInfo::dispatchStaticMessage, this->getObjectID(), clientID, message, colour);
}
}
@@ -454,7 +454,7 @@
if (clientID == CLIENTID_SERVER)
this->dispatchFadingMessage(message);
else
- callMemberNetworkFunction(GametypeInfo, dispatchFadingMessage, this->getObjectID(), clientID, message);
+ callMemberNetworkFunction(&GametypeInfo::dispatchFadingMessage, this->getObjectID(), clientID, message);
}
}
Modified: code/branches/core7/src/orxonox/interfaces/NotificationListener.cc
===================================================================
--- code/branches/core7/src/orxonox/interfaces/NotificationListener.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/orxonox/interfaces/NotificationListener.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -83,12 +83,12 @@
// If we're on the server (and the server is not the intended recipient of the notification/command) we send it over the network.
else if(GameMode::isServer() && sendMode == notificationSendMode::network && Host::getPlayerID() != clientId)
{
- callStaticNetworkFunction(NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
+ callStaticNetworkFunction(&NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
}
else if(GameMode::isServer() && sendMode == notificationSendMode::broadcast)
{
// TODO: Works as intended?
- callStaticNetworkFunction(NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
+ callStaticNetworkFunction(&NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
}
}
Modified: code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc 2015-05-25 14:51:04 UTC (rev 10477)
+++ code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc 2015-05-25 15:37:15 UTC (rev 10478)
@@ -306,7 +306,7 @@
}
else
{
- callMemberNetworkFunction(ControllableEntity, fire, this->getObjectID(), 0, firemode);
+ callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode);
}
}
@@ -322,11 +322,11 @@
{
if ( target != 0 )
{
- callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
+ callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
}
else
{
- callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
+ callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
}
}
}
More information about the Orxonox-commit
mailing list