From e36145082a690ed56432084d9911692f2a422013 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 10 Jan 2022 17:37:48 +0200 Subject: [PATCH] More "user canceled" extended command return values --- src/apply.c | 6 +++--- src/cmd.c | 4 ++-- src/shk.c | 2 +- src/teleport.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/apply.c b/src/apply.c index 338ea48dd..568a73cb2 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1838,7 +1838,7 @@ jump(int magic) /* 0=Physical, otherwise skill level */ g.jumping_is_magic = magic; getpos_sethilite(display_jump_positions, get_valid_jump_position); if (getpos(&cc, TRUE, "the desired position") < 0) - return ECMD_OK; /* user pressed ESC */ + return ECMD_CANCEL; /* user pressed ESC */ if (!is_valid_jump_pos(cc.x, cc.y, magic, TRUE)) { return ECMD_OK; } else { @@ -3138,7 +3138,7 @@ use_pole(struct obj *obj, boolean autohit) if (!autohit) { getpos_sethilite(display_polearm_positions, get_valid_polearm_position); if (getpos(&cc, TRUE, "the spot to hit") < 0) - return res; /* ESC; uses turn iff polearm became wielded */ + return (res|ECMD_CANCEL); /* ESC; uses turn iff polearm became wielded */ } glyph = glyph_at(cc.x, cc.y); @@ -3355,7 +3355,7 @@ use_grapple(struct obj *obj) cc.x = u.ux; cc.y = u.uy; if (getpos(&cc, TRUE, "the spot to hit") < 0) - return res; /* ESC; uses turn iff grapnel became wielded */ + return (res|ECMD_CANCEL); /* ESC; uses turn iff grapnel became wielded */ /* Calculate range; unlike use_pole(), there's no minimum for range */ typ = uwep_skill_type(); diff --git a/src/cmd.c b/src/cmd.c index ac7529ba4..4fbb6b2a6 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1567,7 +1567,7 @@ wiz_smell(void) pline("Pick a monster to smell."); ans = getpos(&cc, TRUE, "a monster"); if (ans < 0 || cc.x < 0) { - return ECMD_OK; /* done */ + return ECMD_CANCEL; /* done */ } /* Convert the glyph at the selected position to a mndxbol. */ glyph = glyph_at(cc.x, cc.y); @@ -4707,7 +4707,7 @@ dotravel(void) if (getpos(&cc, TRUE, "the desired destination") < 0) { /* user pressed ESC */ iflags.getloc_travelmode = FALSE; - return ECMD_OK; + return ECMD_CANCEL; } } iflags.travelcc.x = u.tx = cc.x; diff --git a/src/shk.c b/src/shk.c index 85ff5bb25..8125dde02 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1296,7 +1296,7 @@ dopay(void) cc.x = u.ux; cc.y = u.uy; if (getpos(&cc, TRUE, "the creature you want to pay") < 0) - return ECMD_OK; /* player pressed ESC */ + return ECMD_CANCEL; /* player pressed ESC */ cx = cc.x; cy = cc.y; if (cx < 0) { diff --git a/src/teleport.c b/src/teleport.c index 0481a0cb2..9b78d6244 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -479,7 +479,7 @@ tele(void) scrolltele((struct obj *) 0); } -/* teleport the hero; usually discover scroll of teleporation if via scroll */ +/* teleport the hero; usually discover scroll of teleportation if via scroll */ void scrolltele(struct obj* scroll) {