Unify hero free hand check and msg

This commit is contained in:
Pasi Kallinen
2015-04-22 09:02:38 +03:00
parent 171e8284cd
commit 6d4aa312e6
3 changed files with 18 additions and 15 deletions

View File

@@ -1701,6 +1701,7 @@ E struct obj *FDECL(pick_obj, (struct obj *));
E int NDECL(encumber_msg);
E int NDECL(doloot);
E boolean FDECL(container_gone, (int (*)(OBJ_P)));
E boolean NDECL(u_handsy);
E int FDECL(use_container, (struct obj **,int));
E int FDECL(loot_mon, (struct monst *,int *,boolean *));
E int NDECL(dotip);

View File

@@ -2099,6 +2099,19 @@ explain_container_prompt()
}
}
boolean
u_handsy()
{
if (nohands(youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */
return FALSE;
} else if (!freehand()) {
You("have no free %s.", body_part(HAND));
return FALSE;
}
return TRUE;
}
static const char stashable[] = { ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, 0 };
int
@@ -2115,13 +2128,9 @@ int held;
int used = 0;
emptymsg[0] = '\0';
if (nohands(youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */
return 0;
} else if (!freehand()) {
You("have no free %s.", body_part(HAND));
return 0;
}
if (!u_handsy()) return 0;
if (obj->olocked) {
pline("%s locked.", Tobjnam(obj, "are"));
if (held) You("must put it down to unlock.");

View File

@@ -46,14 +46,7 @@ use_saddle(otmp)
const char *s;
/* Can you use it? */
if (nohands(youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */
return 0;
} else if (!freehand()) {
You("have no free %s.", body_part(HAND));
return 0;
}
if (!u_handsy()) return 0;
/* Select an animal */
if (u.uswallow || Underwater || !getdir((char *)0)) {