re-merge objects removed from containers when pack is full

- affects failed removal of a partial count of objects due to a full pack
This commit is contained in:
cohrs
2002-03-30 20:56:09 +00:00
parent 750c6b2a36
commit adf468910c
3 changed files with 17 additions and 3 deletions

View 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

View 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':

View 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);
}