Display: removed all code related to report drawing

Report drawing was handled in draw_sidebar, so that function was also removed. The display
class won't be handling sidebar drawing anymore anyway.

Also removed display::invalidate_game_status and game_display::invalidate_unit which were
both used to set a flag dealing with report drawing.

This should finally get the display class close to map drawing only.
This commit is contained in:
Charles Dang 2018-03-22 04:20:38 +11:00
parent d0f7bfbf37
commit 37dee4b1ff
22 changed files with 14 additions and 341 deletions

View file

@ -134,7 +134,6 @@ namespace
} }
u = resources::gameboard->units().find(loc); u = resources::gameboard->units().find(loc);
game_display::get_singleton()->invalidate_unit();
if (animate && u != resources::gameboard->units().end() && !CVideo::get_singleton().update_locked()) { if (animate && u != resources::gameboard->units().end() && !CVideo::get_singleton().update_locked()) {
unit_animator animator; unit_animator animator;

View file

@ -725,11 +725,6 @@ void recruit_unit(const unit_type & u_type, int side_num, const map_location & l
resources::undo_stack->clear(); resources::undo_stack->clear();
} }
} }
// Update the screen.
if (display::get_singleton() != nullptr )
display::get_singleton()->invalidate_game_status();
// Other updates were done by place_recruit().
} }
@ -773,11 +768,6 @@ bool recall_unit(const std::string & id, team & current_team,
} }
} }
// Update the screen.
if (display::get_singleton() != nullptr )
display::get_singleton()->invalidate_game_status();
// Other updates were done by place_recruit().
return true; return true;
} }

View file

@ -238,7 +238,6 @@ namespace {
patient.heal(amount); patient.heal(amount);
else if ( amount < 0 ) else if ( amount < 0 )
patient.take_hit(-amount); patient.take_hit(-amount);
game_display::get_singleton()->invalidate_unit();
} }

View file

@ -373,8 +373,6 @@ void undo_list::undo()
resources::whiteboard->on_gamestate_change(); resources::whiteboard->on_gamestate_change();
// Screen updates. // Screen updates.
gui.invalidate_unit();
gui.invalidate_game_status();
gui.redraw_minimap(); gui.redraw_minimap();
} }
else else
@ -421,8 +419,6 @@ void undo_list::redo()
temp.swap(redos_); temp.swap(redos_);
// Screen updates. // Screen updates.
gui.invalidate_unit();
gui.invalidate_game_status();
gui.redraw_minimap(); gui.redraw_minimap();
} }
@ -487,7 +483,6 @@ bool undo_list::apply_shroud_changes() const
if ( std::get<0>(clearer.fire_events() )) { if ( std::get<0>(clearer.fire_events() )) {
// Fix up the display in case WML changed stuff. // Fix up the display in case WML changed stuff.
clear_shroud(side_); clear_shroud(side_);
disp.invalidate_unit();
} }
return true; return true;

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()->invalidate_game_status();
display::get_singleton()->recalculate_minimap(); 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

View file

