From: cohrs Date: Sat, 30 Mar 2002 20:56:09 +0000 (+0000) Subject: re-merge objects removed from containers when pack is full X-Git-Tag: MOVE2GIT~2853 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=adf468910c83025171498605a14e639b448f5160;p=nethack re-merge objects removed from containers when pack is full - affects failed removal of a partial count of objects due to a full pack --- diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 07c0d627e..b106bacaa 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -35,6 +35,8 @@ specific message for engraving headstone with wand of digging wielded/quivered chained ball should be unwielded when thrown polymorphing into a form that cannot twoweapon should immediately disable twoweapon mode +taking partial count of merged objects from a container while your pack + was full split the object and did not re-merge Platform- and/or Interface-Specific Fixes diff --git a/src/invent.c b/src/invent.c index a80a2cc74..87b9b96d6 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1271,7 +1271,7 @@ register int allflag, mx; register const char *olets, *word; /* olets is an Obj Class char array */ register int FDECL((*fn),(OBJ_P)), FDECL((*ckfn),(OBJ_P)); { - register struct obj *otmp, *otmp2; + struct obj *otmp, *otmp2, *otmpo; register char sym, ilet; register int cnt = 0, dud = 0, tmp; boolean takeoff, nodot, ident, ininv; @@ -1306,6 +1306,7 @@ nextclass: } else sym = 'y'; + otmpo = otmp; if (sym == '#') { /* Number was entered; split the object unless it corresponds to 'none' or 'all'. 2 special cases: cursed loadstones and @@ -1328,7 +1329,13 @@ nextclass: allflag = 1; case 'y': tmp = (*fn)(otmp); - if(tmp < 0) goto ret; + if(tmp < 0) { + if (otmp != otmpo) { + /* split occurred, merge again */ + (void) merged(&otmpo, &otmp); + } + goto ret; + } cnt += tmp; if(--mx == 0) goto ret; case 'n': diff --git a/src/pickup.c b/src/pickup.c index 0cadd6382..9256a47aa 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -2178,8 +2178,13 @@ boolean put_in; /* special split case also handled by askchain() */ } res = put_in ? in_container(otmp) : out_container(otmp); - if (res < 0) + if (res < 0) { + if (otmp != pick_list[i].item.a_obj) { + /* split occurred, merge again */ + (void) merged(&pick_list[i].item.a_obj, &otmp); + } break; + } } free((genericptr_t)pick_list); }