diff -Nbaur -x '*~' -x '#*#' nethack-3.4.3/include/extern.h nethack-tinopener/include/extern.h --- nethack-3.4.3/include/extern.h 2003-12-08 10:39:13.000000000 +1100 +++ nethack-tinopener/include/extern.h 2005-12-05 17:01:45.000000000 +1100 @@ -521,6 +521,7 @@ E int NDECL(Hear_again); E void NDECL(reset_eat); E int NDECL(doeat); +E int FDECL(use_tin_opener, (struct obj *)); E void NDECL(gethungry); E void FDECL(morehungry, (int)); E void FDECL(lesshungry, (int)); diff -Nbaur -x '*~' -x '#*#' nethack-3.4.3/src/apply.c nethack-tinopener/src/apply.c --- nethack-3.4.3/src/apply.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-tinopener/src/apply.c 2005-12-05 17:00:41.000000000 +1100 @@ -1365,6 +1365,7 @@ } } + boolean tinnable(corpse) struct obj *corpse; @@ -2926,17 +2927,8 @@ res = dowrite(obj); break; case TIN_OPENER: - if(!carrying(TIN)) { - You("have no tin to open."); - 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; - + res = use_tin_opener(obj); + break; case FIGURINE: use_figurine(&obj); break; diff -Nbaur -x '*~' -x '#*#' nethack-3.4.3/src/eat.c nethack-tinopener/src/eat.c --- nethack-3.4.3/src/eat.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-tinopener/src/eat.c 2005-12-05 17:01:09.000000000 +1100 @@ -2092,6 +2092,24 @@ return(1); } +int +use_tin_opener(obj) +register struct obj *obj; +{ + register struct obj *otmp; + int res = 0; + if (obj != uwep) { + 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 * modifying usedtime. Returns 1 if they choked and survived, 0 otherwise. */ diff -Nbaur -x '*~' -x '#*#' nethack-3.4.3/src/invent.c nethack-tinopener/src/invent.c --- nethack-3.4.3/src/invent.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-tinopener/src/invent.c 2005-12-05 16:59:22.000000000 +1100 @@ -902,6 +902,7 @@ || (!strcmp(word, "untrap with") && (otmp->oclass == TOOL_CLASS && otyp != CAN_OF_GREASE)) || (!strcmp(word, "charge") && !is_chargeable(otmp)) + || (!strcmp(word, "open") && otyp != TIN) ) foo--; /* ugly check for unworn armor that can't be worn */