@ -36,7 +36,6 @@
#include "minimap.hpp" #include "minimap.hpp"
#include "overlay.hpp" #include "overlay.hpp"
#include "play_controller.hpp" //note: this can probably be refactored out #include "play_controller.hpp" //note: this can probably be refactored out
#include "reports.hpp"
#include "resources.hpp" #include "resources.hpp"
#include "color.hpp" #include "color.hpp"
#include "synced_context.hpp" #include "synced_context.hpp"
@ -140,7 +139,7 @@ void display::remove_single_overlay(const map_location& loc, const std::string&
} }
} }
display::display(const display_context * dc, std::weak_ptr<wb::manager> wb, reports & reports_object, const config& theme_cfg, const config& level, bool auto_join) display::display(const display_context * dc, std::weak_ptr<wb::manager> wb, const config& theme_cfg, const config& level, bool auto_join)
: events::sdl_handler(auto_join) : events::sdl_handler(auto_join)
, dc_(dc) , dc_(dc)
, halo_man_(new halo::manager()) , halo_man_(new halo::manager())
@ -163,17 +162,12 @@ display::display(const display_context * dc, std::weak_ptr<wb::manager> wb, repo
, diagnostic_label_(0) , diagnostic_label_(0)
, turbo_speed_(2) , turbo_speed_(2)
, turbo_(false) , turbo_(false)
, invalidateGameStatus_(true)
, map_labels_(new map_labels(0)) , map_labels_(new map_labels(0))
, reports_object_(&reports_object)
, scroll_event_("scrolled") , scroll_event_("scrolled")
, complete_redraw_event_("completely_redrawn") , complete_redraw_event_("completely_redrawn")
, fps_counter_() , fps_counter_()
, fps_start_() , fps_start_()
, fps_actual_() , fps_actual_()
, reportRects_()
, reportSurfaces_()
, reports_()
, menu_buttons_() , menu_buttons_()
, action_buttons_() , action_buttons_()
, mouseover_hex_overlay_(nullptr) , mouseover_hex_overlay_(nullptr)
@ -346,7 +340,6 @@ void display::set_playing_team(std::size_t teamindex)
{ {
assert(teamindex < dc_->teams().size()); assert(teamindex < dc_->teams().size());
activeTeam_ = teamindex; activeTeam_ = teamindex;
invalidate_game_status();
} }
bool display::add_exclusive_draw(const map_location& loc, unit& unit) bool display::add_exclusive_draw(const map_location& loc, unit& unit)
@ -1652,254 +1645,6 @@ image::TYPE display::get_image_type(const map_location& /*loc*/)
return image::TOD_COLORED; return image::TOD_COLORED;
} }
void display::draw_image_for_report(surface& img, SDL_Rect& rect)
{
SDL_Rect visible_area = get_non_transparent_portion(img);
SDL_Rect target = rect;
if(visible_area.x != 0 || visible_area.y != 0 || visible_area.w != img->w || visible_area.h != img->h) {
if(visible_area.w == 0 || visible_area.h == 0) {
return;
}
if(visible_area.w > rect.w || visible_area.h > rect.h) {
img.assign(get_surface_portion(img,visible_area));
img.assign(scale_surface(img,rect.w,rect.h));
visible_area.x = 0;
visible_area.y = 0;
visible_area.w = img->w;
visible_area.h = img->h;
} else {
target.x = rect.x + (rect.w - visible_area.w)/2;
target.y = rect.y + (rect.h - visible_area.h)/2;
target.w = visible_area.w;
target.h = visible_area.h;
}
sdl_blit(img,&visible_area,video_.getSurface(),&target);
} else {
if(img->w != rect.w || img->h != rect.h) {
img.assign(scale_surface(img,rect.w,rect.h));
}
sdl_blit(img,nullptr,video_.getSurface(),&target);
}
}
/**
* Redraws the specified report (if anything has changed).
* If a config is not supplied, it will be generated via
* reports::generate_report().
*/
void display::refresh_report(const std::string& report_name, const config * new_cfg)
{
return;
const theme::status_item *item = theme_.get_status_item(report_name);
if (!item) {
reportSurfaces_[report_name].assign(nullptr);
return;
}
// Now we will need the config. Generate one if needed.
boost::optional <events::mouse_handler &> mhb = boost::none;
if (resources::controller) {
mhb = resources::controller->get_mouse_handler_base();
}
reports::context temp_context = reports::context(*dc_, *this, *resources::tod_manager, wb_.lock(), mhb);
const config generated_cfg = new_cfg ? config() : reports_object_->generate_report(report_name, temp_context);
if ( new_cfg == nullptr )
new_cfg = &generated_cfg;
SDL_Rect &rect = reportRects_[report_name];
const SDL_Rect &new_rect = item->location(video_.screen_area());
surface &surf = reportSurfaces_[report_name];
config &report = reports_[report_name];
// Report and its location is unchanged since last time. Do nothing.
if (surf && rect == new_rect && report == *new_cfg) {
return;
}
// Update the config in reports_.
report = *new_cfg;
if (surf) {
sdl_blit(surf, nullptr, video_.getSurface(), &rect);
}
// If the rectangle has just changed, assign the surface to it
if (!surf || new_rect != rect)
{
surf.assign(nullptr);
rect = new_rect;
// If the rectangle is present, and we are blitting text,
// then we need to backup the surface.
// (Images generally won't need backing up,
// unless they are transparent, but that is done later).
if (rect.w > 0 && rect.h > 0) {
surf.assign(get_surface_portion(video_.getSurface(), rect));
if (reportSurfaces_[report_name] == nullptr) {
ERR_DP << "Could not backup background for report!" << std::endl;
}
}
}
tooltips::clear_tooltips(rect);
if (report.empty()) return;
int x = rect.x, y = rect.y;
// Add prefix, postfix elements.
// Make sure that they get the same tooltip
// as the guys around them.
std::string str = item->prefix();
if (!str.empty()) {
config &e = report.add_child_at("element", config(), 0);
e["text"] = str;
e["tooltip"] = report.child("element")["tooltip"];
}
str = item->postfix();
if (!str.empty()) {
config &e = report.add_child("element");
e["text"] = str;
e["tooltip"] = report.child("element", -1)["tooltip"];
}
// Loop through and display each report element.
int tallest = 0;
int image_count = 0;
bool used_ellipsis = false;
std::ostringstream ellipsis_tooltip;
SDL_Rect ellipsis_area = rect;
for (config::const_child_itors elements = report.child_range("element");
elements.begin() != elements.end(); elements.pop_front())
{
SDL_Rect area {x, y, rect.w + rect.x - x, rect.h + rect.y - y};
if (area.h <= 0) break;
std::string t = elements.front()["text"];
if (!t.empty())
{
if (used_ellipsis) goto skip_element;
// Draw a text element.
font::pango_text text;
if (item->font_rgb_set()) {
text.set_foreground_color(item->font_rgb());
}
bool eol = false;
if (t[t.size() - 1] == '\n') {
eol = true;
t = t.substr(0, t.size() - 1);
}
text.set_font_size(item->font_size());
text.set_text(t, true);
text.set_maximum_width(area.w);
text.set_maximum_height(area.h, false);
surface s = text.render_and_get_surface();
// check if next element is text with almost no space to show it
const int minimal_text = 12; // width in pixels
config::const_child_iterator ee = elements.begin();
if (!eol && rect.w - (x - rect.x + s->w) < minimal_text &&
++ee != elements.end() && !(*ee)["text"].empty())
{
// make this element longer to trigger rendering of ellipsis
// (to indicate that next elements have not enough space)
//NOTE this space should be longer than minimal_text pixels
t = t + " ";
text.set_text(t, true);
s = text.render_and_get_surface();
// use the area of this element for next tooltips
used_ellipsis = true;
ellipsis_area.x = x;
ellipsis_area.y = y;
ellipsis_area.w = s->w;
ellipsis_area.h = s->h;
}
video_.blit_surface(x, y, s);
area.w = s->w;
area.h = s->h;
if (area.h > tallest) {
tallest = area.h;
}
if (eol) {
x = rect.x;
y += tallest;
tallest = 0;
} else {
x += area.w;
}
}
else if (!(t = elements.front()["image"].str()).empty())
{
if (used_ellipsis) goto skip_element;
// Draw an image element.
surface img(image::get_image(t));
if (!img) {
ERR_DP << "could not find image for report: '" << t << "'" << std::endl;
continue;
}
if (area.w < img->w && image_count) {
// We have more than one image, and this one doesn't fit.
img = image::get_image(game_config::images::ellipsis);
used_ellipsis = true;
}
if (img->w < area.w) area.w = img->w;
if (img->h < area.h) area.h = img->h;
draw_image_for_report(img, area);
++image_count;
if (area.h > tallest) {
tallest = area.h;
}
if (!used_ellipsis) {
x += area.w;
} else {
ellipsis_area = area;
}
}
else
{
// No text nor image, skip this element
continue;
}
skip_element:
t = elements.front()["tooltip"].t_str().base_str();
if (!t.empty()) {
if (!used_ellipsis) {
tooltips::add_tooltip(area, t, elements.front()["help"].t_str().base_str());
} else {
// Collect all tooltips for the ellipsis.
// TODO: need a better separator
// TODO: assign an action
ellipsis_tooltip << t;
config::const_child_iterator ee = elements.begin();
if (++ee != elements.end())
ellipsis_tooltip << "\n _________\n\n";
}
}
}
if (used_ellipsis) {
tooltips::add_tooltip(ellipsis_area, ellipsis_tooltip.str());
}
}
void display::invalidate_animations() void display::invalidate_animations()
{ {
new_animation_frame(); new_animation_frame();

View file

@ -84,7 +84,6 @@ class display : public events::sdl_handler
public: public:
display(const display_context* dc, display(const display_context* dc,
std::weak_ptr<wb::manager> wb, std::weak_ptr<wb::manager> wb,
reports& reports_object,
const config& theme_cfg, const config& theme_cfg,
const config& level, const config& level,
bool auto_join = true); bool auto_join = true);
@ -367,12 +366,6 @@ public:
virtual void highlight_hex(map_location hex); virtual void highlight_hex(map_location hex);
/** Function to invalidate the game status displayed on the sidebar. */
void invalidate_game_status()
{
invalidateGameStatus_ = true;
}
/** Functions to get the on-screen positions of hexes. */ /** Functions to get the on-screen positions of hexes. */
int get_location_x(const map_location& loc) const; int get_location_x(const map_location& loc) const;
int get_location_y(const map_location& loc) const; int get_location_y(const map_location& loc) const;
@ -534,8 +527,6 @@ public:
std::shared_ptr<gui::button> find_action_button(const std::string& id); std::shared_ptr<gui::button> find_action_button(const std::string& id);
std::shared_ptr<gui::button> find_menu_button(const std::string& id); std::shared_ptr<gui::button> find_menu_button(const std::string& id);
void refresh_report(const std::string& report_name, const config* new_cfg = nullptr);
void draw_minimap_units(); void draw_minimap_units();
/** /**
@ -789,11 +780,6 @@ public:
/** Rebuild the flag list (not team colors) for a single side. */ /** Rebuild the flag list (not team colors) for a single side. */
void reinit_flags_for_side(std::size_t side); void reinit_flags_for_side(std::size_t side);
void reset_reports(reports& reports_object)
{
reports_object_ = &reports_object;
}
private: private:
void init_flags_for_side_internal(std::size_t side, const std::string& side_color); void init_flags_for_side_internal(std::size_t side, const std::string& side_color);
@ -840,14 +826,6 @@ protected:
{ {
} }
/**
* Called near the end of a draw operation, derived classes can use this
* to render a specific sidebar. Very similar to post_commit.
*/
virtual void draw_sidebar()
{
}
/** Draws the minimap. */ /** Draws the minimap. */
void draw_minimap(); void draw_minimap();
@ -965,8 +943,6 @@ protected:
/** Draw the appropriate fog or shroud transition images for a specific hex. */ /** Draw the appropriate fog or shroud transition images for a specific hex. */
void draw_fog_shroud_transition_images(const map_location& loc, image::TYPE image_type); void draw_fog_shroud_transition_images(const map_location& loc, image::TYPE image_type);
void draw_image_for_report(surface& img, SDL_Rect& rect);
void scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_type, bool force = true); void scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_type, bool force = true);
static void fill_images_list(const std::string& prefix, std::vector<std::string>& images); static void fill_images_list(const std::string& prefix, std::vector<std::string>& images);
@ -998,9 +974,7 @@ protected:
int diagnostic_label_; int diagnostic_label_;
double turbo_speed_; double turbo_speed_;
bool turbo_; bool turbo_;
bool invalidateGameStatus_;
const std::unique_ptr<map_labels> map_labels_; const std::unique_ptr<map_labels> map_labels_;
reports* reports_object_;
/** 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_;
@ -1018,9 +992,6 @@ protected:
uint32_t last_frame_finished_ = 0u; uint32_t last_frame_finished_ = 0u;
// Not set by the initializer: // Not set by the initializer:
std::map<std::string, SDL_Rect> reportRects_;
std::map<std::string, surface> reportSurfaces_;
std::map<std::string, config> reports_;
std::vector<std::shared_ptr<gui::button>> menu_buttons_, action_buttons_; std::vector<std::shared_ptr<gui::button>> menu_buttons_, action_buttons_;
surface mouseover_hex_overlay_; surface mouseover_hex_overlay_;
// If we're transitioning from one time of day to the next, // If we're transitioning from one time of day to the next,

View file

@ -67,7 +67,7 @@ editor_controller::editor_controller(const config &game_config)
, quit_confirmation(std::bind(&editor_controller::quit_confirm, this)) , quit_confirmation(std::bind(&editor_controller::quit_confirm, this))
, active_menu_(editor::MAP) , active_menu_(editor::MAP)
, reports_(new reports()) , reports_(new reports())
, gui_(new editor_display(*this, *reports_, controller_base::get_theme(game_config, "editor"))) , gui_(new editor_display(*this, controller_base::get_theme(game_config, "editor")))
, tods_() , tods_()
, context_manager_(new context_manager(*gui_.get(), game_config_)) , context_manager_(new context_manager(*gui_.get(), game_config_))
, toolkit_(nullptr) , toolkit_(nullptr)

View file

@ -29,8 +29,8 @@ namespace wb {
namespace editor { namespace editor {
editor_display::editor_display(editor_controller& controller, reports& reports_object, const config& theme_cfg) editor_display::editor_display(editor_controller& controller, const config& theme_cfg)
: display(nullptr, std::shared_ptr<wb::manager>(), reports_object, theme_cfg, config()) : display(nullptr, std::shared_ptr<wb::manager>(), theme_cfg, config())
, brush_locations_() , brush_locations_()
, controller_(controller) , controller_(controller)
{ {
@ -104,6 +104,8 @@ const SDL_Rect& editor_display::get_clip_rect()
return map_outside_area(); return map_outside_area();
} }
// USE AS REFERENCE FOR WHAT NEEDS TO BE UPDATED IN GUI2 UI
#if 0
void editor_display::draw_sidebar() void editor_display::draw_sidebar()
{ {
config element; config element;
@ -125,6 +127,7 @@ void editor_display::draw_sidebar()
refresh_report("num_units"); refresh_report("num_units");
} }
} }
#endif
const time_of_day& editor_display::get_time_of_day(const map_location& /*loc*/) const const time_of_day& editor_display::get_time_of_day(const map_location& /*loc*/) const
{ {

View file

@ -22,7 +22,7 @@ namespace editor {
class editor_display : public display class editor_display : public display
{ {
public: public:
editor_display(editor_controller& controller, reports& reports_object, const config& theme_cfg); editor_display(editor_controller& controller, const config& theme_cfg);
bool in_editor() const override { return true; } bool in_editor() const override { return true; }
@ -52,7 +52,6 @@ protected:
virtual void draw_hex_overlays() override; virtual void draw_hex_overlays() override;
const SDL_Rect& get_clip_rect() override; const SDL_Rect& get_clip_rect() override;
void draw_sidebar() override;
std::set<map_location> brush_locations_; std::set<map_location> brush_locations_;

View file

@ -197,7 +197,6 @@ void palette_manager::handle_event(const SDL_Event& event) {
//set_dirty(true); //set_dirty(true);
// draw(true); // draw(true);
// set_dirty(active_palette().mouse_click()); // set_dirty(active_palette().mouse_click());
// gui_.invalidate_game_status();
} }
} }

View file

@ -104,7 +104,6 @@ void editor_toolkit::hotkey_set_mouse_action(hotkey::HOTKEY_COMMAND command)
palette_manager_->adjust_size(); palette_manager_->adjust_size();
set_mouseover_overlay(); set_mouseover_overlay();
gui_.invalidate_game_status();
palette_manager_->active_palette().hide(false); palette_manager_->active_palette().hide(false);
} else { } else {
ERR_ED << "Invalid hotkey command (" ERR_ED << "Invalid hotkey command ("

View file

@ -54,11 +54,10 @@ static lg::log_domain log_engine("engine");
std::map<map_location, fixed_t> game_display::debugHighlights_; std::map<map_location, fixed_t> game_display::debugHighlights_;
game_display::game_display(game_board& board, std::weak_ptr<wb::manager> wb, game_display::game_display(game_board& board, std::weak_ptr<wb::manager> wb,
reports & reports_object,
const config& theme_cfg, const config& theme_cfg,
const config& level, const config& level,
bool) bool)
: display(&board, wb, reports_object, theme_cfg, level, false) : display(&board, wb, theme_cfg, level, false)
, overlay_map_() , overlay_map_()
, attack_indicator_src_() , attack_indicator_src_()
, attack_indicator_dst_() , attack_indicator_dst_()
@ -153,20 +152,17 @@ void game_display::highlight_hex(map_location hex)
const unit* u = resources::gameboard->get_visible_unit(hex, dc_->teams()[viewing_team()], !dont_show_all_); const unit* u = resources::gameboard->get_visible_unit(hex, dc_->teams()[viewing_team()], !dont_show_all_);
if(u) { if(u) {
displayedUnitHex_ = hex; displayedUnitHex_ = hex;
invalidate_unit();
} else { } else {
u = resources::gameboard->get_visible_unit(mouseoverHex_, dc_->teams()[viewing_team()], !dont_show_all_); u = resources::gameboard->get_visible_unit(mouseoverHex_, dc_->teams()[viewing_team()], !dont_show_all_);
if(u) { if(u) {
// mouse moved from unit hex to non-unit hex // mouse moved from unit hex to non-unit hex
if(dc_->units().count(selectedHex_)) { if(dc_->units().count(selectedHex_)) {
displayedUnitHex_ = selectedHex_; displayedUnitHex_ = selectedHex_;
invalidate_unit();
} }
} }
} }
display::highlight_hex(hex); display::highlight_hex(hex);
invalidate_game_status();
} }
void game_display::display_unit_hex(map_location hex) void game_display::display_unit_hex(map_location hex)
@ -179,7 +175,6 @@ void game_display::display_unit_hex(map_location hex)
const unit* u = resources::gameboard->get_visible_unit(hex, dc_->teams()[viewing_team()], !dont_show_all_); const unit* u = resources::gameboard->get_visible_unit(hex, dc_->teams()[viewing_team()], !dont_show_all_);
if(u) { if(u) {
displayedUnitHex_ = hex; displayedUnitHex_ = hex;
invalidate_unit();
} }
} }
@ -187,7 +182,6 @@ void game_display::invalidate_unit_after_move(const map_location& src, const map
{ {
if(src == displayedUnitHex_) { if(src == displayedUnitHex_) {
displayedUnitHex_ = dst; displayedUnitHex_ = dst;
invalidate_unit();
} }
} }
@ -376,6 +370,8 @@ bool game_display::has_time_area() const
return resources::tod_manager->has_time_area(); return resources::tod_manager->has_time_area();
} }
// USE AS REFERENCE FOR WHAT NEEDS TO BE UPDATED IN GUI2 UI
#if 0
void game_display::draw_sidebar() void game_display::draw_sidebar()
{ {
if(!team_valid()) if(!team_valid())
@ -395,6 +391,7 @@ void game_display::draw_sidebar()
invalidateGameStatus_ = false; invalidateGameStatus_ = false;
} }
} }
#endif
void game_display::set_game_mode(const game_mode mode) void game_display::set_game_mode(const game_mode mode)
{ {

View file

@ -42,7 +42,6 @@ class game_display : public display
public: public:
game_display(game_board& board, game_display(game_board& board,
std::weak_ptr<wb::manager> wb, std::weak_ptr<wb::manager> wb,
reports & reports_object,
const config& theme_cfg, const config& theme_cfg,
const config& level, const config& level,
bool dummy=false); bool dummy=false);
@ -121,9 +120,6 @@ public:
/** Draws the movement info (turns available). */ /** Draws the movement info (turns available). */
void draw_movement_info(); void draw_movement_info();
/** Function to invalidate that unit status displayed on the sidebar. */
void invalidate_unit() { invalidateGameStatus_ = true; }
/** Same as invalidate_unit() if moving the displayed unit. */ /** Same as invalidate_unit() if moving the displayed unit. */
void invalidate_unit_after_move(const map_location& src, const map_location& dst); void invalidate_unit_after_move(const map_location& src, const map_location& dst);
@ -208,8 +204,6 @@ private:
game_display(const game_display&); game_display(const game_display&);
void operator=(const game_display&); void operator=(const game_display&);
virtual void draw_sidebar() override;
void draw_footstep_images() const; void draw_footstep_images() const;
overlay_map overlay_map_; overlay_map overlay_map_;

View file

@ -635,7 +635,6 @@ void menu_handler::rename_unit()
if(gui2::dialogs::edit_text::execute(title, label, name)) { if(gui2::dialogs::edit_text::execute(title, label, name)) {
resources::recorder->add_rename(name, un->get_location()); resources::recorder->add_rename(name, un->get_location());
un->rename(name); un->rename(name);
gui_->invalidate_unit();
} }
} }
@ -860,7 +859,6 @@ void menu_handler::move_unit_to_loc(const unit_map::iterator& ui,
} }
gui_->set_route(nullptr); gui_->set_route(nullptr);
gui_->invalidate_game_status();
} }
void menu_handler::execute_gotos(mouse_handler& mousehandler, int side) void menu_handler::execute_gotos(mouse_handler& mousehandler, int side)
@ -952,7 +950,6 @@ void menu_handler::execute_gotos(mouse_handler& mousehandler, int side)
// erase the footsteps after movement // erase the footsteps after movement
gui_->set_route(nullptr); gui_->set_route(nullptr);
gui_->invalidate_game_status();
} }
void menu_handler::toggle_ellipses() void menu_handler::toggle_ellipses()

