- Timestamp:
- Nov 4, 2008, 5:12:31 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/Synchronisable.h
r2112 r2132 62 62 namespace syncmode{ 63 63 enum mode{ 64 on e=0,64 once=0, 65 65 always=1 66 66 }; … … 81 81 82 82 struct _NetworkExport synchronisableVariable{ 83 unsigned int size;84 int mode; // this determines in which direction the variable gets synchronised83 size_t size; 84 uint8_t mode; // this determines in which direction the variable gets synchronised 85 85 void *var; 86 86 variableType type; … … 98 98 public: 99 99 friend class packet::Gamestate; 100 friend class GamestateClient; 101 friend class Server; 100 // friend class Server; 102 101 virtual ~Synchronisable(); 103 102 … … 106 105 static void setClient(bool b); 107 106 108 static Synchronisable *fabricate(uint8_t*& mem, int mode=0x0);107 static Synchronisable *fabricate(uint8_t*& mem, uint8_t mode=0x0); 109 108 static bool deleteObject(unsigned int objectID); 110 109 static Synchronisable *getSynchronisable(unsigned int objectID); … … 116 115 protected: 117 116 Synchronisable(BaseObject* creator); 118 void registerVar(void *var, int size, variableType t, int mode=1, NetworkCallbackBase *cb=0);119 void setObjectMode( int mode);117 void registerVar(void *var, int size, variableType t, uint8_t mode=0x1, NetworkCallbackBase *cb=0); 118 void setObjectMode(uint8_t mode); 120 119 void setObjectFrequency(unsigned int freq){ objectFrequency_ = freq; } 121 120 122 121 123 122 private: 124 bool getData(uint8_t*& men, unsigned int id, int mode=0x0);125 uint32_t getSize(unsigned int id, int mode=0x0);126 bool updateData(uint8_t*& mem, int mode=0x0, bool forceCallback=false);123 bool getData(uint8_t*& men, unsigned int id, uint8_t mode=0x0); 124 uint32_t getSize(unsigned int id, uint8_t mode=0x0); 125 bool updateData(uint8_t*& mem, uint8_t mode=0x0, bool forceCallback=false); 127 126 bool isMyData(uint8_t* mem); 128 127 bool doSelection(unsigned int id); 129 bool doSync(unsigned int id );128 bool doSync(unsigned int id, uint8_t mode=0x0); 130 129 131 130 unsigned int objectID; … … 134 133 135 134 std::list<synchronisableVariable *> *syncList; 136 static int state_; // detemines wheter we are server (default) or client135 static uint8_t state_; // detemines wheter we are server (default) or client 137 136 bool backsync_; // if true the variables with mode > 1 will be synchronised to server (client -> server) 138 137 unsigned int objectFrequency_;
Note: See TracChangeset
for help on using the changeset viewer.