diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index a3fe55a1d..5816dcee4 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1373,6 +1373,16 @@ when a spellbook was polymorphed into a novel and then incrementing spestudied walking on ice can make you slide in a random direction if an adjacent statue was a in a pit, you could break it with a pick-axe even though you're conceptually at the wrong elevation to reach it +using '#adjust c c' to collect all invent items compatible with the one in + slot c prefixed the inventory update message with "Merging:" rather + than "Collecting:" if there was at least one compatible stack; when + there weren't any compatible stacks and it was effectively a no-op, + the prefix used was "Collecting", lacking its intended colon +using '#adjust c d' or '#adjust d c' after splitting slot c via '#adjust Nc d' + for N less than c's stack size swapped c and d instead of re-merging + them even though merging was the intended behavior (the 3.6 change + that caused this was intended to avoid collecting other compatible + stacks while still merging the two specified ones) Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/invent.c b/src/invent.c index 9cd06a2e4..866a1659f 100644 --- a/src/invent.c +++ b/src/invent.c @@ -5595,7 +5595,7 @@ doorganize_core(struct obj *obj) collect = (let == obj->invlet); /* change the inventory and print the resulting item */ - adj_type = collect ? "Collecting" : !splitting ? "Moving:" : "Splitting:"; + adj_type = collect ? "Collecting:" : !splitting ? "Moving:" : "Splitting:"; /* * don't use freeinv/addinv to avoid double-touching artifacts, @@ -5603,7 +5603,8 @@ doorganize_core(struct obj *obj) */ extract_nobj(obj, &gi.invent); - for (otmp = gi.invent; otmp;) { + for (otmp = gi.invent; otmp; ) { + otmpname = has_oname(otmp) ? ONAME(otmp) : (char *) 0; /* it's tempting to pull this outside the loop, but merged() could free ONAME(obj) [via obfree()] and replace it with ONAME(otmp) */ objname = has_oname(obj) ? ONAME(obj) : (char *) 0; @@ -5615,16 +5616,24 @@ doorganize_core(struct obj *obj) with compatible named ones; we only want that if it is the 'from' stack (obj) with a name and candidate (otmp) without one, not unnamed 'from' with named candidate. */ - otmpname = has_oname(otmp) ? ONAME(otmp) : (char *) 0; if ((!otmpname || (objname && !strcmp(objname, otmpname))) && merged(&otmp, &obj)) { - adj_type = "Merging:"; + /*adj_type = "Collecting:"; //already set to this*/ obj = otmp; otmp = otmp->nobj; extract_nobj(obj, &gi.invent); continue; /* otmp has already been updated */ } } else if (otmp->invlet == let) { + /* Merging: when from and to are compatible */ + if ((!otmpname || (objname && !strcmp(objname, otmpname))) + && merged(&otmp, &obj)) { + adj_type = "Merging:"; + obj = otmp; + otmp = otmp->nobj; + extract_nobj(obj, &gi.invent); + break; /* otmp has been updated and we're done merging */ + } /* Moving or splitting: don't merge extra compatible stacks. Found 'otmp' in destination slot; merge if compatible, otherwise bump whatever is there to an open slot. */