From 1d6843d7f05e503579800d575963a4f6752ff679 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 24 Mar 2020 13:26:35 +0900 Subject: [PATCH] [gamecode] Improve watchpoint handling a little Mostly just update the old value if the condition didn't trigger. --- libs/gamecode/pr_exec.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/gamecode/pr_exec.c b/libs/gamecode/pr_exec.c index d69d4e8a0..397eb7bde 100644 --- a/libs/gamecode/pr_exec.c +++ b/libs/gamecode/pr_exec.c @@ -1698,11 +1698,14 @@ op_call: default: PR_RunError (pr, "Bad opcode %i", st->op); } - if (watch && watch->integer_var != old_val.integer_var - && (!pr->wp_conditional - || watch->integer_var == pr->wp_val.integer_var)) - PR_RunError (pr, "watchpoint hit: %d -> %d", old_val.integer_var, - watch->integer_var); + if (watch && watch->integer_var != old_val.integer_var) { + if (!pr->wp_conditional + || watch->integer_var == pr->wp_val.integer_var) { + PR_RunError (pr, "watchpoint hit: %d -> %d", + old_val.integer_var, watch->integer_var); + } + old_val.integer_var = watch->integer_var; + } } exit_program: pr->pr_argc = 0;