[Orxonox-commit 319] r2945 - in branches/netp2/src/network: . packet
scheusso at orxonox.net
scheusso at orxonox.net
Fri May 1 15:16:12 CEST 2009
Author: scheusso
Date: 2009-05-01 15:16:12 +0200 (Fri, 01 May 2009)
New Revision: 2945
Modified:
branches/netp2/src/network/FunctionCallManager.cc
branches/netp2/src/network/packet/FunctionCalls.cc
Log:
fixed some bugs
Modified: branches/netp2/src/network/FunctionCallManager.cc
===================================================================
--- branches/netp2/src/network/FunctionCallManager.cc 2009-05-01 07:47:34 UTC (rev 2944)
+++ branches/netp2/src/network/FunctionCallManager.cc 2009-05-01 13:16:12 UTC (rev 2945)
@@ -34,33 +34,34 @@
std::map<uint32_t, packet::FunctionCalls*> FunctionCallManager::clientMap_;
void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, MultiType* mt1, MultiType* mt2, MultiType* mt3, MultiType* mt4, MultiType* mt5)
-{
+{
if(clientMap_.find(clientID)==clientMap_.end())
{
- clientMap_[clientID] = new packet::FunctionCalls;
- clientMap_[clientID]->setClientID(clientID);
+ FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+ FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
}
- clientMap_[clientID]->addCallStatic(functionID, mt1, mt2, mt3, mt4, mt5);
+ FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, mt1, mt2, mt3, mt4, mt5);
}
void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, MultiType* mt1, MultiType* mt2, MultiType* mt3, MultiType* mt4, MultiType* mt5)
{
if(clientMap_.find(clientID)==clientMap_.end())
{
- clientMap_[clientID] = new packet::FunctionCalls;
- clientMap_[clientID]->setClientID(clientID);
+ FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+ FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
}
- clientMap_[clientID]->addCallMember(functionID, objectID, mt1, mt2, mt3, mt4, mt5);
+ FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, mt1, mt2, mt3, mt4, mt5);
}
void FunctionCallManager::sendCalls()
{
std::map<uint32_t, packet::FunctionCalls*>::iterator it;
- for (it = FunctionCallManager::clientMap_.begin(); it != FunctionCallManager::clientMap_.end(); )
+ for (it = FunctionCallManager::clientMap_.begin(); it != FunctionCallManager::clientMap_.end(); it++ )
{
+ assert(!FunctionCallManager::clientMap_.empty());
it->second->send();
- clientMap_.erase(it++);
}
+ FunctionCallManager::clientMap_.clear();
}
Modified: branches/netp2/src/network/packet/FunctionCalls.cc
===================================================================
--- branches/netp2/src/network/packet/FunctionCalls.cc 2009-05-01 07:47:34 UTC (rev 2944)
+++ branches/netp2/src/network/packet/FunctionCalls.cc 2009-05-01 13:16:12 UTC (rev 2945)
@@ -51,6 +51,7 @@
currentMemBlocks_ = 1;
data_=new uint8_t[ FUNCTIONCALLS_MEM_ALLOCATION ];
*(ENUM::Type *)(data_ + _PACKETID ) = ENUM::FunctionCalls;
+ *(uint32_t*)(data_+sizeof(uint32_t)) = 0; // set nrOfCalls to 0
}
FunctionCalls::FunctionCalls( uint8_t* data, unsigned int clientID )
More information about the Orxonox-commit
mailing list