Display: cleaned up a bunch of now-unused/unnecessary members and functions
This commit is contained in:
parent
cdb43343b4
commit
78bcd85d9f
6 changed files with 0 additions and 129 deletions
|
@ -154,10 +154,8 @@ display::display(const display_context * dc, std::weak_ptr<wb::manager> wb, repo
|
|||
, minimap_(nullptr)
|
||||
, minimap_location_(sdl::empty_rect)
|
||||
, redrawMinimap_(false)
|
||||
, redraw_background_(true)
|
||||
, grid_(false)
|
||||
, diagnostic_label_(0)
|
||||
, panelsDrawn_(false)
|
||||
, turbo_speed_(2)
|
||||
, turbo_(false)
|
||||
, invalidateGameStatus_(true)
|
||||
|
@ -165,7 +163,6 @@ display::display(const display_context * dc, std::weak_ptr<wb::manager> wb, repo
|
|||
, reports_object_(&reports_object)
|
||||
, scroll_event_("scrolled")
|
||||
, complete_redraw_event_("completely_redrawn")
|
||||
, nextDraw_(0)
|
||||
, fps_counter_()
|
||||
, fps_start_()
|
||||
, fps_actual_()
|
||||
|
@ -189,8 +186,6 @@ display::display(const display_context * dc, std::weak_ptr<wb::manager> wb, repo
|
|||
, drawing_queue_()
|
||||
, map_screenshot_(false)
|
||||
, reach_map_()
|
||||
, reach_map_old_()
|
||||
, reach_map_changed_(true)
|
||||
, overlays_(nullptr)
|
||||
, fps_handle_(0)
|
||||
, drawn_hexes_(0)
|
||||
|
@ -203,7 +198,6 @@ display::display(const display_context * dc, std::weak_ptr<wb::manager> wb, repo
|
|||
, draw_num_of_bitmaps_(false)
|
||||
, arrows_map_()
|
||||
, color_adjust_()
|
||||
, dirty_()
|
||||
,
|
||||
{
|
||||
//The following assertion fails when starting a campaign
|
||||
|
@ -254,7 +248,6 @@ void display::set_theme(config theme_cfg) {
|
|||
menu_buttons_.clear();
|
||||
action_buttons_.clear();
|
||||
create_buttons();
|
||||
invalidate_theme();
|
||||
}
|
||||
|
||||
void display::init_flags() {
|
||||
|
@ -337,29 +330,6 @@ void display::init_flags_for_side_internal(size_t n, const std::string& side_col
|
|||
}
|
||||
}
|
||||
|
||||
texture display::get_flag(const map_location& loc)
|
||||
{
|
||||
if(!get_map().is_village(loc)) {
|
||||
return texture(nullptr);
|
||||
}
|
||||
|
||||
for(const team& t : dc_->teams()) {
|
||||
if(t.owns_village(loc) && (!fogged(loc) || !dc_->get_team(viewing_side()).is_enemy(t.side()))) {
|
||||
auto& flag = flags_[t.side() - 1];
|
||||
flag.update_last_draw_time();
|
||||
|
||||
// TODO: move this if-animated check to a helper function.
|
||||
const image::locator& image_flag = animate_map_
|
||||
? flag.get_current_frame()
|
||||
: flag.get_first_frame();
|
||||
|
||||
return image::get_texture(image_flag); // TODO: ToD coloring
|
||||
}
|
||||
}
|
||||
|
||||
return texture(nullptr);
|
||||
}
|
||||
|
||||
void display::set_team(size_t teamindex, bool show_everything)
|
||||
{
|
||||
assert(teamindex < dc_->teams().size());
|
||||
|
@ -469,7 +439,6 @@ void display::rebuild_all()
|
|||
|
||||
void display::reload_map()
|
||||
{
|
||||
redraw_background_ = true;
|
||||
builder_->reload_map();
|
||||
}
|
||||
|
||||
|
@ -1398,65 +1367,6 @@ void display::set_diagnostic(const std::string& msg)
|
|||
}
|
||||
}
|
||||
|
||||
void display::draw_init()
|
||||
{
|
||||
// DONE WITH THIS
|
||||
return;
|
||||
|
||||
if (get_map().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!panelsDrawn_) {
|
||||
draw_all_panels();
|
||||
panelsDrawn_ = true;
|
||||
}
|
||||
|
||||
if(redraw_background_) {
|
||||
// Full redraw of the background
|
||||
const SDL_Rect clip_rect = map_outside_area();
|
||||
const surface& screen = get_screen_surface();
|
||||
clip_rect_setter set_clip_rect(screen, &clip_rect);
|
||||
SDL_FillRect(screen, &clip_rect, 0x00000000);
|
||||
draw_background(clip_rect, theme_.border().background_image);
|
||||
redraw_background_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void display::draw_wrap(bool update, bool force)
|
||||
{
|
||||
|
||||
if(redrawMinimap_) {
|
||||
redrawMinimap_ = false;
|
||||
draw_minimap();
|
||||
}
|
||||
|
||||
if(update) {
|
||||
draw_debugging_aids();
|
||||
|
||||
frametimes_.push_back(SDL_GetTicks() - last_frame_finished_);
|
||||
fps_counter_++;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::seconds;
|
||||
using std::chrono::steady_clock;
|
||||
const seconds current_second = duration_cast<seconds>(steady_clock::now().time_since_epoch());
|
||||
if(current_second != fps_start_) {
|
||||
fps_start_ = current_second;
|
||||
fps_actual_ = fps_counter_;
|
||||
fps_counter_ = 0;
|
||||
}
|
||||
int longest_frame = *std::max_element(frametimes_.begin(), frametimes_.end());
|
||||
int wait_time = time_between_draws - longest_frame;
|
||||
|
||||
if(!force && !benchmark && wait_time > 0) {
|
||||
// If it's not time yet to draw, delay until it is
|
||||
SDL_Delay(wait_time);
|
||||
}
|
||||
|
||||
last_frame_finished_ = SDL_GetTicks();
|
||||
}
|
||||
}
|
||||
|
||||
const theme::action* display::action_pressed()
|
||||
{
|
||||
for(auto i = action_buttons_.begin(); i != action_buttons_.end(); ++i) {
|
||||
|
@ -1792,7 +1702,6 @@ bool display::set_zoom(unsigned int amount, const bool validate_value_and_set_in
|
|||
image::set_zoom(zoom_);
|
||||
|
||||
labels().recalculate_labels();
|
||||
redraw_background_ = true;
|
||||
|
||||
// Forces a redraw after zooming.
|
||||
// This prevents some graphic glitches from occurring.
|
||||
|
@ -2540,13 +2449,10 @@ void display::redraw_everything()
|
|||
}
|
||||
}
|
||||
|
||||
panelsDrawn_ = false;
|
||||
if (!gui::in_dialog()) {
|
||||
labels().recalculate_labels();
|
||||
}
|
||||
|
||||
redraw_background_ = true;
|
||||
|
||||
for(std::function<void(display&)> f : redraw_observers_) {
|
||||
f(*this);
|
||||
}
|
||||
|
|
|
@ -564,11 +564,6 @@ public:
|
|||
|
||||
void render_buttons();
|
||||
|
||||
void invalidate_theme()
|
||||
{
|
||||
panelsDrawn_ = false;
|
||||
}
|
||||
|
||||
void refresh_report(const std::string& report_name, const config* new_cfg = nullptr);
|
||||
|
||||
void draw_minimap_units();
|
||||
|
@ -883,15 +878,6 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a redraw.
|
||||
*
|
||||
* Invalidate controls and panels when changed after they have been drawn
|
||||
* initially. Useful for dynamic theme modification.
|
||||
*/
|
||||
DEPRECATED() void draw_init();
|
||||
DEPRECATED() void draw_wrap(bool update, bool force);
|
||||
|
||||
/**
|
||||
* Called near the end of a draw operation, derived classes can use this
|
||||
* to render a specific sidebar. Very similar to post_commit.
|
||||
|
@ -1033,10 +1019,8 @@ protected:
|
|||
surface minimap_;
|
||||
SDL_Rect minimap_location_;
|
||||
bool redrawMinimap_;
|
||||
bool redraw_background_;
|
||||
bool grid_;
|
||||
int diagnostic_label_;
|
||||
bool panelsDrawn_;
|
||||
double turbo_speed_;
|
||||
bool turbo_;
|
||||
bool invalidateGameStatus_;
|
||||
|
@ -1081,8 +1065,6 @@ protected:
|
|||
bool animate_water_;
|
||||
|
||||
private:
|
||||
texture get_flag(const map_location& loc);
|
||||
|
||||
/** Animated flags for each team */
|
||||
std::vector<animated<image::locator>> flags_;
|
||||
|
||||
|
@ -1143,8 +1125,6 @@ protected:
|
|||
// Tiles lit for showing where unit(s) can reach
|
||||
typedef std::map<map_location, unsigned int> reach_map;
|
||||
reach_map reach_map_;
|
||||
reach_map reach_map_old_;
|
||||
bool reach_map_changed_;
|
||||
|
||||
typedef std::multimap<map_location, overlay> overlay_map;
|
||||
|
||||
|
@ -1179,8 +1159,6 @@ private:
|
|||
|
||||
tod_color color_adjust_;
|
||||
|
||||
bool dirty_;
|
||||
|
||||
public:
|
||||
void replace_overlay_map(overlay_map* overlays)
|
||||
{
|
||||
|
|
|
@ -745,14 +745,12 @@ void game_display::highlight_another_reach(const pathfind::paths &paths_list)
|
|||
for (const pathfind::paths::step &dest : paths_list.destinations) {
|
||||
reach_map_[dest.curr]++;
|
||||
}
|
||||
reach_map_changed_ = true;
|
||||
}
|
||||
|
||||
bool game_display::unhighlight_reach()
|
||||
{
|
||||
if(!reach_map_.empty()) {
|
||||
reach_map_.clear();
|
||||
reach_map_changed_ = true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -210,14 +210,12 @@ void playmp_controller::set_end_scenario_button()
|
|||
btn_end->enable(false);
|
||||
}
|
||||
gui_->get_theme().refresh_title2("button-endturn", "title2");
|
||||
gui_->invalidate_theme();
|
||||
}
|
||||
|
||||
void playmp_controller::reset_end_scenario_button()
|
||||
{
|
||||
// revert the end-turn button text to its normal label
|
||||
gui_->get_theme().refresh_title2("button-endturn", "title");
|
||||
gui_->invalidate_theme();
|
||||
gui_->set_game_mode(game_display::RUNNING);
|
||||
}
|
||||
|
||||
|
@ -383,7 +381,6 @@ void playmp_controller::handle_generic_event(const std::string& name){
|
|||
mp_info_->is_host = true;
|
||||
if (linger_){
|
||||
end_turn_enable(true);
|
||||
gui_->invalidate_theme();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -482,7 +482,6 @@ void playsingle_controller::linger()
|
|||
|
||||
// change the end-turn button text to its alternate label
|
||||
gui_->get_theme().refresh_title2("button-endturn", "title2");
|
||||
gui_->invalidate_theme();
|
||||
|
||||
// End all unit moves
|
||||
gamestate().board_.set_all_units_user_end_turn();
|
||||
|
@ -502,7 +501,6 @@ void playsingle_controller::linger()
|
|||
|
||||
// revert the end-turn button text to its normal label
|
||||
gui_->get_theme().refresh_title2("button-endturn", "title");
|
||||
gui_->invalidate_theme();
|
||||
gui_->set_game_mode(game_display::RUNNING);
|
||||
|
||||
LOG_NG << "ending end-of-scenario linger\n";
|
||||
|
|
|
@ -94,9 +94,6 @@ void replay_controller::add_replay_theme()
|
|||
if (const config &replay_theme_cfg = res.child("replay")) {
|
||||
controller_.get_display().get_theme().modify(replay_theme_cfg);
|
||||
}
|
||||
//Make sure we get notified if the theme is redrawn completely. That way we have
|
||||
//a chance to restore the replay controls of the theme as well.
|
||||
controller_.get_display().invalidate_theme();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,9 +107,6 @@ void replay_controller::rebuild_replay_theme()
|
|||
controller_.get_display().get_theme().modify(replay_theme_cfg);
|
||||
}
|
||||
controller_.get_display().get_theme().modify_label("time-icon", _ ("current local time"));
|
||||
//Make sure we get notified if the theme is redrawn completely. That way we have
|
||||
//a chance to restore the replay controls of the theme as well.
|
||||
controller_.get_display().invalidate_theme();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue