diff -c3 -r off6e4f5/src/mkobj.c chg6e4f5/src/mkobj.c *** off6e4f5/src/mkobj.c Fri Aug 31 14:25:36 2001 --- chg6e4f5/src/mkobj.c Fri Oct 19 11:45:10 2001 *************** *** 1507,1515 **** --- 1507,1521 ---- add_to_container(container, obj) struct obj *container, *obj; { + struct obj *otmp; + if (obj->where != OBJ_FREE) panic("add_to_container: obj not free"); + /* Merge if possible */ + for (otmp = container->cobj; otmp; otmp = otmp->nobj) + if (merged(&otmp, &obj)) return; + obj->where = OBJ_CONTAINED; obj->ocontainer = container; obj->nobj = container->cobj; diff -c3 -r off6e4f5/src/pickup.c chg6e4f5/src/pickup.c *** off6e4f5/src/pickup.c Fri Aug 31 14:25:38 2001 --- chg6e4f5/src/pickup.c Fri Oct 19 12:09:08 2001 *************** *** 1478,1484 **** in_container(obj) register struct obj *obj; { ! register struct obj *gold; boolean is_gold = (obj->oclass == GOLD_CLASS); boolean floor_container = !carried(current_container); char buf[BUFSZ]; --- 1478,1484 ---- in_container(obj) register struct obj *obj; { ! /* register struct obj *gold; */ /* Contmerge */ boolean is_gold = (obj->oclass == GOLD_CLASS); boolean floor_container = !carried(current_container); char buf[BUFSZ]; *************** *** 1545,1572 **** freeinv(obj); - if (is_gold) { /* look for other money to merge within the container */ - for (gold = current_container->cobj; gold; gold = gold->nobj) - if (gold->otyp == obj->otyp) break; - } else - gold = 0; - - if (gold) { - gold->quan += obj->quan; - gold->owt = weight(gold); - } else { - add_to_container(current_container, obj); - } - - current_container->owt = weight(current_container); - #ifdef SHOW_WEIGHT - if (!floor_container && flags.invweight) - update_inventory(); - #endif - - Strcpy(buf, the(xname(current_container))); - You("put %s into %s.", doname(obj), buf); - if (obj_is_burning(obj)) /* this used to be part of freeinv() */ (void) snuff_lit(obj); --- 1545,1550 ---- *************** *** 1596,1601 **** --- 1574,1582 ---- (void)stolen_value(current_container, u.ux, u.uy, (boolean)shkp->mpeaceful, FALSE); } + obfree(obj, (struct obj *)0); + /* obfree because we haven't actually put it in the bag yet */ + delete_contents(current_container); if (!floor_container) useup(current_container); *************** *** 1608,1617 **** current_container = 0; /* baggone = TRUE; */ } ! if (is_gold) { ! if (gold) dealloc_obj(obj); ! bot(); /* update character's gold piece count immediately */ ! } return(current_container ? 1 : -1); } --- 1589,1607 ---- current_container = 0; /* baggone = TRUE; */ } ! if (current_container) { ! Strcpy(buf, the(xname(current_container))); ! You("put %s into %s.", doname(obj), buf); ! ! add_to_container(current_container, obj); ! current_container->owt = weight(current_container); ! } ! if (is_gold) bot(); /* update character's gold piece count immediately */ ! ! #ifdef SHOW_WEIGHT ! if (!floor_container && flags.invweight) ! update_inventory(); ! #endif return(current_container ? 1 : -1); }