Improve the tin opener
This commit is contained in:
@@ -76,6 +76,7 @@ Platform- and/or Interface-Specific New Features
|
|||||||
|
|
||||||
NetHack Community Patches (or Variation) Included
|
NetHack Community Patches (or Variation) Included
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
Malcolm Ryan's improved tin opener
|
||||||
|
|
||||||
|
|
||||||
Code Cleanup and Reorganization
|
Code Cleanup and Reorganization
|
||||||
|
|||||||
@@ -604,6 +604,7 @@ E void NDECL(init_uhunger);
|
|||||||
E int NDECL(Hear_again);
|
E int NDECL(Hear_again);
|
||||||
E void NDECL(reset_eat);
|
E void NDECL(reset_eat);
|
||||||
E int NDECL(doeat);
|
E int NDECL(doeat);
|
||||||
|
E int FDECL(use_tin_opener, (struct obj *));
|
||||||
E void NDECL(gethungry);
|
E void NDECL(gethungry);
|
||||||
E void FDECL(morehungry, (int));
|
E void FDECL(morehungry, (int));
|
||||||
E void FDECL(lesshungry, (int));
|
E void FDECL(lesshungry, (int));
|
||||||
|
|||||||
14
src/apply.c
14
src/apply.c
@@ -3494,18 +3494,8 @@ doapply()
|
|||||||
res = dowrite(obj);
|
res = dowrite(obj);
|
||||||
break;
|
break;
|
||||||
case TIN_OPENER:
|
case TIN_OPENER:
|
||||||
if (!carrying(TIN)) {
|
res = use_tin_opener(obj);
|
||||||
You("have no tin to open.");
|
break;
|
||||||
goto xit;
|
|
||||||
}
|
|
||||||
You("cannot open a tin without eating or discarding its contents.");
|
|
||||||
if (flags.verbose)
|
|
||||||
pline("In order to eat, use the 'e' command.");
|
|
||||||
if (obj != uwep)
|
|
||||||
pline(
|
|
||||||
"Opening the tin will be much easier if you wield the tin opener.");
|
|
||||||
goto xit;
|
|
||||||
|
|
||||||
case FIGURINE:
|
case FIGURINE:
|
||||||
use_figurine(&obj);
|
use_figurine(&obj);
|
||||||
break;
|
break;
|
||||||
|
|||||||
28
src/eat.c
28
src/eat.c
@@ -2579,6 +2579,34 @@ doeat()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
use_tin_opener(obj)
|
||||||
|
register struct obj *obj;
|
||||||
|
{
|
||||||
|
register struct obj *otmp;
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
if (!carrying(TIN)) {
|
||||||
|
You("have no tin to open.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj != uwep) {
|
||||||
|
if (obj->cursed && obj->bknown) {
|
||||||
|
char qbuf[QBUFSZ];
|
||||||
|
(void) safe_qbuf(qbuf, "Really wield ", "?", obj, doname, ansimpleoname, "that");
|
||||||
|
if (ynq(qbuf) != 'y') return 0;
|
||||||
|
}
|
||||||
|
if (!wield_tool(obj, "use")) return 0;
|
||||||
|
else res = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
otmp = getobj((const char *)comestibles, "open");
|
||||||
|
if (!otmp) return 0;
|
||||||
|
start_tin(otmp);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Take a single bite from a piece of food, checking for choking and
|
/* Take a single bite from a piece of food, checking for choking and
|
||||||
* modifying usedtime. Returns 1 if they choked and survived, 0 otherwise.
|
* modifying usedtime. Returns 1 if they choked and survived, 0 otherwise.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1099,6 +1099,7 @@ register const char *let, *word;
|
|||||||
&& (otmp->otyp != HORN_OF_PLENTY || !otmp->dknown
|
&& (otmp->otyp != HORN_OF_PLENTY || !otmp->dknown
|
||||||
|| !objects[HORN_OF_PLENTY].oc_name_known))
|
|| !objects[HORN_OF_PLENTY].oc_name_known))
|
||||||
|| (!strcmp(word, "charge") && !is_chargeable(otmp))
|
|| (!strcmp(word, "charge") && !is_chargeable(otmp))
|
||||||
|
|| (!strcmp(word, "open") && otyp != TIN)
|
||||||
|| (!strcmp(word, "call") && !objtyp_is_callable(otyp))
|
|| (!strcmp(word, "call") && !objtyp_is_callable(otyp))
|
||||||
) {
|
) {
|
||||||
foo--;
|
foo--;
|
||||||
|
|||||||
Reference in New Issue
Block a user