Make sure animations are skipped when skipping animations in replays

Fixes #8227
This commit is contained in:
pentarctagon 2024-03-07 16:43:13 -06:00 committed by Pentarctagon
parent 811dcd45b9
commit 1074ba704e
3 changed files with 5 additions and 5 deletions

View file

@ -121,7 +121,7 @@ namespace
// When the unit advances, it fades to white, and then switches
// to the new unit, then fades back to the normal color
if (animate && !video::headless()) {
if (animate && !video::headless() && !resources::controller->is_skipping_replay()) {
unit_animator animator;
bool with_bars = true;
animator.add_animation(u.get_shared_ptr(), "levelout", u->get_location(), map_location(), 0, with_bars);
@ -142,7 +142,7 @@ namespace
u = resources::gameboard->units().find(loc);
game_display::get_singleton()->invalidate_unit();
if (animate && u != resources::gameboard->units().end() && !video::headless()) {
if (animate && u != resources::gameboard->units().end() && !video::headless() && !resources::controller->is_skipping_replay()) {
unit_animator animator;
animator.add_animation(u.get_shared_ptr(), "levelin", u->get_location(), map_location(), 0, true);
animator.start_animations();

View file

@ -371,7 +371,7 @@ static int impl_add_animation(lua_State* L)
int game_lua_kernel::impl_run_animation(lua_State* L)
{
if(video::headless()) {
if(video::headless() || !resources::controller->is_skipping_replay()) {
return 0;
}
events::command_disabler command_disabler;

View file

@ -23,6 +23,7 @@
#include "log.hpp"
#include "mouse_events.hpp"
#include "resources.hpp"
#include "play_controller.hpp"
#include "color.hpp"
#include "sound.hpp"
#include "terrain/filter.hpp"
@ -166,8 +167,7 @@ int move_unit_between(const map_location& a,
bool do_not_show_anims(display* disp)
{
return !disp || video::headless();
return !disp || video::headless() || resources::controller->is_skipping_replay();
}
} // end anon namespace