Display: renamed get_disp_context to current_display_context

This is to avoid confusion with filter_context::get_disp_context. display used to
inherit from filter_context, but that was refactored out a while back. I left
get_disp_context since it was used and useful, but I realize now it causes more
confusion than not.

Also converted help::load_terrain_types_data to use get_map() directly since I
noticed it.

And changed a stray use of `thedisp` to `disp` in unit_drawer. Doesn't do anything
but it was bugging me.
This commit is contained in:
Charles Dang 2018-04-20 17:00:40 +11:00
parent a532cc4689
commit 4818312150
6 changed files with 8 additions and 8 deletions

View file

@ -202,7 +202,7 @@ public:
void change_display_context(const display_context* dc);
const display_context& get_disp_context() const
const display_context& current_display_context() const
{
return *dc_;
}

View file

@ -69,7 +69,7 @@ void display_chat_manager::add_chat_message(const time_t& time, const std::strin
bool is_observer = false;
{ //TODO: Clean this block up somehow
const game_board * board = dynamic_cast<const game_board*>(&my_disp_.get_disp_context());
const game_board * board = dynamic_cast<const game_board*>(&my_disp_.current_display_context());
if (board) {
is_observer = board->is_observer();

View file

@ -99,7 +99,7 @@ std::string escape(const std::string& s)
ter_data_cache load_terrain_types_data()
{
if(display* d = display::get_singleton()) {
return d->get_disp_context().map().tdata();
return d->get_map().tdata();
} else if(game_config_manager* g = game_config_manager::get()) {
return g->terrain_types();
} else {

View file

@ -578,7 +578,7 @@ bool terrain_label::hidden() const
// Respect user's label preferences
std::string category = "cat:" + category_;
std::string creator = "side:" + std::to_string(creator_ + 1);
const std::vector<std::string>& hidden_categories = disp->get_disp_context().hidden_label_categories();
const std::vector<std::string>& hidden_categories = disp->current_display_context().hidden_label_categories();
if(std::find(hidden_categories.begin(), hidden_categories.end(), category) != hidden_categories.end()) {
return true;
@ -626,7 +626,7 @@ bool terrain_label::viewable(const display& disp) const
}
// Observers are not privvy to team labels.
const bool can_see_team_labels = !disp.get_disp_context().is_observer();
const bool can_see_team_labels = !disp.current_display_context().is_observer();
// Global labels are shown unless covered by a team label.
if(team_name_.empty()) {

View file

@ -129,7 +129,7 @@ namespace
bool affects_side(const config& cfg, std::size_t side, std::size_t other_side)
{
// display::get_singleton() has already been confirmed valid by both callers.
const team& side_team = display::get_singleton()->get_disp_context().get_team(side);
const team& side_team = display::get_singleton()->current_display_context().get_team(side);
if(side == other_side || !side_team.is_enemy(other_side)) {
return cfg["affect_allies"].to_bool(true);

View file

@ -32,10 +32,10 @@
unit_drawer::unit_drawer(display& thedisp)
: disp(thedisp)
, dc(disp.get_disp_context())
, dc(disp.current_display_context())
, map(dc.map())
, teams(dc.teams())
, halo_man(thedisp.get_halo_manager())
, halo_man(disp.get_halo_manager())
, viewing_team(disp.viewing_team())
, playing_team(disp.playing_team())
, viewing_team_ref(teams[viewing_team])