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
+3 -3
View File
@@ -1838,7 +1838,7 @@ jump(int magic) /* 0=Physical, otherwise skill level */
g.jumping_is_magic = magic; g.jumping_is_magic = magic;
getpos_sethilite(display_jump_positions, get_valid_jump_position); getpos_sethilite(display_jump_positions, get_valid_jump_position);
if (getpos(&cc, TRUE, "the desired position") < 0) 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)) { if (!is_valid_jump_pos(cc.x, cc.y, magic, TRUE)) {
return ECMD_OK; return ECMD_OK;
} else { } else {
@@ -3138,7 +3138,7 @@ use_pole(struct obj *obj, boolean autohit)
if (!autohit) { if (!autohit) {
getpos_sethilite(display_polearm_positions, get_valid_polearm_position); getpos_sethilite(display_polearm_positions, get_valid_polearm_position);
if (getpos(&cc, TRUE, "the spot to hit") < 0) 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); glyph = glyph_at(cc.x, cc.y);
@@ -3355,7 +3355,7 @@ use_grapple(struct obj *obj)
cc.x = u.ux; cc.x = u.ux;
cc.y = u.uy; cc.y = u.uy;
if (getpos(&cc, TRUE, "the spot to hit") < 0) 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 */ /* Calculate range; unlike use_pole(), there's no minimum for range */
typ = uwep_skill_type(); typ = uwep_skill_type();
+2 -2
View File
@@ -1567,7 +1567,7 @@ wiz_smell(void)
pline("Pick a monster to smell."); pline("Pick a monster to smell.");
ans = getpos(&cc, TRUE, "a monster"); ans = getpos(&cc, TRUE, "a monster");
if (ans < 0 || cc.x < 0) { if (ans < 0 || cc.x < 0) {
return ECMD_OK; /* done */ return ECMD_CANCEL; /* done */
} }
/* Convert the glyph at the selected position to a mndxbol. */ /* Convert the glyph at the selected position to a mndxbol. */
glyph = glyph_at(cc.x, cc.y); glyph = glyph_at(cc.x, cc.y);
@@ -4707,7 +4707,7 @@ dotravel(void)
if (getpos(&cc, TRUE, "the desired destination") < 0) { if (getpos(&cc, TRUE, "the desired destination") < 0) {
/* user pressed ESC */ /* user pressed ESC */
iflags.getloc_travelmode = FALSE; iflags.getloc_travelmode = FALSE;
return ECMD_OK; return ECMD_CANCEL;
} }
} }
iflags.travelcc.x = u.tx = cc.x; iflags.travelcc.x = u.tx = cc.x;
+1 -1
View File
@@ -1296,7 +1296,7 @@ dopay(void)
cc.x = u.ux; cc.x = u.ux;
cc.y = u.uy; cc.y = u.uy;
if (getpos(&cc, TRUE, "the creature you want to pay") < 0) 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; cx = cc.x;
cy = cc.y; cy = cc.y;
if (cx < 0) { if (cx < 0) {
+1 -1
View File
@@ -479,7 +479,7 @@ tele(void)
scrolltele((struct obj *) 0); 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 void
scrolltele(struct obj* scroll) scrolltele(struct obj* scroll)
{ {