Example #1
0
void TeamBox::SetTeam(Team& _team, bool read_team_values)
{
  Team* old_team = associated_team;

  associated_team = &_team;

  if (_team.IsRemote()) {
    team_name->SetFont(dark_gray_color, Font::FONT_MEDIUM, Font::FONT_BOLD, false);

    // translators: this is the team listing and will expand in a context like "OOo team - Remote"
    team_name->SetText(Format(_("%s Team - Remote"), _team.GetName().c_str()));

    if (previous_custom_team) {
      previous_custom_team->SetVisible(false);
      next_custom_team->SetVisible(false);
    }
  } else {
    team_name->SetFont(primary_red_color, Font::FONT_MEDIUM, Font::FONT_BOLD, true);
    team_name->SetText(Format(_("%s Team"), _team.GetName().c_str()));

    if (previous_custom_team) {
      previous_custom_team->SetVisible(true);
      next_custom_team->SetVisible(true);
    }
  }
  UpdatePlayerType();
  team_logo->SetSurface(_team.GetFlag());

  // Update group
  SetGroup(_team.GetGroup());

  if (read_team_values) {
    player_name->SetText(_team.GetPlayerName());
    nb_characters->SetValue(_team.GetNbCharacters());
    for (uint i=0; i<4; i++) {
      if (ai_names[i] == _team.GetAIName()) {
        SetAILevel(i);
        break;
      }
    }
  } else if (old_team) {
    UpdateTeam(old_team->GetId());
  }
  previous_player_name = player_name->GetText();

  NeedRedrawing();
}
  //
  // TeamListBox::BuildTeamList
  //
  void TeamListBox::BuildTeamList()
  {
    DeleteAllItems();

    for (U32 i = 0; i < Game::MAX_TEAMS; i++)
    {
      Team *team = Team::Id2Team(i);
      if (team)
      {
        AddTextItem(team->GetName(), NULL);
      }
    } 
  }