Newsgroups: rec.games.roguelike.nethack Cc: nethack-bugs@nethack.org Subject: pickup_thrown patch: automatically pick up things you threw From: Roderick Schertler Date: 17 Apr 2002 11:47:30 -0400 Message-ID: X-Newsreader: Gnus v5.7/Emacs 20.7 This is a patch for Nethack 3.4.0 which adds a new "pickup_thrown" option. If pickup_thrown and autopickup are both on, you'll automatically pick up things you threw, even if you wouldn't normally have picked up that sort of thing. It makes using missile weapons less hassle and more fun. This does change the game mechanics a bit, but it's not terribly different from what you can already do by manipulating your pickup_types. Without this, if you're in a tight spot and you need the missiles you've already thrown, you can temporarily add ) to your pickup types, but you'll have to be careful not to step over a spot which contains enough foreign weapons to increase your encumbrance. With pickup_thrown you just don't have to worry about it. I think it's a good tradeoff. I sent a 3.3.1 version of this patch in to the Nethack dev team back in August of 2000. It wasn't included in the 3.4.0 release, but I don't know if that's because they disapproved or because they overlooked it (I didn't hear from them at all). In case it's the latter (this is a problem we had with the Perl development effort) I'm going to send another copy, but I'm also going to release it publically, as directed by the README. It's best to finish any saved games before applying this patch. If you don't it will at least screw up your in-game options, and I can't swear it won't do worse. Bones files should be fine, the worst that could happen is that it'll think you threw something that you didn't. Roderick Schertler diff -u 'nethack-3.4.0/dat/opthelp' 'nethack/dat/opthelp' Index: ./dat/opthelp --- ./dat/opthelp Wed Mar 20 18:42:31 2002 +++ ./dat/opthelp Thu Apr 4 08:51:01 2002 @@ -23,6 +23,7 @@ delay code) if moving objects seem to teleport across rooms number_pad use the number keys to move instead of yuhjklbn [FALSE] perm_invent keep inventory in a permanent window [FALSE] +pickup_thrown autopickup things you threw [TRUE] prayconfirm use confirmation prompt when #pray command issued [TRUE] pushweapon when wielding a new weapon, put your previously wielded weapon into the secondary weapon slot [FALSE] diff -u 'nethack-3.4.0/doc/Guidebook.mn' 'nethack/doc/Guidebook.mn' Index: ./doc/Guidebook.mn --- ./doc/Guidebook.mn Wed Mar 20 18:42:39 2002 +++ ./doc/Guidebook.mn Thu Apr 4 08:51:01 2002 @@ -1940,6 +1940,12 @@ level (Unburdened, Burdened, streSsed, straiNed, overTaxed, or overLoaded), you will be asked if you want to continue. (Default `S'). +.lp pickup_thrown +If this boolean option is true and +.op autopickup +is on, try to pick up things that you threw, even if they aren't in +.op pickup_types . +Default is on. .lp pickup_types Specify the object types to be picked up when .op autopickup diff -u 'nethack-3.4.0/doc/Guidebook.tex' 'nethack/doc/Guidebook.tex' Index: ./doc/Guidebook.tex --- ./doc/Guidebook.tex Wed Mar 20 18:42:39 2002 +++ ./doc/Guidebook.tex Thu Apr 4 08:51:01 2002 @@ -2382,6 +2382,11 @@ or overLoaded), you will be asked if you want to continue. (Default `S'). %.lp +\item[\ib{pickup\_thrown}] +If this boolean option is true and {\it autopickup\/} is on, try to pick up +things that you threw, even if they aren't in {\it pickup\_types\/}. +Default is on. +%.lp \item[\ib{pickup\_types}] Specify the object types to be picked up when {\it autopickup\/} is on. Default is all types. diff -u 'nethack-3.4.0/include/flag.h' 'nethack/include/flag.h' Index: ./include/flag.h Prereq: 3.4 --- ./include/flag.h Wed Mar 20 18:42:46 2002 +++ ./include/flag.h Thu Apr 4 08:51:01 2002 @@ -63,6 +63,7 @@ #endif boolean perm_invent; /* keep full inventories up until dismissed */ boolean pickup; /* whether you pickup or move and look */ + boolean pickup_thrown; /* auto-pickup items you threw */ boolean pushweapon; /* When wielding, push old weapon into second slot */ boolean rest_on_space; /* space means rest */ diff -u 'nethack-3.4.0/include/obj.h' 'nethack/include/obj.h' Index: ./include/obj.h Prereq: 3.4 --- ./include/obj.h Wed Mar 20 18:42:51 2002 +++ ./include/obj.h Thu Apr 4 10:17:34 2002 @@ -86,7 +86,8 @@ Bitfield(in_use,1); /* for magic items before useup items */ Bitfield(bypass,1); /* mark this as an object to be skipped by bhito() */ - /* 6 free bits */ + Bitfield(was_thrown,1); /* thrown by the hero since last picked up */ + /* 5 free bits */ int corpsenm; /* type of corpse is mons[corpsenm] */ #define leashmon corpsenm /* gets m_id of attached pet */ diff -u 'nethack-3.4.0/src/bones.c' 'nethack/src/bones.c' Index: ./src/bones.c Prereq: 3.4 --- ./src/bones.c Wed Mar 20 18:43:00 2002 +++ ./src/bones.c Thu Apr 4 08:51:01 2002 @@ -82,6 +82,7 @@ otmp->rknown = 0; otmp->invlet = 0; otmp->no_charge = 0; + otmp->was_thrown = 0; if (otmp->otyp == SLIME_MOLD) goodfruit(otmp->spe); #ifdef MAIL diff -u 'nethack-3.4.0/src/dothrow.c' 'nethack/src/dothrow.c' Index: ./src/dothrow.c Prereq: 3.4 --- ./src/dothrow.c Wed Mar 20 18:43:03 2002 +++ ./src/dothrow.c Thu Apr 4 08:51:01 2002 @@ -830,6 +830,7 @@ boolean impaired = (Confusion || Stunned || Blind || Hallucination || Fumbling); + obj->was_thrown = 1; if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) { boolean slipok = TRUE; if (ammo_and_launcher(obj, uwep)) diff -u 'nethack-3.4.0/src/options.c' 'nethack/src/options.c' Index: ./src/options.c Prereq: 3.4 --- ./src/options.c Wed Mar 20 18:43:12 2002 +++ ./src/options.c Thu Apr 4 10:18:35 2002 @@ -140,6 +140,7 @@ {"page_wait", (boolean *)0, FALSE, SET_IN_FILE}, #endif {"perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME}, + {"pickup_thrown", &flags.pickup_thrown, TRUE, SET_IN_GAME}, {"popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME}, /*WC*/ {"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME}, {"preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME}, /*WC*/ diff -u 'nethack-3.4.0/src/pickup.c' 'nethack/src/pickup.c' Index: ./src/pickup.c Prereq: 3.4 --- ./src/pickup.c Wed Mar 20 18:43:13 2002 +++ ./src/pickup.c Thu Apr 4 08:51:02 2002 @@ -588,13 +588,15 @@ /* first count the number of eligible items */ for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow)) - if (!*otypes || index(otypes, curr->oclass)) + if (!*otypes || index(otypes, curr->oclass) + || (flags.pickup_thrown && curr->was_thrown)) n++; if (n) { *pick_list = pi = (menu_item *) alloc(sizeof(menu_item) * n); for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow)) - if (!*otypes || index(otypes, curr->oclass)) { + if (!*otypes || index(otypes, curr->oclass) + || (flags.pickup_thrown && curr->was_thrown)) { pi[n].item.a_obj = curr; pi[n].count = curr->quan; n++; @@ -1253,6 +1255,7 @@ obj = splitobj(obj, count); obj = pick_obj(obj); + obj->was_thrown = 0; if (uwep && uwep == obj) mrg_to_wielded = TRUE; nearload = near_capacity(); -- Roderick Schertler roderick@argon.org