Cleaned up some unused stuff from the display class

Namely complete_redraw_event(), recalculate_minimap(), and redraw_minimap(). I had
been keeping the last around for reference (see f5ec886cb5) but I
figure it's not really worth it since this isn't the drawing method we'll want to
be using in the end anyway.
This commit is contained in:
Charles Dang 2018-05-28 15:12:27 +11:00
parent ed8a8a48f7
commit 40d9b9953b
17 changed files with 0 additions and 90 deletions

View file

@ -988,10 +988,6 @@ void attack::fire_event(const std::string& n)
) { ) {
actions::recalculate_fog(defender_side); actions::recalculate_fog(defender_side);
if(update_display_) {
display::get_singleton()->redraw_minimap();
}
fire_event("attack_end"); fire_event("attack_end");
throw attack_end_exception(); throw attack_end_exception();
} }
@ -1516,11 +1512,6 @@ void attack::perform()
actions::recalculate_fog(defender_side); actions::recalculate_fog(defender_side);
} }
// TODO: if we knew the viewing team, we could skip this display update
if(update_minimap_ && update_display_) {
display::get_singleton()->redraw_minimap();
}
if(a_.valid()) { if(a_.valid()) {
unit& u = a_.get_unit(); unit& u = a_.get_unit();
u.anim_comp().set_standing(); u.anim_comp().set_standing();

View file

@ -695,9 +695,6 @@ place_recruit_result place_recruit(unit_ptr u,
} }
// Make sure the unit appears (if either !show or the animation is suppressed). // Make sure the unit appears (if either !show or the animation is suppressed).
new_unit_itor->set_hidden(false); new_unit_itor->set_hidden(false);
if(display::get_singleton() != nullptr) {
display::get_singleton()->redraw_minimap();
}
// Village capturing. // Village capturing.
if(resources::gameboard->map().is_village(current_loc)) { if(resources::gameboard->map().is_village(current_loc)) {

View file

@ -537,7 +537,6 @@ namespace { // Private helpers for move_unit()
animator.proceed_to(move_it_.get_shared_ptr(), step_to - begin_, animator.proceed_to(move_it_.get_shared_ptr(), step_to - begin_,
move_it_->appearance_changed(), false); move_it_->appearance_changed(), false);
move_it_->set_appearance_changed(false); move_it_->set_appearance_changed(false);
disp.redraw_minimap();
} }
return success; return success;
@ -1095,9 +1094,6 @@ namespace { // Private helpers for move_unit()
undo_stack->clear(); undo_stack->clear();
} }
} }
// Update the screen.
display::get_singleton()->redraw_minimap();
} }

View file

@ -373,9 +373,6 @@ void undo_list::undo()
resources::recorder->undo_cut(redos_.back()); resources::recorder->undo_cut(redos_.back());
resources::whiteboard->on_gamestate_change(); resources::whiteboard->on_gamestate_change();
// Screen updates.
gui.redraw_minimap();
} }
else else
{ {
@ -419,9 +416,6 @@ void undo_list::redo()
temp.swap(redos_); temp.swap(redos_);
synced_context::run(commandname, data, /*use_undo*/ true, /*show*/ true); synced_context::run(commandname, data, /*use_undo*/ true, /*show*/ true);
temp.swap(redos_); temp.swap(redos_);
// Screen updates.
gui.redraw_minimap();
} }

View file

