hotkey: Replace previous announcements when toggling Accelerated Speed

Fixes that weird annoying thing where pressing ctrl+a twice results in
two overlapping text messages about the exact same thing.
This commit is contained in:
Iris Morelle 2021-03-28 04:22:59 -03:00
parent d65b9d0195
commit 0314716aa3

View file

@ -214,15 +214,18 @@ void play_controller::hotkey_handler::toggle_accelerated_speed()
{
preferences::set_turbo(!preferences::turbo());
display::announce_options ao;
ao.discard_previous = true;
if (preferences::turbo())
{
utils::string_map symbols;
symbols["hk"] = hotkey::get_names(hotkey::hotkey_command::get_command_by_command(hotkey::HOTKEY_ACCELERATED).command);
gui()->announce(_("Accelerated speed enabled!") + "\n" + VGETTEXT("(press $hk to disable)", symbols), font::NORMAL_COLOR);
gui()->announce(_("Accelerated speed enabled!") + "\n" + VGETTEXT("(press $hk to disable)", symbols), font::NORMAL_COLOR, ao);
}
else
{
gui()->announce(_("Accelerated speed disabled!"), font::NORMAL_COLOR);
gui()->announce(_("Accelerated speed disabled!"), font::NORMAL_COLOR, ao);
}
}