Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/script/src/network/Synchronisable.h @ 986

Last change on this file since 986 was 927, checked in by scheusso, 17 years ago

Made various changes to Classes WorldEntity, Model, SpaceShip,
BulletManager and AmmunitionDump in order to make them really
synchronisable.
I hope, that everythings still working now. I only did some small tests
(ie no segfault when running/starting and acting)

File size: 1.5 KB
Line 
1//
2// C++ Interface: synchronisable
3//
4// Description:
5//
6//
7// Author:  Oliver Scheuss, (C) 2007
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#ifndef _Synchronisable_H__
13#define _Synchronisable_H__
14
15#include <list>
16
17#include "NetworkPrereqs.h"
18#include "core/OrxonoxClass.h"
19
20namespace network
21{
22  enum variableType{
23    DATA,
24    STRING,
25  };
26
27  struct syncData{
28    int length;
29    int objectID;
30    int classID;
31    unsigned char *data;
32  };
33
34  typedef struct synchronisableVariable{
35    int size;
36    const void *var;
37    variableType type;
38  }SYNCVAR;
39
40
41  /**
42  * This class is the base class of all the Objects in the universe that need to be synchronised over the network
43  * Every class, that inherits from this class has to link the DATA THAT NEEDS TO BE SYNCHRONISED into the linked list. Additionally it also has to provide a Constructor, that takes exactly the variables in this linked list.
44  * @author Oliver Scheuss
45  */
46  class _NetworkExport Synchronisable : virtual public orxonox::OrxonoxClass{
47  public:
48
49      virtual ~Synchronisable();
50    int objectID;
51    int classID;
52
53    void registerVar(const void *var, int size, variableType t);
54    //  syncData getData();
55    syncData getData(unsigned char *mem);
56    int getSize();
57    bool updateData(syncData vars);
58    virtual void registerAllVariables()=0;
59    virtual bool create()=0;
60  protected:
61    Synchronisable();
62  private:
63    /*  bool removeObject(Iterator<Synchronisable> it);*/
64
65    std::list<SYNCVAR> syncList;
66    int datasize;
67  };
68}
69
70#endif /* _Synchronisable_H__ */
Note: See TracBrowser for help on using the repository browser.