Display: rename team index functions/members for clarity
This commit is contained in:
parent
25de2962ae
commit
93cfddaa27
5 changed files with 23 additions and 24 deletions
|
@ -151,7 +151,7 @@ display::display(const display_context* dc,
|
|||
, halo_man_()
|
||||
, wb_(wb)
|
||||
, exclusive_unit_draw_requests_()
|
||||
, currentTeam_(0)
|
||||
, viewing_team_index_(0)
|
||||
, dont_show_all_(false)
|
||||
, xpos_(0)
|
||||
, ypos_(0)
|
||||
|
@ -189,7 +189,7 @@ display::display(const display_context* dc,
|
|||
, animate_map_(true)
|
||||
, animate_water_(true)
|
||||
, flags_()
|
||||
, activeTeam_(0)
|
||||
, playing_team_index_(0)
|
||||
, drawing_buffer_()
|
||||
, map_screenshot_(false)
|
||||
, reach_map_()
|
||||
|
@ -344,10 +344,10 @@ const team& display::viewing_team() const
|
|||
return dc_->teams()[viewing_team_index()];
|
||||
}
|
||||
|
||||
void display::set_team(std::size_t teamindex, bool show_everything)
|
||||
void display::set_viewing_team_index(std::size_t teamindex, bool show_everything)
|
||||
{
|
||||
assert(teamindex < dc_->teams().size());
|
||||
currentTeam_ = teamindex;
|
||||
viewing_team_index_ = teamindex;
|
||||
if(!show_everything) {
|
||||
labels().set_team(&dc_->teams()[teamindex]);
|
||||
dont_show_all_ = true;
|
||||
|
@ -361,10 +361,10 @@ void display::set_team(std::size_t teamindex, bool show_everything)
|
|||
}
|
||||
}
|
||||
|
||||
void display::set_playing_team(std::size_t teamindex)
|
||||
void display::set_playing_team_index(std::size_t teamindex)
|
||||
{
|
||||
assert(teamindex < dc_->teams().size());
|
||||
activeTeam_ = teamindex;
|
||||
playing_team_index_ = teamindex;
|
||||
invalidate_game_status();
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
const std::vector<team>& get_teams() const {return dc_->teams();}
|
||||
|
||||
/** The playing team is the team whose turn it is. */
|
||||
std::size_t playing_team_index() const { return activeTeam_; }
|
||||
std::size_t playing_team_index() const { return playing_team_index_; }
|
||||
|
||||
/**
|
||||
* The viewing team is the team currently viewing the game. It's the team whose gold and income
|
||||
|
@ -119,7 +119,7 @@ public:
|
|||
*
|
||||
* The value returned is a 0-based index into the vector returned by get_teams().
|
||||
*/
|
||||
std::size_t viewing_team_index() const { return currentTeam_; }
|
||||
std::size_t viewing_team_index() const { return viewing_team_index_; }
|
||||
|
||||
const team& playing_team() const;
|
||||
const team& viewing_team() const;
|
||||
|
@ -133,13 +133,12 @@ public:
|
|||
* Sets the team controlled by the player using the computer.
|
||||
* Data from this team will be displayed in the game status.
|
||||
*/
|
||||
void set_team(std::size_t team, bool observe=false);
|
||||
void set_viewing_team_index(std::size_t team, bool observe=false);
|
||||
|
||||
/**
|
||||
* set_playing_team sets the team whose turn it currently is
|
||||
* sets the team whose turn it currently is
|
||||
*/
|
||||
void set_playing_team(std::size_t team);
|
||||
|
||||
void set_playing_team_index(std::size_t team);
|
||||
|
||||
/**
|
||||
* Cancels all the exclusive draw requests.
|
||||
|
@ -729,7 +728,7 @@ protected:
|
|||
|
||||
static void fill_images_list(const std::string& prefix, std::vector<std::string>& images);
|
||||
|
||||
std::size_t currentTeam_;
|
||||
std::size_t viewing_team_index_;
|
||||
bool dont_show_all_; //const team *viewpoint_;
|
||||
/**
|
||||
* Position of the top-left corner of the viewport, in pixels.
|
||||
|
@ -817,7 +816,7 @@ public:
|
|||
protected:
|
||||
|
||||
//TODO sort
|
||||
std::size_t activeTeam_;
|
||||
std::size_t playing_team_index_;
|
||||
|
||||
/**
|
||||
* Helper for rendering the map by ordering draw operations.
|
||||
|
|
|
@ -708,8 +708,8 @@ bool editor_controller::do_execute_command(const hotkey::ui_command& cmd, bool p
|
|||
toolkit_->get_palette_manager()->set_group(index);
|
||||
return true;
|
||||
case SIDE:
|
||||
gui_->set_team(index, true);
|
||||
gui_->set_playing_team(index);
|
||||
gui_->set_viewing_team_index(index, true);
|
||||
gui_->set_playing_team_index(index);
|
||||
toolkit_->get_palette_manager()->draw_contents();
|
||||
return true;
|
||||
case AREA:
|
||||
|
@ -1086,8 +1086,8 @@ bool editor_controller::do_execute_command(const hotkey::ui_command& cmd, bool p
|
|||
gui_->init_flags();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_SIDE_REMOVE:
|
||||
gui_->set_team(0, true);
|
||||
gui_->set_playing_team(0);
|
||||
gui_->set_viewing_team_index(0, true);
|
||||
gui_->set_playing_team_index(0);
|
||||
get_current_map_context().remove_side();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_SIDE_EDIT:
|
||||
|
|
|
@ -112,8 +112,8 @@ void context_manager::refresh_on_context_change()
|
|||
|
||||
// Reset side when switching to an existing scenario
|
||||
if (gui().get_teams().size() > 0) {
|
||||
gui().set_team(0, true);
|
||||
gui().set_playing_team(0);
|
||||
gui().set_viewing_team_index(0, true);
|
||||
gui().set_playing_team_index(0);
|
||||
}
|
||||
gui().init_flags();
|
||||
|
||||
|
@ -1032,8 +1032,8 @@ void context_manager::new_scenario(int width, int height, const t_translation::t
|
|||
|
||||
// Give the new scenario an initial side.
|
||||
get_map_context().new_side();
|
||||
gui().set_team(0, true);
|
||||
gui().set_playing_team(0);
|
||||
gui().set_viewing_team_index(0, true);
|
||||
gui().set_playing_team_index(0);
|
||||
gui_.init_flags();
|
||||
}
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ void play_controller::init_gui()
|
|||
void play_controller::init_side_begin()
|
||||
{
|
||||
mouse_handler_.set_side(current_side());
|
||||
gui_->set_playing_team(std::size_t(current_side() - 1));
|
||||
gui_->set_playing_team_index(std::size_t(current_side() - 1));
|
||||
|
||||
update_viewing_player();
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ bool play_controller::reveal_map_default() const
|
|||
|
||||
void play_controller::update_gui_to_player(const int team_index, const bool observe)
|
||||
{
|
||||
gui_->set_team(team_index, observe);
|
||||
gui_->set_viewing_team_index(team_index, observe);
|
||||
gui_->recalculate_minimap();
|
||||
gui_->invalidate_all();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue