diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 94086df1a..16199ef81 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.233 $ $NHDT-Date: 1505214878 2017/09/12 11:14:38 $ +.\" $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.240 $ $NHDT-Date: 1512098127 2017/12/01 03:15:27 $ .ds h0 "NetHack Guidebook .ds h1 .ds h2 % @@ -924,8 +924,17 @@ This command allows you to move an item from one particular inventory slot to another so that it has a letter which is more meaningful for you or that it will appear in a particular location when inventory listings are displayed. +You can move to a currently empty slot, or if the destination is +occupied--and won't merge--the item there will swap slots with the one +being moved. ``#adjust'' can also be used to split a stack of objects; when choosing the item to adjust, enter a count prior to its letter. +.lp "" +When no count is given, other compatible stacks are merged with the source +stack as it's moved to the destination. When a split count is given, the +only stack that might be merged is the one already in the destination. +To move a whole stack without having other compatible ones merge with it, +specify a ``split'' count which matches the full stack size. .lp #annotate Allows you to specify one line of text to associate with the current dungeon level. All levels with annotations are displayed by the diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index b67342c74..e776b02d0 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -1104,8 +1104,17 @@ This command allows you to move an item from one particular inventory slot to another so that it has a letter which is more meaningful for you or that it will appear in a particular location when inventory listings are displayed. +You can move to a currently empty slot, or if the destination is +occupied--and won't merge--the item there will swap slots with the one +being moved. ``{\tt \#adjust}'' can also be used to split a stack of objects; when -choosing the item to adjust, enter a count prior to its letter. +choosing the item to adjust, enter a count prior to its letter.\\ +%.lp "" +When no count is given, other compatible stacks are merged with the source +stack as it's moved to the destination. When a split count is given, the +only stack that might be merged is the one already in the destination. +To move a whole stack without having other compatible ones merge with it, +specify a ``split'' count which matches the full stack size. %.lp \item[\tb{\#annotate}] Allows you to specify one line of text to associate with the current diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 403940916..4e1d79c76 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -720,6 +720,9 @@ Master Key of Thievery always finds door and chest traps if used to lock or "Elbereth" now erodes based on attacks by the player, not monsters scared option herecmd_menu to make a mouse click on your character pop up a context menu, and extended command #herecmdmenu to do the same +for #adjust, specifying a split count which matches an inventory slot's full + size will move or swap that stack without combining other compatible + stacks (except for the one in the destination slot, if applicable) Platform- and/or Interface-Specific New Features diff --git a/src/invent.c b/src/invent.c index edacfc547..4a8a68815 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 invent.c $NHDT-Date: 1508827592 2017/10/24 06:46:32 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.220 $ */ +/* NetHack 3.6 invent.c $NHDT-Date: 1512096431 2017/12/01 02:47:11 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.222 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -617,8 +617,7 @@ void carry_obj_effects(obj) struct obj *obj; { - /* Cursed figurines can spontaneously transform - when carried. */ + /* Cursed figurines can spontaneously transform when carried. */ if (obj->otyp == FIGURINE) { if (obj->cursed && obj->corpsenm != NON_PM && !dead_species(obj->corpsenm, TRUE)) { @@ -1473,6 +1472,9 @@ redo_menu: else if (otmp->otyp == LOADSTONE && otmp->cursed) /* kludge for canletgo()'s can't-drop-this message */ otmp->corpsenm = (int) cnt; + } else if (!strcmp(word, "adjust")) { + /* specifying stack's full count means something to #adjust */ + otmp->nomerge = 1; } } return otmp; @@ -3568,7 +3570,7 @@ doorganize() /* inventory organizer by Del Lamb */ char qbuf[QBUFSZ]; char allowall[4]; /* { ALLOW_COUNT, ALL_CLASSES, 0, 0 } */ const char *adj_type; - boolean ever_mind = FALSE; + boolean ever_mind = FALSE, dont_collect = FALSE; if (!invent) { You("aren't carrying anything to adjust."); @@ -3600,12 +3602,19 @@ doorganize() /* inventory organizer by Del Lamb */ /* figure out whether user gave a split count to getobj() */ splitting = bumped = 0; - for (otmp = invent; otmp; otmp = otmp->nobj) - if (otmp->nobj == obj) { /* knowledge of splitobj() operation */ - if (otmp->invlet == obj->invlet) - splitting = otmp; - break; - } + if (obj->nomerge) { + /* player specified full count; no split occurred and we'll + avoid collecting compatible stacks when moving this one */ + obj->nomerge = 0; + dont_collect = TRUE; + } else { + for (otmp = invent; otmp; otmp = otmp->nobj) + if (otmp->nobj == obj) { /* knowledge of splitobj() operation */ + if (otmp->invlet == obj->invlet) + splitting = otmp; + break; + } + } /* initialize the list with all lower and upper case letters */ lets[GOLD_INDX] = (obj->oclass == COIN_CLASS) ? GOLD_SYM : ' '; @@ -3659,7 +3668,7 @@ doorganize() /* inventory organizer by Del Lamb */ /* adjusting to same slot is meaningful since all compatible stacks get collected along the way, but splitting to same slot is not */ - || (splitting && let == obj->invlet)) { + || ((splitting || dont_collect) && let == obj->invlet)) { noadjust: if (splitting) (void) merged(&splitting, &obj); @@ -3692,7 +3701,7 @@ doorganize() /* inventory organizer by Del Lamb */ extract_nobj(obj, &invent); for (otmp = invent; otmp;) { - if (!splitting) { + if (!splitting && !dont_collect) { if (merged(&otmp, &obj)) { adj_type = "Merging:"; obj = otmp; @@ -3730,7 +3739,7 @@ doorganize() /* inventory organizer by Del Lamb */ if (merged(&otmp, &obj)) { obj = otmp; extract_nobj(obj, &invent); - } else if (inv_cnt(FALSE) >= 52) { + } else if (inv_cnt(FALSE) >= 52 && !dont_collect) { (void) merged(&splitting, &obj); /* undo split */ /* "knapsack cannot accommodate any more items" */ Your("pack is too full.");