More "user canceled" extended command return values

This commit is contained in:
Pasi Kallinen
2022-01-10 17:37:48 +02:00
parent a2a40c6b0b
commit e36145082a
4 changed files with 7 additions and 7 deletions

View File

@@ -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();

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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)
{