@ -569,7 +569,6 @@ game_events::pump_result_t shroud_clearer::fire_events()
*/ */
void shroud_clearer::invalidate_after_clear() void shroud_clearer::invalidate_after_clear()
{ {
display::get_singleton()->recalculate_minimap();
display::get_singleton()->labels().recalculate_shroud(); display::get_singleton()->labels().recalculate_shroud();
// The tiles are invalidated as they are cleared, so no need // The tiles are invalidated as they are cleared, so no need
// to invalidate them here. // to invalidate them here.

View file

@ -104,14 +104,12 @@ display::display(const display_context* dc,
, fake_unit_man_(new fake_unit_manager(*this)) , fake_unit_man_(new fake_unit_manager(*this))
, builder_(new terrain_builder(level, (dc_ ? &get_map() : nullptr), theme_.border().tile_image, theme_.border().show_border)) , builder_(new terrain_builder(level, (dc_ ? &get_map() : nullptr), theme_.border().tile_image, theme_.border().show_border))
, minimap_location_(sdl::empty_rect) , minimap_location_(sdl::empty_rect)
, redrawMinimap_(false)
, grid_(false) , grid_(false)
, diagnostic_label_(0) , diagnostic_label_(0)
, turbo_speed_(2) , turbo_speed_(2)
, turbo_(false) , turbo_(false)
, map_labels_(new map_labels(nullptr)) , map_labels_(new map_labels(nullptr))
, scroll_event_("scrolled") , scroll_event_("scrolled")
, complete_redraw_event_("completely_redrawn")
, fps_counter_() , fps_counter_()
, fps_start_() , fps_start_()
, fps_actual_() , fps_actual_()
@ -910,7 +908,6 @@ int display::draw_text_in_hex(const map_location& loc,
void display::select_hex(map_location hex) void display::select_hex(map_location hex)
{ {
selectedHex_ = hex; selectedHex_ = hex;
recalculate_minimap();
} }
void display::highlight_hex(map_location hex) void display::highlight_hex(map_location hex)
@ -995,8 +992,6 @@ bool display::scroll(int xmove, int ymove, bool force)
scroll_event_.notify_observers(); scroll_event_.notify_observers();
redrawMinimap_ = true;
return true; return true;
} }

View file

@ -601,11 +601,6 @@ public:
return scroll_event_; return scroll_event_;
} }
events::generic_event& complete_redraw_event()
{
return complete_redraw_event_;
}
/** Check if a tile is fully visible on screen. */ /** Check if a tile is fully visible on screen. */
bool tile_fully_on_screen(const map_location& loc) const; bool tile_fully_on_screen(const map_location& loc) const;
@ -640,24 +635,6 @@ public:
const color_t& color = font::GOOD_COLOR, const color_t& color = font::GOOD_COLOR,
const announce_options& options = announce_options()); const announce_options& options = announce_options());
/**
* Schedule the minimap for recalculation.
* Useful if any terrain in the map has changed.
*/
void recalculate_minimap()
{
redrawMinimap_ = true;
}
/**
* Schedule the minimap to be redrawn.
* Useful if units have moved about on the map.
*/
void redraw_minimap()
{
redrawMinimap_ = true;
}
virtual const time_of_day& get_time_of_day(const map_location& loc = map_location::null_location()) const; virtual const time_of_day& get_time_of_day(const map_location& loc = map_location::null_location()) const;
virtual bool has_time_area() const virtual bool has_time_area() const
@ -867,7 +844,6 @@ protected:
const std::unique_ptr<fake_unit_manager> fake_unit_man_; const std::unique_ptr<fake_unit_manager> fake_unit_man_;
const std::unique_ptr<terrain_builder> builder_; const std::unique_ptr<terrain_builder> builder_;
SDL_Rect minimap_location_; SDL_Rect minimap_location_;
bool redrawMinimap_;
bool grid_; bool grid_;
int diagnostic_label_; int diagnostic_label_;
double turbo_speed_; double turbo_speed_;
@ -877,12 +853,6 @@ protected:
/** Event raised when the map is being scrolled */ /** Event raised when the map is being scrolled */
mutable events::generic_event scroll_event_; mutable events::generic_event scroll_event_;
/**
* notify observers that the screen has been redrawn completely
* atm this is used for replay_controller to add replay controls to the standard theme
*/
events::generic_event complete_redraw_event_;
boost::circular_buffer<unsigned> frametimes_; // in milliseconds boost::circular_buffer<unsigned> frametimes_; // in milliseconds
unsigned int fps_counter_; unsigned int fps_counter_;
std::chrono::seconds fps_start_; std::chrono::seconds fps_start_;

View file

@ -115,7 +115,6 @@ void context_manager::refresh_all()
gui_.rebuild_all(); gui_.rebuild_all();
get_map_context().set_needs_terrain_rebuild(false); get_map_context().set_needs_terrain_rebuild(false);
get_map_context().clear_changed_locations(); get_map_context().clear_changed_locations();
gui_.recalculate_minimap();
if(locs_) { if(locs_) {
for(const auto& loc : get_map_context().map().special_locations().left) { for(const auto& loc : get_map_context().map().special_locations().left) {
locs_->add_item(loc.first); locs_->add_item(loc.first);
@ -547,7 +546,6 @@ void context_manager::refresh_after_action(bool drag_part)
} }
get_map_context().clear_changed_locations(); get_map_context().clear_changed_locations();
gui_.recalculate_minimap();
} }
void context_manager::resize_map_dialog() void context_manager::resize_map_dialog()

