Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9574 in orxonox.OLD for branches/proxy/src


Ignore:
Timestamp:
Jul 28, 2006, 5:01:38 PM (18 years ago)
Author:
patrick
Message:

found the bug, master-server proxy architecture is working correctly. yeaaa

Location:
branches/proxy/src
Files:
4 edited

Legend:

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

    r9571 r9574  
    538538  }
    539539
    540   PRINTF(0)("Current number of connections is: %i\n", this->peers.size());
     540  PRINT(0)(" Current number of connections is: %i\n", this->peers.size());
    541541  for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ )
    542542  {
    543     PRINTF(0)("peers[%i] with uniqueId %i and address: %s\n", it->first, it->second.userId, it->second.ip.ipString().c_str());
    544   }
     543    PRINT(0)("  peers[%i] with uniqueId %i and address: %s\n", it->first, it->second.userId, it->second.ip.ipString().c_str());
     544  }
     545  PRINT(0)("\n\n");
    545546
    546547
  • branches/proxy/src/lib/network/player_stats.cc

    r9564 r9574  
    4141  init();
    4242
    43   this->userId = userId;
     43  this->assignedUserId = userId;
    4444}
    4545
     
    5656  this->setClassID( CL_PLAYER_STATS, "PlayerStats" );
    5757
    58   this->userId = 0;
     58  this->assignedUserId = 0;
    5959  this->teamId = TEAM_NOTEAM;
    6060  this->preferedTeamId = TEAM_NOTEAM;
     
    6565  this->oldNickName = "Player";
    6666
    67   userId_handle = registerVarId( new SynchronizeableInt( &userId, &userId, "userId" ) );
     67  userId_handle = registerVarId( new SynchronizeableInt( &assignedUserId, &assignedUserId, "userId" ) );
    6868  teamId_handle = registerVarId( new SynchronizeableInt( &teamId, &teamId, "teamId" ) );
    6969  preferedTeamId_handle = registerVarId( new SynchronizeableInt( &preferedTeamId, &preferedTeamId, "preferedUserId" ) );
     
    9898    this->setPlayableUniqueId( this->playableUniqueId );
    9999
    100     PRINTF(0)("uniqueID changed %d %d %d\n", userId, SharedNetworkData::getInstance()->getHostID(), getUniqueID());
     100    PRINTF(0)("uniqueID changed %d %d %d\n", assignedUserId, SharedNetworkData::getInstance()->getHostID(), getUniqueID());
    101101  }
    102102
     
    110110  {
    111111    PRINTF(0)("user %s has changed team to %i\n", nickName.c_str(), this->teamId);
    112     this->oldNickName = nickName;
    113112  }
    114113}
     
    135134        it++ )
    136135  {
    137     if ( dynamic_cast<PlayerStats*>(*it)->
    138          getUserId() == userId )
     136
     137
     138    if ( dynamic_cast<PlayerStats*>(*it)->getAssignedUserId() == userId )
    139139    {
    140140      return dynamic_cast<PlayerStats*>(*it);
     
    150150void PlayerStats::setPlayableUniqueId( int uniqueId )
    151151{
     152  PRINTF(0)("set playable unique id %i\n", uniqueId);
    152153  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    153154
     
    174175  }
    175176
    176   if ( this->playable && userId == SharedNetworkData::getInstance()
     177  if ( this->playable && this->assignedUserId == SharedNetworkData::getInstance()
    177178       ->getHostID() )
    178179  {
  • branches/proxy/src/lib/network/player_stats.h

    r9521 r9574  
    4141
    4242    static PlayerStats * getStats( int userId );
     43    inline int getAssignedUserId(){ return this->assignedUserId; }
    4344
    44     inline int getUserId(){ return userId; }
    4545
    4646    inline int getTeamId(){ return teamId; }
     
    8989    int              nickName_handler;
    9090
    91     int              userId;                    //!< userId
     91    int              assignedUserId;            //!< userId
    9292    int              teamId;                    //!< teamId
    9393    int              preferedTeamId;            //!< preferedTeamId
  • branches/proxy/src/util/multiplayer_team_deathmatch.cc

    r9565 r9574  
    195195  }
    196196
    197   if ( box != NULL
    198        && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )
    199        && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() != TEAM_NOTEAM
    200        && !bShowTeamChange
     197
     198  // check if the menu should be removed and the game state should be entered
     199  if ( box != NULL &&
     200       PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) &&
     201       PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() != TEAM_NOTEAM &&
     202       !bShowTeamChange
    201203     )
    202204  {
     205    // this is actualy good
     206//     assert(false);
     207
    203208    delete box;
    204209    box = NULL;
     
    312317  assert( false );
    313318}
     319
    314320
    315321std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, ClassID classId )
     
    444450}
    445451
     452/**
     453 *  this handles team changes but only on the master server
     454 */
    446455void MultiplayerTeamDeathmatch::handleTeamChanges( )
    447456{
     
    460469      if ( stats.getPreferedTeamId() == TEAM_SPECTATOR || ( stats.getPreferedTeamId() >= 0 && stats.getPreferedTeamId() < numTeams ) )
    461470      {
    462         teamChange( stats.getUserId() );
     471        teamChange( stats.getAssignedUserId() );
    463472      }
    464473    }
     
    475484      {
    476485        stats.setPreferedTeamId( getRandomTeam() );
    477         teamChange( stats.getUserId() );
     486        teamChange( stats.getAssignedUserId() );
    478487      }
    479488    }
     
    481490}
    482491
     492
     493
     494/**
     495 * changes the team
     496 * @param userId the user changing team (userId)
     497 */
    483498void MultiplayerTeamDeathmatch::teamChange( int userId )
    484499{
     
    491506
    492507
    493   ClassID     playableClassId = getPlayableClassId( userId, stats.getPreferedTeamId() );
    494   std::string playableModel = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId );
    495   std::string playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId );
    496   float       playableScale = getPlayableScale( userId, stats.getPreferedTeamId(), playableClassId );
     508  ClassID       playableClassId = getPlayableClassId( userId, stats.getPreferedTeamId() );
     509  std::string   playableModel    = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId );
     510  std::string   playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId );
     511  float         playableScale    = getPlayableScale( userId, stats.getPreferedTeamId(), playableClassId );
    497512
    498513  BaseObject * bo = Factory::fabricate( playableClassId );
     
    514529  stats.setTeamId( stats.getPreferedTeamId() );
    515530
    516   playable.setTeam(stats.getPreferedTeamId());
     531//   playable.setTeam(stats.getPreferedTeamId());
    517532
    518533
     
    527542}
    528543
     544
    529545void MultiplayerTeamDeathmatch::onButtonExit( )
    530546{
     
    563579}
    564580
    565   /**
    566    * function that processes events from the handler
    567    * @param event: the event
    568    * @todo replace SDLK_o with something from KeyMapper
    569    */
     581
     582/**
     583 * function that processes events from the handler
     584 * @param event: the event
     585 * @todo replace SDLK_o with something from KeyMapper
     586 */
    570587void MultiplayerTeamDeathmatch::process( const Event & event )
    571588{
Note: See TracChangeset for help on using the changeset viewer.