View file

@ -905,7 +905,6 @@ std::size_t mouse_handler::move_unit_along_route(const std::vector<map_location>
std::size_t moves = actions::move_unit_and_record(steps, &pc_.get_undo_stack(), false, true, &interrupted); std::size_t moves = actions::move_unit_and_record(steps, &pc_.get_undo_stack(), false, true, &interrupted);
cursor::set(cursor::NORMAL); cursor::set(cursor::NORMAL);
gui().invalidate_game_status();
if(moves == 0) if(moves == 0)
return 0; return 0;

View file

@ -240,7 +240,7 @@ void play_controller::init(const config& level)
LOG_NG << "building terrain rules... " << (SDL_GetTicks() - ticks()) << std::endl; LOG_NG << "building terrain rules... " << (SDL_GetTicks() - ticks()) << std::endl;
gui2::dialogs::loading_screen::progress(loading_stage::build_terrain); gui2::dialogs::loading_screen::progress(loading_stage::build_terrain);
gui_.reset(new game_display(gamestate().board_, whiteboard_manager_, *gamestate().reports_, theme_cfg, level)); gui_.reset(new game_display(gamestate().board_, whiteboard_manager_, theme_cfg, level));
map_start_ = map_location(level.child_or_empty("display").child_or_empty("location")); map_start_ = map_location(level.child_or_empty("display").child_or_empty("location"));
@ -341,7 +341,7 @@ void play_controller::reset_gamestate(const config& level, int replay_pos)
gamestate().set_game_display(gui_.get()); gamestate().set_game_display(gui_.get());
resources::tunnels = gamestate().pathfind_manager_.get(); resources::tunnels = gamestate().pathfind_manager_.get();
gui_->reset_reports(*gamestate().reports_); //gui_->reset_reports(*gamestate().reports_);
gui_->change_display_context(&gamestate().board_); gui_->change_display_context(&gamestate().board_);
saved_game_.get_replay().set_pos(replay_pos); saved_game_.get_replay().set_pos(replay_pos);
@ -1161,7 +1161,6 @@ void play_controller::play_turn()
{ {
whiteboard_manager_->on_gamestate_change(); whiteboard_manager_->on_gamestate_change();
gui_->new_turn(); gui_->new_turn();
gui_->invalidate_game_status();
LOG_NG << "turn: " << turn() << "\n"; LOG_NG << "turn: " << turn() << "\n";

View file

@ -560,8 +560,6 @@ void playsingle_controller::play_ai_turn()
} }
turn_data_.sync_network(); turn_data_.sync_network();
gui_->recalculate_minimap(); gui_->recalculate_minimap();
gui_->invalidate_unit();
gui_->invalidate_game_status();
} }

