Changeset 1940 for code/branches/objecthierarchy/src/network
- Timestamp:
- Oct 18, 2008, 10:58:46 PM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/network
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/CMakeLists.txt
r1938 r1940 22 22 23 23 IF(WIN32) 24 ADD_LIBRARY( network SHARED${NETWORK_SRC_FILES} )24 ADD_LIBRARY( network ${NETWORK_SRC_FILES} ) 25 25 ELSE(WIN32) 26 26 ADD_LIBRARY( network SHARED ${NETWORK_SRC_FILES} ) -
code/branches/objecthierarchy/src/network/ClientConnectionListener.h
r1939 r1940 8 8 namespace network{ 9 9 10 class _NetworkExport ClientConnectionListener : public orxonox::OrxonoxClass10 class _NetworkExport ClientConnectionListener : virtual public orxonox::OrxonoxClass 11 11 { 12 friend class Server; 13 12 14 public: 13 15 ClientConnectionListener(); 16 virtual ~ClientConnectionListener() {} 14 17 15 18 void getConnectedClients(); 16 19 20 protected: 17 21 virtual void clientConnected(unsigned int clientID) = 0; 18 22 virtual void clientDisconnected(unsigned int clientID) = 0; -
code/branches/objecthierarchy/src/network/GamestateClient.cc
r1917 r1940 77 77 packet::Gamestate *processed = processGamestate(tempGamestate_); 78 78 // assert(processed); 79 if (!processed) 80 return false; 79 81 //successfully loaded data from gamestate. now save gamestate for diff and delete the old gs 80 82 tempGamestate_=NULL; -
code/branches/objecthierarchy/src/network/Synchronisable.cc
r1907 r1940 51 51 namespace network 52 52 { 53 53 54 54 55 55 std::map<unsigned int, Synchronisable *> Synchronisable::objectMap_; … … 68 68 objectMode_=0x1; // by default do not send data to server 69 69 objectID=idCounter++; 70 classID = (unsigned int)-1; 70 71 syncList = new std::list<synchronisableVariable *>; 71 72 } 72 73 73 74 /** 74 * Destructor: 75 * Destructor: 75 76 * Delete all callback objects and remove objectID from the objectMap_ 76 77 */ … … 96 97 this->classID = this->getIdentifier()->getNetworkID(); 97 98 // COUT(4) << "creating synchronisable: setting classid from " << this->getIdentifier()->getName() << " to: " << classID << std::endl; 98 99 99 100 // COUT(3) << "construct synchronisable +++" << objectID << " | " << classID << std::endl; 100 101 // objectMap_[objectID]=this; … … 145 146 } 146 147 147 148 148 149 /** 149 150 * Finds and deletes the Synchronisable with the appropriate objectID … … 164 165 return true; 165 166 } 166 167 167 168 /** 168 169 * This function looks up the objectID in the objectMap_ and returns a pointer to the right Synchronisable … … 185 186 } 186 187 187 188 188 189 /** 189 190 * This function is used to register a variable to be synchronized … … 240 241 if(classID==0) 241 242 COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl; 243 244 if (this->classID == (unsigned int)-1) 245 this->classID = this->getIdentifier()->getNetworkID(); 246 242 247 assert(this->classID==this->getIdentifier()->getNetworkID()); 243 248 // this->classID=this->getIdentifier()->getNetworkID(); // TODO: correct this … … 314 319 assert(this->objectID==syncHeader->objectID); 315 320 // assert(this->classID==syncHeader->classID); //TODO: fix this!!! maybe a problem with the identifier ? 316 321 317 322 COUT(5) << "Synchronisable: objectID " << syncHeader->objectID << ", classID " << syncHeader->classID << " size: " << syncHeader->size << " synchronising data" << std::endl; 318 323 for(i=syncList->begin(); i!=syncList->end() && mem <= data+syncHeader->size; i++){ -
code/branches/objecthierarchy/src/network/Synchronisable.h
r1916 r1940 41 41 #include "util/Integers.h" 42 42 43 #define REGISTERDATA(varname ) registerVar(&varname, sizeof(varname), network::DATA)44 #define REGISTERDATA_WITHDIR(varname, mode) registerVar(&varname, sizeof(varname), network::DATA, mode)45 #define REGISTERSTRING(stringname ) registerVar(&stringname, stringname.length()+1, network::STRING)46 #define REGISTERSTRING_WITHDIR(stringname, mode) registerVar(&stringname, stringname.length()+1, network::STRING, mode)43 #define REGISTERDATA(varname, ...) \ 44 registerVar((void*)&varname, sizeof(varname), network::DATA, __VA_ARGS__) 45 #define REGISTERSTRING(stringname, ...) \ 46 registerVar(&stringname, stringname.length()+1, network::STRING, __VA_ARGS__) 47 47 48 48 namespace network … … 112 112 void setObjectMode(int mode); 113 113 void setObjectFrequency(unsigned int freq){ objectFrequency_ = freq; } 114 virtual void registerAllVariables()=0;115 114 116 115 -
code/branches/objecthierarchy/src/network/packet/Packet.cc
r1907 r1940 49 49 50 50 namespace packet{ 51 51 52 52 #define PACKET_FLAG_DEFAULT ENET_PACKET_FLAG_NO_ALLOCATE 53 53 #define _PACKETID 0 54 54 55 55 std::map<ENetPacket *, Packet *> Packet::packetMap_; 56 56 57 57 Packet::Packet(){ 58 58 flags_ = PACKET_FLAG_DEFAULT; … … 112 112 packetMap_[enetPacket_] = this; 113 113 } 114 #ifndef NDEBUG 114 #ifndef NDEBUG 115 115 switch( *(ENUM::Type *)(data_ + _PACKETID) ) 116 116 {
Note: See TracChangeset
for help on using the changeset viewer.