allow interrupting replay

This commit is contained in:
2025-01-16 12:42:24 -06:00
parent 2d824e869e
commit 62313e5bd6
8 changed files with 27 additions and 5 deletions

View File

@@ -45,6 +45,8 @@ cDialog* cDialog::topWindow = nullptr;
void (*cDialog::redraw_everything)() = nullptr;
std::mt19937 cDialog::ui_rand;
extern bool check_for_interrupt(std::string);
std::string cDialog::generateRandomString(){
// Not bothering to seed, because it doesn't actually matter if it's truly random.
int n_chars = ui_rand() % 100;
@@ -564,7 +566,10 @@ void cDialog::handle_events() {
cFramerateLimiter fps_limiter;
while(dialogNotToast) {
if(replaying && has_next_action("click_control")){
if(replaying && check_for_interrupt("confirm-interrupt-replay")){
replaying = false;
return;
}else if(replaying && has_next_action("click_control")){
Element& next_action = pop_next_action();
auto info = info_from_action(next_action);
if(info["id"].empty()) continue;