View file

@ -456,8 +456,6 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_
assert(i.valid()); assert(i.valid());
} }
game_display::get_singleton()->invalidate_unit();
return true; return true;
} }
SYNCED_COMMAND_HANDLER_FUNCTION(debug_create_unit, child, use_undo, /*show*/, error_handler) SYNCED_COMMAND_HANDLER_FUNCTION(debug_create_unit, child, use_undo, /*show*/, error_handler)
@ -488,7 +486,6 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_create_unit, child, use_undo, /*show*/, e
// Add the unit to the board. // Add the unit to the board.
std::tie(unit_it, std::ignore) = resources::gameboard->units().replace(loc, created); std::tie(unit_it, std::ignore) = resources::gameboard->units().replace(loc, created);
game_display::get_singleton()->invalidate_unit();
resources::game_events->pump().fire("unit_placed", loc); resources::game_events->pump().fire("unit_placed", loc);
unit_display::unit_recruited(loc); unit_display::unit_recruited(loc);

View file

@ -697,7 +697,6 @@ void unit_recruited(const map_location& loc,const map_location& leader_loc)
animator.start_animations(); animator.start_animations();
animator.wait_for_end(); animator.wait_for_end();
animator.set_all_standing(); animator.set_all_standing();
if (loc==disp->mouseover_hex()) disp->invalidate_unit();
} }
void unit_healing(unit &healed, const std::vector<unit *> &healers, int healing, void unit_healing(unit &healed, const std::vector<unit *> &healers, int healing,

View file

@ -160,8 +160,6 @@ void recall::apply_temp_modifier(unit_map& unit_map)
unit_map.insert(temp_unit_); unit_map.insert(temp_unit_);
resources::gameboard->teams().at(team_index()).get_side_actions()->change_gold_spent_by(cost); resources::gameboard->teams().at(team_index()).get_side_actions()->change_gold_spent_by(cost);
// Update gold in top bar
display::get_singleton()->invalidate_game_status();
} }
void recall::remove_temp_modifier(unit_map& unit_map) void recall::remove_temp_modifier(unit_map& unit_map)

View file

@ -132,9 +132,6 @@ void recruit::apply_temp_modifier(unit_map& unit_map)
// Temporarily insert unit into unit_map // Temporarily insert unit into unit_map
// unit map takes ownership of temp_unit // unit map takes ownership of temp_unit
unit_map.insert(temp_unit_); unit_map.insert(temp_unit_);
// Update gold in the top bar
display::get_singleton()->invalidate_game_status();
} }
void recruit::remove_temp_modifier(unit_map& unit_map) void recruit::remove_temp_modifier(unit_map& unit_map)