Changeset 9452 in orxonox.OLD for branches/proxy/src
- Timestamp:
- Jul 25, 2006, 10:52:37 AM (18 years ago)
- Location:
- branches/proxy/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9451 r9452 143 143 if( pInfo->isClient()) 144 144 this->localNode->addClient(pInfo); 145 else if( pInfo->isProxyServer ())145 else if( pInfo->isProxyServerActive()) 146 146 { 147 147 this->localNode->addActiveProxyServer(pInfo); … … 169 169 if( pInfo->isClient()) 170 170 node->addClient(pInfo); 171 else if( pInfo->isProxyServer ())171 else if( pInfo->isProxyServerActive()) 172 172 node->addActiveProxyServer(pInfo); 173 173 else if( pInfo->isMasterServer()) -
branches/proxy/src/lib/network/network_game_manager.cc
r9406 r9452 91 91 bool NetworkGameManager::signalNewPlayer( int userId ) 92 92 { 93 assert( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ());93 assert( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()); 94 94 assert( State::getGameRules() ); 95 95 assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) ); … … 168 168 bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId ) 169 169 { 170 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())170 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 171 171 { 172 172 PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId); … … 229 229 bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId ) 230 230 { 231 assert( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ());231 assert( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()); 232 232 233 233 int teamId = 0; … … 261 261 void NetworkGameManager::prefereTeam( int teamId ) 262 262 { 263 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())263 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 264 264 setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId ); 265 265 else … … 305 305 { 306 306 PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() ); 307 if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ()) && userId != SharedNetworkData::getInstance()->getHostID() )307 if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) && userId != SharedNetworkData::getInstance()->getHostID() ) 308 308 { 309 309 MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH ); … … 347 347 assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE ); 348 348 349 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())349 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 350 350 MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH ); 351 351 else -
branches/proxy/src/lib/network/network_manager.cc
r9450 r9452 129 129 NetworkSettings::getInstance()->loadData(); 130 130 131 // create the network stream 131 // create the network stream af 132 132 this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE); 133 // first connect to the master server for synchronization 134 this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999); 135 // start the handshake with the master server 136 this->networkStream->startHandshake(NET_ID_MASTER_SERVER); 137 // then start the server 133 138 this->networkStream->createServer( port); 134 // and connect to the master server for synchronization135 this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999);136 139 // and to the other proxy servers also, this would be very nice if its works 137 140 -
branches/proxy/src/lib/network/network_stream.cc
r9450 r9452 79 79 case NET_MASTER_SERVER: 80 80 // init the shared network data 81 SharedNetworkData::getInstance()->setHostID( 0);81 SharedNetworkData::getInstance()->setHostID(NET_ID_MASTER_SERVER); 82 82 break; 83 83 84 84 case NET_PROXY_SERVER_ACTIVE: 85 85 // init the shared network data 86 SharedNetworkData::getInstance()->setHostID( 0);86 SharedNetworkData::getInstance()->setHostID(NET_ID_PROXY_SERVER_01); 87 87 break; 88 88 case NET_PROXY_SERVER_PASSIVE: 89 89 // init the shared network data 90 SharedNetworkData::getInstance()->setHostID( 0);90 SharedNetworkData::getInstance()->setHostID(NET_ID_PROXY_SERVER_01); 91 91 break; 92 92 case NET_CLIENT: 93 SharedNetworkData::getInstance()->setHostID(NET_ID_UNASSIGNED); 93 94 break; 94 95 } … … 312 313 this->updateConnectionList(); 313 314 } 314 else if( this->pInfo->isProxyServer ())315 else if( this->pInfo->isProxyServerActive()) 315 316 { 316 317 // execute everything the proxy server should do … … 464 465 PRINT(0)(" Host ist Master Server with ID: %i\n", this->pInfo->userId); 465 466 } 466 else if( SharedNetworkData::getInstance()->isProxyServer ()) {467 else if( SharedNetworkData::getInstance()->isProxyServerActive()) { 467 468 PRINT(0)(" Host ist Proxy Server with ID: %i\n", this->pInfo->userId); 468 469 } … … 568 569 } 569 570 } 570 else if ( this->pInfo->isProxyServer () )571 else if ( this->pInfo->isProxyServerActive() ) 571 572 { 572 573 it->second.nodeType = it->second.handshake->getRemoteNodeType(); … … 714 715 715 716 // if we are a server (both master and proxy servers) and this is not our handshake 716 if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer () ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )717 if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId ) 717 718 continue; 718 719 … … 728 729 729 730 // server fakes uniqueid == 0 for handshake 730 if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer () ) &&731 if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) && 731 732 sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it 732 733 n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset ); … … 780 781 // now compress the data with the zip library 781 782 int compLength = 0; 782 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())783 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 783 784 compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer ); 784 785 else -
branches/proxy/src/lib/network/network_stream.h
r9450 r9452 57 57 inline bool isUserIdActive( int userID ) { return (peers.find(userID) != peers.end()); } 58 58 inline bool isUserMasterServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isMasterServer(); } 59 inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServer (); }59 inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServerActive(); } 60 60 inline bool isUserClient( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isClient(); } 61 61 -
branches/proxy/src/lib/network/peer_info.h
r9445 r9452 23 23 24 24 inline bool isMasterServer() const { return this->nodeType == NET_MASTER_SERVER; } 25 inline bool isProxyServer () const { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }26 inline bool isProxyServer Passive() const { return this->nodeType == NET_PROXY_SERVER_PASSIVE; }25 inline bool isProxyServerActive() const { return this->nodeType == NET_PROXY_SERVER_ACTIVE; } 26 inline bool isProxyServerActivePassive() const { return this->nodeType == NET_PROXY_SERVER_PASSIVE; } 27 27 inline bool isClient() const { return this->nodeType == NET_CLIENT; } 28 28 -
branches/proxy/src/lib/network/player_stats.cc
r9406 r9452 191 191 void PlayerStats::setNickName( std::string nick ) 192 192 { 193 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer () )193 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) 194 194 { 195 195 this->nickName = nick; -
branches/proxy/src/lib/network/shared_network_data.h
r9406 r9452 35 35 inline bool isMasterServer() { return this->nodeType == NET_MASTER_SERVER; } 36 36 /** @returns true is this node is a proxy server */ 37 inline bool isProxyServer () { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }37 inline bool isProxyServerActive() { return this->nodeType == NET_PROXY_SERVER_ACTIVE; } 38 38 /** @returns true is this node is a client*/ 39 39 inline bool isClient() { return this->nodeType == NET_CLIENT; } -
branches/proxy/src/lib/network/synchronizeable.cc
r9406 r9452 72 72 this->networkStream->disconnectSynchronizeable(*this); 73 73 74 if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer () )74 if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) 75 75 && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) ) 76 76 NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() ); … … 213 213 hasPermission = true; 214 214 // now check PROXY_SERVER permissions 215 else if( SharedNetworkData::getInstance()->isProxyServer () && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))215 else if( SharedNetworkData::getInstance()->isProxyServerActive() && (*it)->checkPermission( PERMISSION_MASTER_SERVER )) 216 216 hasPermission = true; 217 217 // now check OWNER permissions … … 225 225 hasPermission = true; 226 226 // SPECIAL: get write permissions if i am proxy server and i am able to overwrite the client stuff 227 else if( SharedNetworkData::getInstance()->isProxyServer () && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))227 else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER )) 228 228 hasPermission = true; 229 229 else -
branches/proxy/src/story_entities/multi_player_world_data.cc
r9406 r9452 112 112 const TiXmlElement* element = NULL; 113 113 114 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())114 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 115 115 { 116 116 /* load the spawning points */ … … 148 148 element = element->FirstChildElement(); 149 149 150 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())150 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 151 151 { 152 152 while( element != NULL) … … 206 206 207 207 208 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())208 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 209 209 { 210 210 this->localPlayer = new Player(); … … 284 284 285 285 // create server playable 286 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())286 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 287 287 { 288 288 NetworkGameManager::getInstance()->signalNewPlayer( 0 ); -
branches/proxy/src/world_entities/creatures/fps_player.cc
r9406 r9452 287 287 //dealing damage 288 288 289 if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ()))289 if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())) 290 290 { 291 291 this->damageTicker -= time; -
branches/proxy/src/world_entities/space_ships/space_ship.cc
r9406 r9452 314 314 if( entity->isA(CL_PROJECTILE) && entity != ref) 315 315 { 316 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())316 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 317 317 { 318 318 //TODO handle this -
branches/proxy/src/world_entities/spawning_point.cc
r9406 r9452 178 178 } 179 179 180 if ( found && SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())180 if ( found && SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 181 181 this->sendRespawnMessage( it->entity->getUniqueID() ); 182 182 … … 218 218 bool SpawningPoint::respawnMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId ) 219 219 { 220 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer ())220 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) 221 221 { 222 222 PRINTF(2)("server received spawn message!\n");
Note: See TracChangeset
for help on using the changeset viewer.