Changeset 10114 in orxonox.OLD for trunk/src/lib/network
- Timestamp:
- Dec 19, 2006, 11:55:26 PM (18 years ago)
- Location:
- trunk/src/lib/network
- Files:
-
- 9 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/Makefile.am
r9656 r10114 43 43 synchronizeable_var/synchronizeable_uint.cc \ 44 44 synchronizeable_var/synchronizeable_ip.cc \ 45 synchronizeable_var/synchronizeable_classid.cc \ 46 synchronizeable_var/synchronizeable_classid_list.cc \ 45 47 \ 46 48 ip.cc … … 94 96 synchronizeable_var/synchronizeable_uint.h \ 95 97 synchronizeable_var/synchronizeable_ip.h \ 98 synchronizeable_var/synchronizeable_classid.h \ 99 synchronizeable_var/synchronizeable_classid_list.h \ 96 100 \ 97 101 ip.h -
trunk/src/lib/network/handshake.cc
r9869 r10114 22 22 #include "debug.h" 23 23 24 #include "synchronizeable_var/synchronizeable_classid_list.h" 25 26 std::map< std::string, int >* Handshake::classIdList = NULL; 24 27 25 28 ObjectListDefinition(Handshake); … … 32 35 this->registerObject(this, Handshake::_objectList); 33 36 37 if ( !Handshake::classIdList ) 38 { 39 //TODO who else? 40 if ( SharedNetworkData::getInstance()->isMasterServer() ) 41 { 42 Handshake::classIdList = ObjectListBase::createStrToId(); 43 } 44 else 45 { 46 Handshake::classIdList = new std::map< std::string, int >(); 47 } 48 } 34 49 35 50 // register all variable handlers … … 52 67 registerVar( new SynchronizeableIP( &this->proxy2, &this->proxy2, "proxy server 2", PERMISSION_MASTER_SERVER ) ); 53 68 registerVar( new SynchronizeableInt( &this->redirectProxy, &this->redirectProxy, "proxy server redirection flag", PERMISSION_MASTER_SERVER ) ); 69 70 registerVar( new SynchronizeableClassIDList( Handshake::classIdList, Handshake::classIdList, "classId List", PERMISSION_MASTER_SERVER ) ); 54 71 55 72 -
trunk/src/lib/network/handshake.h
r9869 r10114 113 113 int errorString_handler; //!< handshake error string handler 114 114 int candel_id; //!< handshake deletion handler 115 int nodeType; //! ,the type of the network node115 int nodeType; //!< the type of the network node 116 116 117 117 int redirectProxy; //!< true if the client should reconnect to a proxy server 118 118 IP proxy1; //!< ip address of the first proxy (0.0.0.0 of not available) 119 119 IP proxy2; //!< ip address of the second proxy (0.0.0.0 of not available) 120 121 static std::map< std::string, int >* classIdList; 122 public: 123 std::map< std::string, int >* getClassIdList(){ return classIdList; } 120 124 }; 121 125 -
trunk/src/lib/network/message_manager.cc
r9869 r10114 242 242 assert( i + messageLength <= length ); 243 243 // make sure there is a message handler for this message type 244 //if ( !( messageHandlerMap.find( (MessageType)messageType ) != messageHandlerMap.end()) ) 245 //{ 246 // PRINTF(0)("messagetype: %d\n", messageType); 247 // this->objectList().debugAll( 0 ); 248 // } 249 244 250 assert( messageHandlerMap.find( (MessageType)messageType ) != messageHandlerMap.end()); 245 251 -
trunk/src/lib/network/network_game_manager.cc
r9869 r10114 111 111 playable.loadMD2Texture( playableTexture ); 112 112 playable.setTeam(team); 113 playable.loadModel( playableModel, 100.0f);113 playable.loadModel( playableModel, playableScale ); 114 114 playable.setOwner( userId ); 115 115 playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); -
trunk/src/lib/network/network_stream.cc
r9869 r10114 128 128 129 129 this->bRedirect = false; 130 this->bSoftRedirect = false; 130 131 131 132 this->currentState = 0; … … 716 717 // init the new message manager 717 718 MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() ); 719 ObjectListBase::replaceIDMap( *(it->second.handshake->getClassIdList()) ); 718 720 } 719 721 … … 966 968 967 969 // if handshake not finished only sync handshake 968 if ( peer->second.handshake && Handshake::staticClassID() != sync.get LeafClassID())970 if ( peer->second.handshake && Handshake::staticClassID() != sync.getClassID() ) 969 971 continue; 970 972 … … 972 974 if ( ( SharedNetworkData::getInstance()->isMasterServer() || 973 975 SharedNetworkData::getInstance()->isProxyServerActive() && peer->second.isClient()) 974 && Handshake::staticClassID() == sync.get LeafClassID() && sync.getUniqueID() != peer->second.userId )976 && Handshake::staticClassID() == sync.getClassID() && sync.getUniqueID() != peer->second.userId ) 975 977 continue; 976 978 977 979 /* list of synchronizeables that will never be synchronized over the network: */ 978 980 // do not sync null parent 979 if ( NullParent::staticClassID() == sync.get LeafClassID())981 if ( NullParent::staticClassID() == sync.getClassID()) 980 982 continue; 981 983 982 984 983 assert( sync.get LeafClassID() != 0);985 assert( sync.getClassID() != 0); 984 986 985 987 assert( offset + INTSIZE <= UDP_PACKET_SIZE ); … … 1188 1190 if( NullParent::staticClassID() == leafClassId || Synchronizeable::staticClassID() == leafClassId || NetworkGameManager::staticClassID() == leafClassId) 1189 1191 { 1190 PRINTF( 1)("Don't create Object with ID %x, ignored!\n", (int)leafClassId);1192 PRINTF(0)("Don't create Object with ID %d, ignored!\n", (int)leafClassId); 1191 1193 offset += syncDataLength; 1192 1194 continue; 1193 1195 } 1194 1196 else 1195 ; /// FIXME CLASS_ID :: b = Factory::fabricate( leafClassId);1196 1197 b = Factory::fabricate( ObjectListBase::retrieveIdentity( leafClassId ) ); 1198 1197 1199 if ( !b ) 1198 1200 { 1199 PRINTF(1)("Could not fabricate Object with classID % x\n", leafClassId);1201 PRINTF(1)("Could not fabricate Object with classID %d\n", leafClassId); 1200 1202 offset += syncDataLength; 1201 1203 continue; … … 1208 1210 sync->setSynchronized(true); 1209 1211 1210 PRINTF( 0)("Fabricated %s with id %d\n", sync->getClassCName(), sync->getUniqueID());1212 PRINTF(1)("Fabricated %s with id %d\n", sync->getClassCName(), sync->getUniqueID()); 1211 1213 } 1212 1214 else 1213 1215 { 1214 PRINTF(1)("Class with ID % xis not a synchronizeable!\n", (int)leafClassId);1216 PRINTF(1)("Class with ID %d is not a synchronizeable!\n", (int)leafClassId); 1215 1217 delete b; 1216 1218 offset += syncDataLength; -
trunk/src/lib/network/peer_info.h
r9656 r10114 36 36 int userId; //!< id of this network node 37 37 int nodeType; //!< type of this network node 38 IP ip; //! >the ip address of this network node38 IP ip; //!< the ip address of this network node 39 39 40 40 NetworkSocket * socket; //!< socket connecting to this node -
trunk/src/lib/network/player_stats.cc
r9869 r10114 30 30 #include "shell_command.h" 31 31 32 #include "class_id_DEPRECATED.h" 33 34 ObjectListDefinition ID(PlayerStats, CL_PLAYER_STATS);32 33 34 ObjectListDefinition(PlayerStats); 35 35 CREATE_FACTORY(PlayerStats); 36 36 -
trunk/src/lib/network/synchronizeable.cc
r9869 r10114 30 30 31 31 #include "converter.h" 32 33 #include "synchronizeable_var/synchronizeable_classid.h" 32 34 33 35 … … 56 58 /* make sure loadClassId is first synced var because this is read by networkStream */ 57 59 assert( syncVarList.size() == 0 ); 58 mLeafClassId = this->registerVarId( new SynchronizeableInt( (int*)&this->getLeafClassID(), (int*)&this->getLeafClassID(), "leafClassId", PERMISSION_MASTER_SERVER) ); 60 assert( this->getClassID() == this->objectList().id() ); 61 62 mLeafClassId = this->registerVarId( new SynchronizeableClassID( this, "leafClassId", PERMISSION_MASTER_SERVER) ); 59 63 60 64 this->registerVar( new SynchronizeableInt( &this->owner, &this->owner, "owner", PERMISSION_MASTER_SERVER ) ); … … 267 271 // PRINTF(0)("sending %s %d\n", (*it)->getName().c_str(), n); 268 272 269 // if( this->isA( CL_PLAYABLE))273 // if( this->isA( Playable::staticClassID() )) 270 274 // { 271 275 // PRINTF(0)("ms: %i, ps: %i, c: %i, sender: %i, reciever: %i, owner: %i, perm: (ow %i, ms %i, s %i, a %i)\n", … … 453 457 //(*it)->debug(); 454 458 455 // if( this->isA( CL_PLAYABLE))459 // if( this->isA(Playable::staticClassID())) 456 460 // { 457 461 // PRINTF(0)("ms: %i, ps: %i, c: %i, sender: %i, reciever: %i, owner: %i, perm: (ow %i, ms %i, s %i, a %i)\n",
Note: See TracChangeset
for help on using the changeset viewer.