Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/netp2/src/network/FunctionCallManager.cc @ 2940

Last change on this file since 2940 was 2937, checked in by scheusso, 16 years ago

commit for testing reasons

  • added possibility to transfer function calls over network
  • made MultiType serialisable
  • put serialise functions from synchronisable to util
  • … (can't remember )
File size: 2.2 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "FunctionCallManager.h"
30#include "packet/FunctionCalls.h"
31
32namespace orxonox {
33   
34std::map<uint32_t, packet::FunctionCalls*> FunctionCallManager::clientMap_;
35
36void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, MultiType* mt1, MultiType* mt2, MultiType* mt3, MultiType* mt4, MultiType* mt5)
37{ 
38  if(clientMap_.find(clientID)==clientMap_.end()) 
39  {
40    clientMap_[clientID] = new packet::FunctionCalls; 
41    clientMap_[clientID]->setClientID(clientID); 
42  } 
43  clientMap_[clientID]->addCallStatic(functionID, mt1, mt2, mt3, mt4, mt5);
44}
45
46void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, MultiType* mt1, MultiType* mt2, MultiType* mt3, MultiType* mt4, MultiType* mt5)
47{ 
48  if(clientMap_.find(clientID)==clientMap_.end()) 
49  {
50    clientMap_[clientID] = new packet::FunctionCalls; 
51    clientMap_[clientID]->setClientID(clientID); 
52  } 
53  clientMap_[clientID]->addCallMember(functionID, objectID, mt1, mt2, mt3, mt4, mt5);
54}
55
56void FunctionCallManager::sendCalls()
57{
58  std::map<uint32_t, packet::FunctionCalls*>::iterator it;
59  for (it = FunctionCallManager::clientMap_.begin(); it != FunctionCallManager::clientMap_.end(); it++)
60    it->second->send();
61}
62
63
64} //namespace orxonox
Note: See TracBrowser for help on using the repository browser.