Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9470 in orxonox.OLD


Ignore:
Timestamp:
Jul 25, 2006, 10:23:17 PM (18 years ago)
Author:
patrick
Message:

heavy permissions fight: no node was ever thought to be client and server at the same time, proxy server are hybrid nodes so there is need for a big framework extension.

  • made the obb creation saver
  • prevented segfaults in the aabb tree creation, this was very dangerous code
  • inserted handshake hack to make the handshake work.

No I will have to get the handshake right so the node works correctly

Location:
branches/proxy/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/collision_detection/aabb_tree_node.cc

    r9406 r9470  
    6666{
    6767  this->depth = depth;
     68
     69  this->init();
    6870}
    6971
     
    8789
    8890  this->owner = NULL;
    89 
    90   /* debug ids */
    91   if( this->nodePrev)
    92     this->treeIndex = 100 * this->depth + this->nodePrev->getID();
    93   else
    94     this->treeIndex = 0;
    9591}
    9692
  • branches/proxy/src/lib/network/network_game_manager.cc

    r9452 r9470  
    9191bool NetworkGameManager::signalNewPlayer( int userId )
    9292{
    93   assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive());
     93  assert( SharedNetworkData::getInstance()->isMasterServer() /*||  SharedNetworkData::getInstance()->isProxyServerActive()*/);
    9494  assert( State::getGameRules() );
    9595  assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
     
    168168bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    169169{
    170   if ( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive())
     170  if ( SharedNetworkData::getInstance()->isMasterServer() /*||  SharedNetworkData::getInstance()->isProxyServerActive()*/)
    171171  {
    172172    PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId);
     
    229229bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    230230{
    231   assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive());
     231  assert( SharedNetworkData::getInstance()->isMasterServer() /*||  SharedNetworkData::getInstance()->isProxyServerActive()*/);
    232232
    233233  int teamId = 0;
     
    261261void NetworkGameManager::prefereTeam( int teamId )
    262262{
    263   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
     263  if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/)
    264264    setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId );
    265265  else
     
    305305{
    306306  PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() );
    307   if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) && userId !=  SharedNetworkData::getInstance()->getHostID() )
     307  if ( (SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) && userId !=  SharedNetworkData::getInstance()->getHostID() )
    308308  {
    309309    MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
     
    347347  assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE );
    348348
    349   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
     349  if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/)
    350350    MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH );
    351351  else
  • branches/proxy/src/lib/network/network_manager.cc

    r9467 r9470  
    131131
    132132  // create the network stream af
    133   this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE);
     133  this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE );
    134134  // first connect to the master server for synchronization
    135135  this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999);
  • branches/proxy/src/lib/network/network_stream.cc

    r9468 r9470  
    208208 * @param port: the port number
    209209 */
    210 void NetworkStream::connectToProxyServer(int proxyId,std::string host, int port)
     210void NetworkStream::connectToProxyServer(int proxyId, std::string host, int port)
    211211{
    212212  PRINTF(0)("connect to proxy %s, this is proxyId %i\n", host.c_str(), proxyId);
     
    253253void NetworkStream::startHandshake(int userId)
    254254{
    255   Handshake* hs = new Handshake(this->pInfo->nodeType);
     255  Handshake* hs = new Handshake(NET_CLIENT/* this->pInfo->nodeType*/);
    256256  // fake the unique id
    257257  hs->setUniqueID( NET_UID_HANDSHAKE );
     
    323323    this->updateConnectionList();
    324324  }
    325   else if( this->pInfo->isProxyServerActive())
    326   {
     325//   else if( this->pInfo->isProxyServerActive())
     326//   {
    327327    // execute everything the proxy server should do
    328     if ( this->clientSocket )
    329       this->clientSocket->update();
    330     if( this->proxySocket)
    331       this->proxySocket->update();
    332 
    333     this->updateConnectionList();
    334   }
     328
     329//     if ( this->clientSocket )
     330//       this->clientSocket->update();
     331//     if( this->proxySocket)
     332//       this->proxySocket->update();
     333//
     334//     this->updateConnectionList();
     335//   }
    335336  else
    336337  {
     
    554555          {
    555556            // make sure this is a client
    556             if( this->pInfo->isClient())
     557            if( this->pInfo->isClient() || SharedNetworkData::getInstance()->isProxyServerActive())
    557558            {
    558559              SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
     
    752753
    753754      // if we are a server (both master and proxy servers) and this is not our handshake
    754       if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
     755      if ( ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/ ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
    755756        continue;
    756757
     
    766767
    767768      // server fakes uniqueid == 0 for handshake
    768       if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) &&
     769      if ( ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive() */) &&
    769770             sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it
    770771        n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
     
    818819    // now compress the data with the zip library
    819820    int compLength = 0;
    820     if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
     821    if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/)
    821822      compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer );
    822823    else
     
    936937
    937938          // if the node we got this unknown sync from is a client we ignore it (since it has no rights to create a new sync)
    938           if ( peers[peer->second.userId].isClient() )
     939          if ( peers[peer->second.userId].isClient() || peers[peer->second.userId].isProxyServerActive())
    939940          {
    940941            offset += syncDataLength;
  • branches/proxy/src/lib/network/peer_info.cc

    r9445 r9470  
    5858  return PeerInfo::nodeTypeToString( this->nodeType );
    5959  // the above does the same, and is faster in it. (there is no case where node is uninit i hope!)
    60 /*
    61   switch( this->nodeType)
    62   {
    63     case NET_CLIENT:
    64       return std::string("client");
    65     case NET_PROXY_SERVER_ACTIVE:
    66       return std::string("proxy server active");
    67     case NET_PROXY_SERVER_PASSIVE:
    68       return std::string("proxy server passive");
    69     case NET_MASTER_SERVER:
    70       return std::string("master server");
    71   }
    72 
    73   return std::string("node is uninit");*/
    7460}
    7561
  • branches/proxy/src/lib/network/shared_network_data.h

    r9452 r9470  
    2828
    2929    /** @returns the next uniqueID free for an object */
    30     inline int getNewUniqueID() { return ( this->nodeType != NET_CLIENT)?this->newUniqueID++:-1; }
     30    inline int getNewUniqueID() { return ( isMasterServer())?this->newUniqueID++:-1; }
    3131    /** sets the @param newUniqueID: the new offset for the next unique id */
    3232    inline void setNewUniqueID(int newUniqueID) { this->newUniqueID = newUniqueID; }
  • branches/proxy/src/util/game_rules.cc

    r9406 r9470  
    8787void GameRules::registerKill(const Kill& kill)
    8888{
    89   if ( SharedNetworkData::getInstance()->isClient() )
     89  if ( SharedNetworkData::getInstance()->isClient() || SharedNetworkData::getInstance()->isProxyServerActive())
    9090    return;
    9191
  • branches/proxy/src/util/multiplayer_team_deathmatch.cc

    r9455 r9470  
    152152      box->setAbsCoor2D( 300, 100 );
    153153
    154       if( SharedNetworkData::getInstance()->isClient())
     154      if( SharedNetworkData::getInstance()->isClient() ||  SharedNetworkData::getInstance()->isProxyServerActive())
    155155      {
    156156        OrxGui::GLGuiPushButton * buttonSpectator = new OrxGui::GLGuiPushButton("Spectator");
     
    214214  assignPlayable();
    215215
    216   if ( SharedNetworkData::getInstance()->isClient() )
     216  if ( SharedNetworkData::getInstance()->isClient() || SharedNetworkData::getInstance()->isProxyServerActive())
    217217    return;
    218218
     
    278278void MultiplayerTeamDeathmatch::checkGameRules()
    279279{
    280   if ( SharedNetworkData::getInstance()->isClient() )
     280  if ( SharedNetworkData::getInstance()->isClient() || SharedNetworkData::getInstance()->isProxyServerActive())
    281281    return;
    282282
  • branches/proxy/src/world_entities/creatures/fps_player.cc

    r9452 r9470  
    287287  //dealing damage
    288288
    289   if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()))
     289  if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/))
    290290  {
    291291    this->damageTicker -= time;
  • branches/proxy/src/world_entities/space_ships/space_ship.cc

    r9452 r9470  
    310310void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
    311311{
    312   Playable::collidesWith(entity, location);
    313 
    314   if( entity->isA(CL_PROJECTILE) && entity != ref)
    315   {
    316     if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    317     {
    318       //TODO handle this
    319     }
    320   }
    321   PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z);
     312
    322313}
    323314
  • branches/proxy/src/world_entities/world_entity.cc

    r9406 r9470  
    257257bool WorldEntity::buildObbTree(int depth)
    258258{
    259   if (this->obbTree)
     259  if( this->obbTree != NULL)
     260  {
    260261    delete this->obbTree;
     262    this->obbTree = NULL;
     263  }
    261264
    262265  if (this->models[0] != NULL)
     
    280283    this->aabbNode = new AABBTreeNode();
    281284    this->aabbNode->spawnBVTree(this->models[0]);
     285  }
     286  else
     287  {
     288    PRINTF(1)("could not create aabb bounding box, because no model was loaded yet\n");
     289    this->aabbNode = NULL;
     290    return false;
    282291  }
    283292  return true;
Note: See TracChangeset for help on using the changeset viewer.