Add "user canceled" as extended command return value

Instead of returning ECMD_OK, the commands now return ECMD_CANCEL
when user declined to pick a direction or an object to act on.

Note that this can be ORed with ECMD_TIME, if the command still
took a turn.

For now this has no gameplay meaning.
This commit is contained in:
Pasi Kallinen
2022-01-08 20:04:54 +02:00
parent bcccfaaeac
commit 68b822e4dc
22 changed files with 78 additions and 73 deletions

View File

@@ -98,7 +98,7 @@ throw_obj(struct obj *obj, int shotlimit)
if (obj->o_id == g.context.objsplit.parent_oid
|| obj->o_id == g.context.objsplit.child_oid)
(void) unsplitobj(obj);
return ECMD_OK; /* no time passes */
return ECMD_CANCEL; /* no time passes */
}
/*
@@ -333,7 +333,7 @@ dothrow(void)
/* it is also possible to throw food */
/* (or jewels, or iron balls... ) */
return obj ? throw_obj(obj, shotlimit) : ECMD_OK;
return obj ? throw_obj(obj, shotlimit) : ECMD_CANCEL;
}
/* KMH -- Automatically fill quiver */
@@ -479,6 +479,8 @@ dofire(void)
/* choose something from inventory, then usually quiver it */
obj = getobj("throw", throw_ok, GETOBJ_PROMPT | GETOBJ_ALLOWCNT);
/* Q command doesn't allow gold in quiver */
if (!obj)
return ECMD_CANCEL;
if (obj && !obj->owornmask && obj->oclass != COIN_CLASS)
setuqwep(obj); /* demi-autoquiver */
}
@@ -2294,7 +2296,7 @@ throw_gold(struct obj *obj)
if (obj->o_id == g.context.objsplit.parent_oid
|| obj->o_id == g.context.objsplit.child_oid)
(void) unsplitobj(obj);
return ECMD_OK;
return ECMD_CANCEL;
}
freeinv(obj);
if (u.uswallow) {