]> granicus.if.org Git - nethack/commitdiff
re-merge objects removed from containers when pack is full
authorcohrs <cohrs>
Sat, 30 Mar 2002 20:56:09 +0000 (20:56 +0000)
committercohrs <cohrs>
Sat, 30 Mar 2002 20:56:09 +0000 (20:56 +0000)
- affects failed removal of a partial count of objects due to a full pack

doc/fixes34.1
src/invent.c
src/pickup.c

index 07c0d627e8e44905015eff597ae22305a847542f..b106bacaaacd81cd50bb366ee4e1e0cc19bdddb0 100644 (file)
@@ -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
index a80a2cc74f81b319d203dd62f4fec994b8154d4f..87b9b96d6625848fd4f8b571070c3cda704a25df 100644 (file)
@@ -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':
index 0cadd6382e4d5c166639af039ab206e00086a715..9256a47aa0ce3ba884aee54fdacb7ace2533cfe8 100644 (file)
@@ -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);
        }