Remove display::team_valid

It's already checked when it's set
This commit is contained in:
Charles Dang 2024-08-31 16:44:22 -04:00
parent 1e1db849fd
commit 7fa4fe483c
5 changed files with 2 additions and 21 deletions

View file

@ -661,11 +661,6 @@ const display::rect_of_hexes display::hexes_under_rect(const SDL_Rect& r) const
return res;
}
bool display::team_valid() const
{
return currentTeam_ < dc_->teams().size();
}
bool display::shrouded(const map_location& loc) const
{
return is_blindfolded() || (dont_show_all_ && dc_->teams()[currentTeam_].shrouded(loc));

View file

@ -111,8 +111,6 @@ public:
/** The playing team is the team whose turn it is. */
std::size_t playing_team() const { return activeTeam_; }
bool team_valid() const;
/**
* The viewing team is the team currently viewing the game. It's the team whose gold and income
* is shown in the top bar of the default theme.

View file

@ -347,9 +347,6 @@ void game_display::layout()
{
display::layout();
if ( !team_valid() )
return;
refresh_report("report_clock");
refresh_report("report_battery");
refresh_report("report_countdown");
@ -629,11 +626,7 @@ void game_display::clear_attack_indicator()
std::string game_display::current_team_name() const
{
if (team_valid())
{
return dc_->teams()[currentTeam_].team_name();
}
return std::string();
return dc_->teams()[currentTeam_].team_name();
}
void game_display::begin_game()

View file

@ -829,7 +829,7 @@ void menu_handler::label_terrain(mouse_handler& mousehandler, bool team_only)
void menu_handler::clear_labels()
{
if(gui_->team_valid() && !board().is_observer()) {
if(!board().is_observer()) {
const int res = gui2::show_message(
_("Clear Labels"),
_("Are you sure you want to clear map labels?"),

View file

@ -156,11 +156,6 @@ unit_drawer::unit_drawer(display& thedisp)
if(const game_display* game_display = dynamic_cast<class game_display*>(&disp)) {
units_that_can_reach_goal = game_display->units_that_can_reach_goal();
}
// This used to be checked in the drawing code, where it simply triggered skipping some logic.
// However, I think it's obsolete, and that the initialization of viewing_team_ref would already
// be undefined behavior in the situation where this assert fails.
assert(disp.team_valid());
}
void unit_drawer::redraw_unit(const unit& u) const