From 20c456cbbba65ccdb1429f140bb0b41895826a48 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 17 Dec 2024 20:57:59 +0200 Subject: [PATCH] Avoid using doopen return value in test_move We can't rely on doopen_indir return value to check whether hero moved and opened a door. Instead, explicitly check whether the door is still closed, and whether hero moved. --- src/hack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hack.c b/src/hack.c index ed5475136..4a19c9cf0 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1073,9 +1073,9 @@ test_move( " but can't squeeze your possessions through."); if (flags.autoopen && !svc.context.run && !Confusion && !Stunned && !Fumbling) { - svc.context.door_opened - = svc.context.move - = (doopen_indir(x, y) == ECMD_TIME ? 1 : 0); + (void) doopen_indir(x, y); + svc.context.door_opened = !closed_door(x, y); + svc.context.move = (x != u.ux || y != u.uy); } else if (x == ux || y == uy) { if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) {