Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8773 in orxonox.OLD


Ignore:
Timestamp:
Jun 25, 2006, 10:45:28 AM (18 years ago)
Author:
rennerc
Message:

true stats sould be shown now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/util/multiplayer_team_deathmatch.cc

    r8772 r8773  
    659659  headers.push_back("Red Team");
    660660  headers.push_back("");
     661  headers.push_back("");
    661662  headers.push_back("Blue Team");
    662663  headers.push_back("");
    663664  this->table->setHeader(headers);
    664665 
    665   this->table->setEntry( 0, 1, "Alain Sutter" );
    666   this->table->setEntry( 1, 1, "0" );
    667   this->table->setEntry( 2, 1, "Koebi Kuhn" );
    668   this->table->setEntry( 3, 1, "3" );
    669 }
    670 
    671 
    672 
    673 
     666  std::map<int,std::string> fragsTeam0;
     667  std::map<int,std::string> fragsTeam1;
     668 
     669  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
     670 
     671  if ( !list )
     672    return;
     673 
     674  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     675  {
     676    PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
     677   
     678    assert( stats.getTeamId() == 0 || stats.getTeamId() == 1 );
     679    if ( stats.getTeamId() == 0 )
     680      fragsTeam0[stats.getScore()] = stats.getNickName();
     681    else
     682      fragsTeam1[stats.getScore()] = stats.getNickName();
     683  }
     684 
     685  char st[10];
     686  int i = 0;
     687 
     688 
     689  i = 2;
     690  for ( std::map<int,std::string>::const_iterator it = fragsTeam0.begin(); it != fragsTeam0.end(); it++ )
     691  {
     692    this->table->setEntry( 0, i, it->second );
     693    snprintf( st, 10, "%d", it->first );
     694    this->table->setEntry( 1, i, st );
     695    this->table->setEntry( 2, i, "" );
     696    i++;
     697  }
     698 
     699  i = 2;
     700  for ( std::map<int,std::string>::const_iterator it = fragsTeam1.begin(); it != fragsTeam1.end(); it++ )
     701  {
     702    this->table->setEntry( 3, i, it->second );
     703    snprintf( st, 10, "%d", it->first );
     704    this->table->setEntry( 4, i, st );
     705    i++;
     706  }
     707}
     708
     709
     710
     711
Note: See TracChangeset for help on using the changeset viewer.