Changeset 1834 for code/branches/network/src/network/Synchronisable.h
- Timestamp:
- Sep 26, 2008, 12:59:48 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/Synchronisable.h
r1827 r1834 44 44 #define REGISTERSTRING_WITHDIR(stringname, mode) registerVar(&stringname, stringname.length()+1, network::STRING, mode) 45 45 46 //TODO: this is only a very ugly hack ... 47 namespace orxonox{ 48 class SpaceShip; 49 } 50 46 51 namespace network 47 52 { … … 75 80 }SYNCVAR; 76 81 77 78 82 /** 79 83 * This class is the base class of all the Objects in the universe that need to be synchronised over the network … … 83 87 class _NetworkExport Synchronisable : virtual public orxonox::OrxonoxClass{ 84 88 public: 89 friend class packet::Gamestate; 90 friend class GamestateClient; 91 friend class Server; 92 friend class orxonox::SpaceShip; 93 virtual ~Synchronisable(); 94 85 95 86 virtual ~Synchronisable();87 unsigned int objectID;88 unsigned int classID;89 90 bool getData(unsigned char*& men, unsigned int id, int mode=0x0);91 int getSize(unsigned int id, int mode=0x0);92 bool updateData(unsigned char*& mem, int mode=0x0);93 bool isMyData(unsigned char* mem);94 bool doSelection(unsigned int id);95 void setObjectMode(int mode);96 void setObjectFrequency(unsigned int freq){ objectFrequency_ = freq; }97 98 virtual void registerAllVariables()=0;99 96 virtual bool create(); 100 97 static void setClient(bool b); … … 106 103 static unsigned int popDeletedObject(){ unsigned int i = deletedObjects_.front(); deletedObjects_.pop(); return i; } 107 104 108 105 inline unsigned int getObjectID(){return objectID;} 106 inline unsigned int getClassID(){return classID;} 109 107 protected: 110 108 Synchronisable(); 111 109 void registerVar(void *var, int size, variableType t, int mode=1, NetworkCallbackBase *cb=0); 110 void setObjectMode(int mode); 111 void setObjectFrequency(unsigned int freq){ objectFrequency_ = freq; } 112 virtual void registerAllVariables()=0; 113 114 112 115 private: 116 bool getData(unsigned char*& men, unsigned int id, int mode=0x0); 117 int getSize(unsigned int id, int mode=0x0); 118 bool updateData(unsigned char*& mem, int mode=0x0); 119 bool isMyData(unsigned char* mem); 120 bool doSelection(unsigned int id); 113 121 bool isMyTick(unsigned int id); 122 123 unsigned int objectID; 124 unsigned int classID; 125 114 126 std::list<synchronisableVariable *> *syncList; 115 int datasize;116 127 static int state_; // detemines wheter we are server (default) or client 117 128 bool backsync_; // if true the variables with mode > 1 will be synchronised to server (client -> server)
Note: See TracChangeset
for help on using the changeset viewer.