- Timestamp:
- Dec 14, 2010, 8:54:00 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network5/src/libraries/network/FunctionCallManager.cc
r7495 r7759 30 30 #include "packet/FunctionCalls.h" 31 31 #include "core/GameMode.h" 32 #include "GamestateHandler.h" 32 33 33 34 namespace orxonox { 34 35 35 36 std::map<uint32_t, packet::FunctionCalls*> FunctionCallManager::sClientMap_; 36 std::vector< FunctionCall> FunctionCallManager::sIncomingFunctionCallBuffer_;37 std::vector<std::pair<FunctionCall, std::pair<uint32_t, uint32_t> > > FunctionCallManager::sIncomingFunctionCallBuffer_; 37 38 38 39 // Static calls … … 164 165 } 165 166 166 void FunctionCallManager::bufferIncomingFunctionCall(const orxonox::FunctionCall& fctCall )167 void FunctionCallManager::bufferIncomingFunctionCall(const orxonox::FunctionCall& fctCall, uint32_t minGamestateID, uint32_t clientID) 167 168 { 168 if( !GameMode::isMaster() ) 169 FunctionCallManager::sIncomingFunctionCallBuffer_.push_back( fctCall ); 169 FunctionCallManager::sIncomingFunctionCallBuffer_.push_back( std::make_pair(fctCall, std::make_pair(minGamestateID, clientID))); 170 170 } 171 171 172 172 void FunctionCallManager::processBufferedFunctionCalls() 173 173 { 174 std::vector< FunctionCall>::iterator it = FunctionCallManager::sIncomingFunctionCallBuffer_.begin();174 std::vector<std::pair<FunctionCall, std::pair<uint32_t, uint32_t> > >::iterator it = FunctionCallManager::sIncomingFunctionCallBuffer_.begin(); 175 175 while( it!=FunctionCallManager::sIncomingFunctionCallBuffer_.end() ) 176 176 { 177 if( it->execute() ) 177 uint32_t minGamestateID = it->second.first; 178 uint32_t clientID = it->second.second; 179 if( minGamestateID <= GamestateHandler::getInstance()->getLastProcessedGamestateID(clientID) && it->first.execute() ) 178 180 FunctionCallManager::sIncomingFunctionCallBuffer_.erase(it); 179 181 else 182 { 180 183 ++it; 184 } 181 185 } 182 186 }
Note: See TracChangeset
for help on using the changeset viewer.