Fix bell behaviour according to tests

This commit is contained in:
Leroy Hopson 2024-02-18 14:07:07 +13:00
parent dc97c56b17
commit 685884965e
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
2 changed files with 31 additions and 4 deletions

View file

@ -564,11 +564,14 @@ bool Terminal::get_bell_muted() const {
void Terminal::set_bell_cooldown(const double time) {
bell_cooldown = time;
bell_timer->stop();
double remaining_time = std::max(0.0, bell_cooldown - bell_timer->get_time_left());
if (remaining_time > 0)
bell_timer->start(remaining_time);
if (!bell_timer->is_stopped()) {
bell_timer->stop();
double remaining_time = std::max(0.0, bell_cooldown - bell_timer->get_time_left());
if (remaining_time > 0)
bell_timer->start(remaining_time);
}
}
double Terminal::get_bell_cooldown() const {