Fixed standing animation toggle not taking immediate effect (fixes #1653)

This commit is contained in:
Charles Dang 2018-02-14 10:46:16 +11:00
parent 7d647a6d3d
commit 1855266104
7 changed files with 27 additions and 14 deletions

View file

@ -3170,6 +3170,13 @@ void display::invalidate_animations()
} while (new_inval);
}
void display::reset_standing_animations()
{
for(const unit & u : dc_->units()) {
u.anim_comp().set_standing();
}
}
void display::add_arrow(arrow& arrow)
{
const arrow_path_t & arrow_path = arrow.get_path();

View file

@ -430,6 +430,8 @@ public:
*/
void invalidate_animations_location(const map_location& loc);
void reset_standing_animations();
/**
* mouseover_hex_overlay_ require a prerendered surface
* and is drawn underneath the mouse's location

View file

@ -101,6 +101,20 @@ void set_idle_anim_rate(int rate) {
}
}
bool show_standing_animations()
{
return preferences::get("unit_standing_animations", true);
}
void set_show_standing_animations(bool value)
{
set("unit_standing_animations", value);
if(display* d = display::get_singleton()) {
d->reset_standing_animations();
}
}
bool show_theme_dialog()
{
std::vector<theme_info> themes = theme::get_known_themes();

View file

@ -28,6 +28,9 @@ namespace preferences {
void set_idle_anim(bool ison);
void set_idle_anim_rate(int rate);
bool show_standing_animations();
void set_show_standing_animations(bool value);
void show_wesnothd_server_search();
bool show_theme_dialog();
} // end namespace preferences

View file

@ -961,16 +961,6 @@ void set_animate_water(bool value)
set("animate_water", value);
}
bool show_standing_animations()
{
return preferences::get("unit_standing_animations", true);
}
void set_show_standing_animations(bool value)
{
set("unit_standing_animations", value);
}
bool show_fps()
{
return fps;

View file

@ -260,9 +260,6 @@ namespace preferences {
bool minimap_draw_terrain();
void toggle_minimap_draw_terrain();
bool show_standing_animations();
void set_show_standing_animations(bool value);
bool show_fps();
void set_show_fps(bool value);

View file

@ -17,7 +17,7 @@
#include "config.hpp"
#include "display.hpp"
#include "map/map.hpp"
#include "preferences/general.hpp"
#include "preferences/display.hpp"
#include "random.hpp"
#include "units/unit.hpp"
#include "units/types.hpp"