View file

@ -686,7 +686,6 @@ bool game_display::maybe_rebuild()
{ {
if(needs_rebuild_) { if(needs_rebuild_) {
needs_rebuild_ = false; needs_rebuild_ = false;
recalculate_minimap();
rebuild_all(); rebuild_all();
return true; return true;
} }

View file

@ -359,23 +359,18 @@ bool command_executor::do_execute_command(const hotkey_command& cmd, int /*inde
break; break;
case HOTKEY_MINIMAP_DRAW_TERRAIN: case HOTKEY_MINIMAP_DRAW_TERRAIN:
preferences::toggle_minimap_draw_terrain(); preferences::toggle_minimap_draw_terrain();
recalculate_minimap();
break; break;
case HOTKEY_MINIMAP_CODING_TERRAIN: case HOTKEY_MINIMAP_CODING_TERRAIN:
preferences::toggle_minimap_terrain_coding(); preferences::toggle_minimap_terrain_coding();
recalculate_minimap();
break; break;
case HOTKEY_MINIMAP_CODING_UNIT: case HOTKEY_MINIMAP_CODING_UNIT:
preferences::toggle_minimap_movement_coding(); preferences::toggle_minimap_movement_coding();
recalculate_minimap();
break; break;
case HOTKEY_MINIMAP_DRAW_UNITS: case HOTKEY_MINIMAP_DRAW_UNITS:
preferences::toggle_minimap_draw_units(); preferences::toggle_minimap_draw_units();
recalculate_minimap();
break; break;
case HOTKEY_MINIMAP_DRAW_VILLAGES: case HOTKEY_MINIMAP_DRAW_VILLAGES:
preferences::toggle_minimap_draw_villages(); preferences::toggle_minimap_draw_villages();
recalculate_minimap();
break; break;
default: default:
return false; return false;
@ -674,7 +669,6 @@ void command_executor::run_queued_commands()
void command_executor_default::recalculate_minimap() void command_executor_default::recalculate_minimap()
{ {
get_display().recalculate_minimap();
} }
void command_executor_default::lua_console() void command_executor_default::lua_console()

View file

@ -991,7 +991,6 @@ void play_controller::process_oos(const std::string& msg) const
void play_controller::update_gui_to_player(const int team_index, const bool observe) void play_controller::update_gui_to_player(const int team_index, const bool observe)
{ {
gui_->set_team(team_index, observe); gui_->set_team(team_index, observe);
gui_->recalculate_minimap();
} }
void play_controller::do_autosave() void play_controller::do_autosave()
@ -1094,7 +1093,6 @@ void play_controller::start_game()
} }
sync.do_final_checkup(); sync.do_final_checkup();
gui_->recalculate_minimap();
// Initialize countdown clock. // Initialize countdown clock.
for(const team& t : gamestate().board_.teams()) { for(const team& t : gamestate().board_.teams()) {
@ -1105,7 +1103,6 @@ void play_controller::start_game()
} else { } else {
init_gui(); init_gui();
gamestate().gamedata_.set_phase(game_data::PLAY); gamestate().gamedata_.set_phase(game_data::PLAY);
gui_->recalculate_minimap();
} }
} }

View file

@ -428,7 +428,6 @@ void playsingle_controller::before_human_turn()
void playsingle_controller::show_turn_dialog(){ void playsingle_controller::show_turn_dialog(){
if(preferences::turn_dialog() && !is_regular_game_end() ) { if(preferences::turn_dialog() && !is_regular_game_end() ) {
blindfold b(*gui_, true); //apply a blindfold for the duration of this dialog blindfold b(*gui_, true); //apply a blindfold for the duration of this dialog
gui_->recalculate_minimap();
std::string message = _("It is now $name|s turn"); std::string message = _("It is now $name|s turn");
utils::string_map symbols; utils::string_map symbols;
symbols["name"] = gamestate().board_.get_team(current_side()).side_name(); symbols["name"] = gamestate().board_.get_team(current_side()).side_name();
@ -523,7 +522,6 @@ void playsingle_controller::play_ai_turn()
LOG_NG << "is ai...\n"; LOG_NG << "is ai...\n";
end_turn_enable(false); end_turn_enable(false);
gui_->recalculate_minimap();
const cursor::setter cursor_setter(cursor::WAIT); const cursor::setter cursor_setter(cursor::WAIT);
@ -561,7 +559,6 @@ void playsingle_controller::play_ai_turn()
end_turn_ = END_TURN_REQUIRED; end_turn_ = END_TURN_REQUIRED;
} }
turn_data_.sync_network(); turn_data_.sync_network();
gui_->recalculate_minimap();
} }

View file

@ -191,10 +191,8 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
if (resources::gameboard->is_observer() || (resources::gameboard->teams())[display::get_singleton()->playing_team()].is_local_human()) { if (resources::gameboard->is_observer() || (resources::gameboard->teams())[display::get_singleton()->playing_team()].is_local_human()) {
display::get_singleton()->set_team(display::get_singleton()->playing_team()); display::get_singleton()->set_team(display::get_singleton()->playing_team());
display::get_singleton()->recalculate_minimap();
} else if (tm.is_local_human()) { } else if (tm.is_local_human()) {
display::get_singleton()->set_team(side - 1); display::get_singleton()->set_team(side - 1);
display::get_singleton()->recalculate_minimap();
} }
resources::whiteboard->on_change_controller(side,tm); resources::whiteboard->on_change_controller(side,tm);

View file

@ -676,10 +676,6 @@ REPLAY_RETURN do_replay(bool one_move)
{ {
log_scope("do replay"); log_scope("do replay");
if (!resources::controller->is_skipping_replay()) {
display::get_singleton()->recalculate_minimap();
}
update_locker lock_update(CVideo::get_singleton(), resources::controller->is_skipping_replay()); update_locker lock_update(CVideo::get_singleton(), resources::controller->is_skipping_replay());
return do_replay_handle(one_move); return do_replay_handle(one_move);
} }

View file

@ -227,8 +227,6 @@ void replay_controller::play_replay()
void replay_controller::update_gui() void replay_controller::update_gui()
{ {
controller_.get_display().recalculate_minimap();
controller_.get_display().redraw_minimap();
} }
void replay_controller::handle_generic_event(const std::string& name) void replay_controller::handle_generic_event(const std::string& name)

View file

@ -898,7 +898,6 @@ int game_lua_kernel::intf_shroud_op(lua_State *L, bool place_shroud)
} }
game_display_->labels().recalculate_shroud(); game_display_->labels().recalculate_shroud();
game_display_->recalculate_minimap();
return 0; return 0;
} }
@ -3333,7 +3332,6 @@ int game_lua_kernel::intf_redraw(lua_State *L)
for (const int side : filter.get_teams()){ for (const int side : filter.get_teams()){
actions::clear_shroud(side); actions::clear_shroud(side);
} }
screen.recalculate_minimap();
} }
} }
return 0; return 0;
@ -3907,8 +3905,6 @@ int game_lua_kernel::intf_toggle_fog(lua_State *L, const bool clear)
} }
} }
// Flag a screen update.
game_display_->recalculate_minimap();
return 0; return 0;
} }

View file

@ -574,7 +574,6 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_kill, child, use_undo, /*show*/, /*error_h
if (i.valid()) { if (i.valid()) {
unit_display::unit_die(loc, *i); unit_display::unit_die(loc, *i);
} }
display::get_singleton()->redraw_minimap();
if (i.valid()) { if (i.valid()) {
i->set_hitpoints(0); i->set_hitpoints(0);
} }
@ -696,8 +695,6 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_fog, /*child*/, use_undo, /*show*/, /*erro
current_team.set_fog(!current_team.uses_fog()); current_team.set_fog(!current_team.uses_fog());
actions::recalculate_fog(current_team.side()); actions::recalculate_fog(current_team.side());
display::get_singleton()->recalculate_minimap();
return true; return true;
} }
@ -714,7 +711,5 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_shroud, /*child*/, use_undo, /*show*/, /*e
current_team.set_shroud(!current_team.uses_shroud()); current_team.set_shroud(!current_team.uses_shroud());
actions::clear_shroud(current_team.side()); actions::clear_shroud(current_team.side());
display::get_singleton()->recalculate_minimap();
return true; return true;
} }