Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9272 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 13, 2006, 3:17:50 PM (18 years ago)
Author:
patrick
Message:

tighten up the interface

Location:
branches/proxy/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/handshake.cc

    r9270 r9272  
    3030  /* set the class id for the base object */
    3131  this->setClassID(CL_HANDSHAKE, "Handshake");
    32 
    33   this->setIsServer( nodeType == NET_MASTER_SERVER);
    3432
    3533  // register all variable handlers
  • branches/proxy/src/lib/network/network_game_manager.cc

    r9257 r9272  
    168168bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    169169{
    170   if ( getInstance()->isServer() )
     170  if ( SharedNetworkData::getInstance()->isMasterServer() )
    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( NetworkGameManager::getInstance()->isServer() );
     231  assert( SharedNetworkData::getInstance()->isMasterServer() );
    232232
    233233  int teamId = 0;
     
    261261void NetworkGameManager::prefereTeam( int teamId )
    262262{
    263   if ( isServer() )
     263  if ( SharedNetworkData::getInstance()->isMasterServer() )
    264264    setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId );
    265265  else
     
    305305{
    306306  PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() );
    307   if ( NetworkGameManager::getInstance()->isServer() && userId !=  SharedNetworkData::getInstance()->getHostID() )
     307  if ( SharedNetworkData::getInstance()->isMasterServer() && 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 ( this->isServer() )
     349  if ( SharedNetworkData::getInstance()->isMasterServer() )
    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_monitor.cc

    r9267 r9272  
    3232NetworkMonitor::NetworkMonitor(NetworkStream* networkStream)
    3333{
    34 
     34  this->playerNumber = 0;
    3535}
    3636
     
    4949{
    5050  this->clientList.push_back(node);
     51  this->playerNumber++;
    5152}
    5253
     
    5758{
    5859  this->proxyServerList.push_back(node);
     60  this->playerNumber++;
    5961}
    6062
     
    6567{
    6668  this->masterServerList.push_back(node);
     69  this->playerNumber++;
    6770}
    6871
     
    7881    {
    7982      this->clientList.erase(it);
     83      this->playerNumber--;
    8084      return;
    8185    }
     
    96100    {
    97101      this->proxyServerList.erase(it);
     102      this->playerNumber--;
    98103      return;
    99104    }
     
    114119    {
    115120      this->masterServerList.erase(it);
     121      this->playerNumber--;
    116122      return;
    117123    }
  • branches/proxy/src/lib/network/network_monitor.h

    r9269 r9272  
    4545
    4646    OrxGui::GLGuiBox*            box;
     47
     48    int                          playerNumber;                 //!< total number of players in the game
    4749};
    4850
  • branches/proxy/src/lib/network/synchronizeable.cc

    r9261 r9272  
    3838  this->setClassID(CL_SYNCHRONIZEABLE, "Synchronizeable");
    3939  this->owner = 0;
    40   this->setIsServer(SharedNetworkData::getInstance()->getHostID() == 0);
     40//   this->setIsServer(SharedNetworkData::getInstance()->getHostID() == 0);
    4141  this->uniqueID = NET_UID_UNASSIGNED;
    4242  this->networkStream = NULL;
     
    7070    this->networkStream->disconnectSynchronizeable(*this);
    7171
    72     if ( this->isServer() && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
     72    if ( SharedNetworkData::getInstance()->isMasterServer() && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
    7373      NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() );
    7474  }
     
    113113 * @param isServer: the boolean value which the server flag is to set to
    114114 */
    115 void Synchronizeable::setIsServer(bool isServer)
    116 {
    117   if( isServer )
    118     this->state = this->state | STATE_SERVER;
    119   else
    120     this->state = this->state & (~STATE_SERVER);
    121 }
     115// void Synchronizeable::setIsServer(bool isServer)
     116// {
     117//   if( isServer )
     118//     this->state = this->state | STATE_SERVER;
     119//   else
     120//     this->state = this->state & (~STATE_SERVER);
     121// }
    122122
    123123
     
    126126 * @return true, if the server flag is true, false else
    127127 */
    128 bool Synchronizeable::isServer()
    129 {
    130   return (this->state & STATE_SERVER) >0;
    131 }
     128// bool Synchronizeable::isServer()
     129// {
     130//   return (this->state & STATE_SERVER) >0;
     131// }
    132132
    133133
     
    222222  {
    223223    hasPermission = (
    224             this->isServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ) ||
     224        SharedNetworkData::getInstance()->isMasterServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ) ||
    225225        this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ) ||
    226             this->isServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ) ||
     226        SharedNetworkData::getInstance()->isMasterServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ) ||
    227227            (*it)->checkPermission( PERMISSION_ALL )
    228228                    );
  • branches/proxy/src/lib/network/synchronizeable.h

    r8708 r9272  
    5151    virtual ~Synchronizeable();
    5252
    53     void setIsServer( bool isServer );
    54     bool isServer();
     53//     void setIsServer( bool isServer );
     54//     bool isServer();
    5555
    5656    virtual void varChangeHandler( std::list<int> & id );
     
    6161    virtual void handleSentState( int userId, int stateId, int fromStateId );
    6262    virtual void handleRecvState( int userId, int stateId, int fromStateId );
    63    
     63
    6464    void registerVar( SynchronizeableVar * var );
    6565    int registerVarId( SynchronizeableVar * var );
     
    8282  protected:
    8383    NetworkStream*    networkStream;  //!< reference network stream we are connected to
    84     int               state;
     84//     int               state;
    8585
    8686  private:
  • branches/proxy/src/world_entities/space_ships/space_ship.cc

    r9235 r9272  
    314314  if( entity->isA(CL_PROJECTILE) && entity != ref)
    315315  {
    316     if ( isServer() )
     316    if ( SharedNetworkData::getInstance()->isMasterServer() )
    317317    {
    318318      //TODO handle this
Note: See TracChangeset for help on using the changeset viewer.