diff -bruNX ignore.txt ..\official/include/config.h ./include/config.h --- ..\official/include/config.h Mon Dec 8 01:39:14 2003 +++ ./include/config.h Mon Jul 19 12:24:40 2004 @@ -351,6 +351,8 @@ /*#define GOLDOBJ */ /* Gold is kept on obj chains - Helge Hafting */ /*#define AUTOPICKUP_EXCEPTIONS */ /* exceptions to autopickup */ +#define AOY_CONTAINER /* Code for allowing AoY, BoD, BoO and CoI in containers */ + /* End of Section 5 */ #include "global.h" /* Define everything else according to choices above */ diff -bruNX ignore.txt ..\official/include/dungeon.h ./include/dungeon.h --- ..\official/include/dungeon.h Mon Dec 8 01:39:14 2003 +++ ./include/dungeon.h Mon Jul 19 12:25:40 2004 @@ -143,6 +143,10 @@ #define MIGR_PORTAL 8 /* magic portal */ #define MIGR_NEAR_PLAYER 9 /* mon: followers; obj: trap door */ +#ifdef AOY_CONTAINER +#define MIGR_ORACLE 10 /* send to Oracle */ +#endif + /* level information (saved via ledger number) */ struct linfo { diff -bruNX ignore.txt ..\official/include/extern.h ./include/extern.h --- ..\official/include/extern.h Mon Dec 8 01:39:14 2003 +++ ./include/extern.h Mon Jul 19 15:03:06 2004 @@ -1578,7 +1578,10 @@ E const char *FDECL(halu_gname, (ALIGNTYP_P)); E const char *FDECL(align_gtitle, (ALIGNTYP_P)); E void FDECL(altar_wrath, (int,int)); - +#ifdef AOY_CONTAINER +E void FDECL(at_your_feet, (const char *)); +E void FDECL(godvoice,(ALIGNTYP_P,const char*)); +#endif /* ### priest.c ### */ @@ -1790,8 +1793,13 @@ E int FDECL(inhishop, (struct monst *)); E struct monst *FDECL(shop_keeper, (CHAR_P)); E boolean FDECL(tended_shop, (struct mkroom *)); +#ifdef AOY_CONTAINER +E void FDECL(delete_contents, (struct obj *, BOOLEAN_P)); +E void FDECL(obfree, (struct obj *,struct obj *, BOOLEAN_P)); +#else E void FDECL(delete_contents, (struct obj *)); E void FDECL(obfree, (struct obj *,struct obj *)); +#endif E void FDECL(home_shk, (struct monst *,BOOLEAN_P)); E void FDECL(make_happy_shk, (struct monst *,BOOLEAN_P)); E void FDECL(hot_pursuit, (struct monst *)); @@ -1909,6 +1917,9 @@ E void FDECL(relobj, (struct monst *,int,BOOLEAN_P)); #ifdef GOLDOBJ E struct obj *FDECL(findgold, (struct obj *)); +#endif +#ifdef AOY_CONTAINER +E int FDECL(desire_value, (struct obj *)); #endif /* ### steed.c ### */ diff -bruNX ignore.txt ..\official/include/hack.h ./include/hack.h --- ..\official/include/hack.h Mon Dec 8 01:39:14 2003 +++ ./include/hack.h Mon Jul 19 13:40:26 2004 @@ -59,6 +59,15 @@ #define SELL_DELIBERATE (1) #define SELL_DONTSELL (2) +/* desire values for items wanted by covetous monsters */ +#ifdef AOY_CONTAINER +#define DV_AMULET 16 /* same order as in stealamulet in steal.c */ +#define DV_QUEST_ARTI 8 +#define DV_BELL 4 +#define DV_BOOK 2 +#define DV_CANDELABRA 1 +#endif + /* * This is the way the game ends. If these are rearranged, the arrays * in end.c and topten.c will need to be changed. Some parts of the diff -bruNX ignore.txt ..\official/src/apply.c ./src/apply.c --- ..\official/src/apply.c Mon Dec 8 01:39:14 2003 +++ ./src/apply.c Mon Jul 19 15:07:30 2004 @@ -1675,7 +1675,11 @@ } /* free figurine now */ obj_extract_self(figurine); +#ifdef AOY_CONTAINER + obfree(figurine, (struct obj *)0, FALSE); +#else obfree(figurine, (struct obj *)0); +#endif if (redraw) newsym(cc.x, cc.y); } diff -bruNX ignore.txt ..\official/src/bones.c ./src/bones.c --- ..\official/src/bones.c Mon Dec 8 01:39:14 2003 +++ ./src/bones.c Mon Jul 19 12:37:58 2004 @@ -64,6 +64,10 @@ if (otmp->cobj) resetobjs(otmp->cobj,restore); +#ifdef AOY_CONTAINER + if (Is_container(otmp)) otmp->spe = 0; +#endif + if (((otmp->otyp != CORPSE || otmp->corpsenm < SPECIAL_PM) && otmp->otyp != STATUE) && (!otmp->oartifact || diff -bruNX ignore.txt ..\official/src/dig.c ./src/dig.c --- ..\official/src/dig.c Mon Dec 8 01:39:14 2003 +++ ./src/dig.c Mon Jul 19 15:07:26 2004 @@ -1318,7 +1318,11 @@ under_ice = is_ice(otmp->ox, otmp->oy); if (otmp->otyp == ROCK && !under_ice) { /* merges into burying material */ +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif return(otmp2); } /* @@ -1405,7 +1409,11 @@ (void)bury_an_obj(obj->cobj); } obj_extract_self(obj); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *) 0, FALSE); +#else obfree(obj, (struct obj *) 0); +#endif } /* diff -bruNX ignore.txt ..\official/src/do.c ./src/do.c --- ..\official/src/do.c Mon Dec 8 01:39:14 2003 +++ ./src/do.c Mon Jul 19 15:09:16 2004 @@ -120,7 +120,11 @@ /* boulder is now gone */ if (pushing) delobj(otmp); +#ifdef AOY_CONTAINER + else obfree(otmp, (struct obj *)0, FALSE); +#else else obfree(otmp, (struct obj *)0); +#endif return TRUE; } return FALSE; @@ -186,7 +190,11 @@ } } deltrap(t); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); +#else obfree(obj, (struct obj *)0); +#endif bury_objs(x, y); newsym(x,y); return TRUE; diff -bruNX ignore.txt ..\official/src/do_name.c ./src/do_name.c --- ..\official/src/do_name.c Mon Dec 8 01:39:14 2003 +++ ./src/do_name.c Mon Jul 19 12:43:30 2004 @@ -303,11 +303,37 @@ /* strip leading and trailing spaces; unnames item if all spaces */ (void)mungspaces(buf); +#ifdef AOY_CONTAINER + if (obj->otyp == AMULET_OF_YENDOR || (obj->otyp == FAKE_AMULET_OF_YENDOR && !obj->known)) + if (u.ualign.type == u.ualignbase[A_ORIGINAL]) { + Sprintf(qbuf, "Did I ask you to bring '%s' or the Amulet of Yendor?", buf); + godvoice(u.ualign.type, qbuf); + You("realize you have made a %s.", Hallucination ? "big boo-boo" : "major mistake"); + change_luck(-3); + adjalign(-5); + u.ugangr += 3; + return; + } else { + godvoice(u.ualign.type, "I'd like that you would not try to name the most sacred thing!"); + You("realize you have made a %s.", Hallucination ? "boo-boo" : "mistake"); + change_luck(-1); + adjalign(-3); + u.ugangr += 1; + return; + } + else if (obj->otyp == FAKE_AMULET_OF_YENDOR && obj->known) + pline("Knowing that this is a fake Amulet of Yendor, you dare to name it '%s'.", buf); +#endif + /* relax restrictions over proper capitalization for artifacts */ if ((aname = artifact_name(buf, &objtyp)) != 0 && objtyp == obj->otyp) Strcpy(buf, aname); - +#ifdef AOY_CONTAINER + if (obj->oartifact || obj->otyp == CANDELABRUM_OF_INVOCATION || + obj->otyp == BELL_OF_OPENING || obj->otyp == SPE_BOOK_OF_THE_DEAD) { +#else if (obj->oartifact) { +#endif pline_The("artifact seems to resist the attempt."); return; } else if (restrict_name(obj, buf) || exist_artifact(obj->otyp, buf)) { diff -bruNX ignore.txt ..\official/src/dogmove.c ./src/dogmove.c --- ..\official/src/dogmove.c Mon Dec 8 01:39:14 2003 +++ ./src/dogmove.c Mon Jul 19 16:03:30 2004 @@ -300,7 +300,11 @@ could_reach_item(mtmp, obj->ox, obj->oy)) return dog_eat(mtmp, obj, omx, omy, FALSE); +#ifdef AOY_CONTAINER + if(can_carry(mtmp, obj) && !obj->cursed && !(Is_container(obj) && (obj->spe & DV_AMULET)) && +#else if(can_carry(mtmp, obj) && !obj->cursed && +#endif could_reach_item(mtmp, obj->ox, obj->oy)) { if(rn2(20) < edog->apport+3) { if (rn2(udist) || !rn2(edog->apport)) { diff -bruNX ignore.txt ..\official/src/dokick.c ./src/dokick.c --- ..\official/src/dokick.c Mon Dec 8 01:39:14 2003 +++ ./src/dokick.c Mon Jul 19 15:14:40 2004 @@ -381,7 +381,11 @@ useup(otmp); else { obj_extract_self(otmp); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *) 0, FALSE); +#else obfree(otmp, (struct obj *) 0); +#endif } } } @@ -1360,7 +1364,11 @@ } You_hear("a muffled %s.",result); obj_extract_self(otmp); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *) 0, FALSE); +#else obfree(otmp, (struct obj *) 0); +#endif return TRUE; } @@ -1394,6 +1402,10 @@ register int nx, ny; long where; +#ifdef AOY_CONTAINER + register struct monst *mtmp = (struct monst *) 0; +#endif + for (otmp = migrating_objs; otmp; otmp = otmp2) { otmp2 = otmp->nobj; if (otmp->ox != u.uz.dnum || otmp->oy != u.uz.dlevel) continue; @@ -1415,6 +1427,18 @@ case MIGR_RANDOM: nx = ny = 0; break; } + +#ifdef AOY_CONTAINER + if (where == MIGR_ORACLE) { + for (mtmp = level.monlist; mtmp; mtmp = mtmp->nmon) + if (mtmp->data == &mons[PM_ORACLE]) break; + if (mtmp) { + add_to_minv(mtmp, otmp); + continue; + } else + nx = 2+((x_maze_max-2)/2), ny = 2+((y_maze_max-2)/2); + } +#endif if (nx > 0) { place_object(otmp, nx, ny); stackobj(otmp); diff -bruNX ignore.txt ..\official/src/dothrow.c ./src/dothrow.c --- ..\official/src/dothrow.c Mon Dec 8 01:39:14 2003 +++ ./src/dothrow.c Mon Jul 19 15:15:30 2004 @@ -1335,7 +1335,11 @@ if (broken) { if (*u.ushops) check_shop_obj(obj, bhitpos.x,bhitpos.y, TRUE); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); +#else obfree(obj, (struct obj *)0); +#endif return 1; } } diff -bruNX ignore.txt ..\official/src/end.c ./src/end.c --- ..\official/src/end.c Mon Dec 8 01:39:14 2003 +++ ./src/end.c Mon Jul 19 15:16:26 2004 @@ -848,7 +848,11 @@ Sprintf(pbuf, "%8ld %s (worth %ld %s),", count, xname(otmp), count * (long)objects[typ].oc_cost, currency(2L)); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif } else { Sprintf(pbuf, "%8ld worthless piece%s of colored glass,", diff -bruNX ignore.txt ..\official/src/fountain.c ./src/fountain.c --- ..\official/src/fountain.c Mon Dec 8 01:39:14 2003 +++ ./src/fountain.c Mon Jul 19 15:17:42 2004 @@ -540,7 +540,11 @@ case 4: do { otmp = mkobj(POTION_CLASS,FALSE); if (otmp->otyp == POT_WATER) { +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif otmp = (struct obj *) 0; } } while(!otmp); @@ -552,7 +556,11 @@ otmp->quan++; /* Avoid panic upon useup() */ otmp->fromsink = 1; /* kludge for docall() */ (void) dopotion(otmp); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif break; case 5: if (!(levl[u.ux][u.uy].looted & S_LRING)) { You("find a ring in the sink!"); diff -bruNX ignore.txt ..\official/src/invent.c ./src/invent.c --- ..\official/src/invent.c Mon Dec 8 01:39:14 2003 +++ ./src/invent.c Mon Jul 19 15:21:34 2004 @@ -7,6 +7,11 @@ #define NOINVSYM '#' #define CONTAINED_SYM '>' /* designator for inside a container */ +#ifdef AOY_CONTAINER +extern int oracle_knows; +extern int oracle_has; +#endif + #ifdef OVL1 STATIC_DCL void NDECL(reorder_invent); STATIC_DCL boolean FDECL(mergable,(struct obj *,struct obj *)); @@ -223,7 +228,11 @@ } #endif /*0*/ +#ifdef AOY_CONTAINER + obfree(obj,otmp, FALSE); /* free(obj), bill->otmp */ +#else obfree(obj,otmp); /* free(obj), bill->otmp */ +#endif return(1); } return 0; @@ -250,18 +259,59 @@ #else flags.botl = 1; #endif +#ifdef AOY_CONTAINER + } else if (Is_container(obj)) { + oracle_knows &= ~obj->spe; + oracle_has &= ~obj->spe; + if (obj->spe & DV_AMULET) { + if (u.uhave.amulet) impossible("already have amulet?"); + u.uhave.amulet = 1; + } + if (obj->spe & DV_QUEST_ARTI) { + if (u.uhave.questart) impossible("already have quest artifact?"); + u.uhave.questart = 1; + } + if (obj->spe & DV_BELL) { + if (u.uhave.bell) impossible("already have silver bell?"); + u.uhave.bell = 1; + } + if (obj->spe & DV_BOOK) { + if (u.uhave.book) impossible("already have the book?"); + u.uhave.book = 1; + } + if (obj->spe & DV_CANDELABRA) { + if (u.uhave.menorah) impossible("already have candelabrum?"); + u.uhave.menorah = 1; + } +#endif } else if (obj->otyp == AMULET_OF_YENDOR) { if (u.uhave.amulet) impossible("already have amulet?"); u.uhave.amulet = 1; +#ifdef AOY_CONTAINER + oracle_knows &= ~DV_AMULET; + oracle_has &= ~DV_AMULET; +#endif } else if (obj->otyp == CANDELABRUM_OF_INVOCATION) { if (u.uhave.menorah) impossible("already have candelabrum?"); u.uhave.menorah = 1; +#ifdef AOY_CONTAINER + oracle_knows &= ~DV_CANDELABRA; + oracle_has &= ~DV_CANDELABRA; +#endif } else if (obj->otyp == BELL_OF_OPENING) { if (u.uhave.bell) impossible("already have silver bell?"); u.uhave.bell = 1; +#ifdef AOY_CONTAINER + oracle_knows &= ~DV_BELL; + oracle_has &= ~DV_BELL; +#endif } else if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { if (u.uhave.book) impossible("already have the book?"); u.uhave.book = 1; +#ifdef AOY_CONTAINER + oracle_knows &= ~DV_BOOK; + oracle_has &= ~DV_BOOK; +#endif } else if (obj->oartifact) { if (is_quest_artifact(obj)) { if (u.uhave.questart) @@ -445,7 +495,11 @@ { setnotworn(obj); freeinv(obj); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); /* deletes contents also */ +#else obfree(obj, (struct obj *)0); /* deletes contents also */ +#endif } void @@ -496,6 +550,30 @@ #endif flags.botl = 1; return; + +#ifdef AOY_CONTAINER + } else if (Is_container(obj)) { + if (obj->spe & DV_AMULET) { + if (!u.uhave.amulet) impossible("don't have amulet?"); + u.uhave.amulet = 0; + } + if (obj->spe & DV_QUEST_ARTI) { + if (!u.uhave.questart) impossible("don't have quest artifact?"); + u.uhave.questart = 0; + } + if (obj->spe & DV_BELL) { + if (!u.uhave.bell) impossible("don't have silver bell?"); + u.uhave.bell = 0; + } + if (obj->spe & DV_BOOK) { + if (!u.uhave.book) impossible("don't have the book?"); + u.uhave.book = 0; + } + if (obj->spe & DV_CANDELABRA) { + if (!u.uhave.menorah) impossible("don't have candelabrum?"); + u.uhave.menorah = 0; + } +#endif } else if (obj->otyp == AMULET_OF_YENDOR) { if (!u.uhave.amulet) impossible("don't have amulet?"); u.uhave.amulet = 0; @@ -578,7 +656,11 @@ update_map = (obj->where == OBJ_FLOOR); obj_extract_self(obj); if (update_map) newsym(obj->ox, obj->oy); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *) 0, FALSE); /* frees contents also */ +#else obfree(obj, (struct obj *) 0); /* frees contents also */ +#endif } #endif /* OVL2 */ diff -bruNX ignore.txt ..\official/src/lock.c ./src/lock.c --- ..\official/src/lock.c Mon Dec 8 01:39:14 2003 +++ ./src/lock.c Mon Jul 19 15:23:06 2004 @@ -185,7 +185,11 @@ loss += stolen_value(otmp, u.ux, u.uy, (boolean)shkp->mpeaceful, TRUE); if (otmp->quan == 1L) { +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *) 0, FALSE); +#else obfree(otmp, (struct obj *) 0); +#endif continue; } useup(otmp); diff -bruNX ignore.txt ..\official/src/makemon.c ./src/makemon.c --- ..\official/src/makemon.c Mon Jul 19 00:52:36 2004 +++ ./src/makemon.c Mon Jul 19 15:23:58 2004 @@ -623,7 +623,11 @@ case S_QUANTMECH: if (!rn2(20)) { otmp = mksobj(LARGE_BOX, FALSE, FALSE); +#ifdef AOY_CONTAINER + otmp->recharged = 1; /* flag for special box */ +#else otmp->spe = 1; /* flag for special box */ +#endif otmp->owt = weight(otmp); (void) mpickobj(mtmp, otmp); } @@ -1763,7 +1767,11 @@ otmp = mkobj( (char) s_sym, FALSE ); appear = otmp->otyp; /* make sure container contents are free'ed */ +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *) 0, FALSE); +#else obfree(otmp, (struct obj *) 0); +#endif } } } diff -bruNX ignore.txt ..\official/src/mklev.c ./src/mklev.c --- ..\official/src/mklev.c Mon Dec 8 01:39:14 2003 +++ ./src/mklev.c Mon Jul 19 15:24:56 2004 @@ -1497,7 +1497,11 @@ make_rocks = FALSE; /* don't bother with more rocks */ } else { obj_extract_self(otmp); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif } } unblock_point(x,y); /* make sure vision knows this location is open */ diff -bruNX ignore.txt ..\official/src/mkobj.c ./src/mkobj.c --- ..\official/src/mkobj.c Mon Dec 8 01:39:14 2003 +++ ./src/mkobj.c Mon Jul 19 15:25:44 2004 @@ -488,6 +488,10 @@ case SACK: case OILSKIN_SACK: case BAG_OF_HOLDING: mkbox_cnts(otmp); +#ifdef AOY_CONTAINER + otmp->spe=0; + otmp->recharged=0; +#endif break; #ifdef TOURIST case EXPENSIVE_CAMERA: @@ -802,8 +806,12 @@ register struct obj *obj; { int wt = objects[obj->otyp].oc_weight; +#ifdef AOY_CONTAINER + if (obj->otyp == LARGE_BOX && obj->recharged == 1) /* Schroedinger's Cat */ +#else if (obj->otyp == LARGE_BOX && obj->spe == 1) /* Schroedinger's Cat */ +#endif wt += mons[PM_HOUSECAT].cwt; if (Is_container(obj) || obj->otyp == STATUE) { struct obj *contents; @@ -1276,7 +1284,11 @@ while ((otmp = mtmp->minvent) != 0) { obj_extract_self(otmp); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); /* dealloc_obj() isn't sufficient */ +#else obfree(otmp, (struct obj *)0); /* dealloc_obj() isn't sufficient */ +#endif } } diff -bruNX ignore.txt ..\official/src/monmove.c ./src/monmove.c --- ..\official/src/monmove.c Mon Dec 8 01:39:14 2003 +++ ./src/monmove.c Mon Jul 19 14:12:36 2004 @@ -611,6 +611,10 @@ int omx = mtmp->mx, omy = mtmp->my; struct obj *mw_tmp; +#ifdef AOY_CONTAINER + struct obj *otmp, *otmp2 = (struct obj *) 0, *otmp3 = (struct obj *)0; +#endif + if(mtmp->mtrapped) { int i = mintrap(mtmp); if(i >= 2) { newsym(mtmp->mx,mtmp->my); return(2); }/* it died */ @@ -676,7 +680,36 @@ notonhead = (intruder->mx != tx || intruder->my != ty); if(mattackm(mtmp, intruder) == 2) return(2); mmoved = 1; + +#ifdef AOY_CONTAINER + } else { + for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) + if (Is_container(otmp) && otmp->spe) + if (!otmp2 || desire_value(otmp2) < desire_value(otmp)) + otmp2 = otmp; + + if (otmp2) { + for (otmp=otmp2->cobj ; otmp; otmp=otmp->nobj) + if (!otmp3 || desire_value(otmp3) < desire_value(otmp)) + otmp3 = otmp; + + obj_extract_self(otmp3); + otmp2->owt = weight(otmp2); + otmp2->spe &= ~desire_value(otmp3); + mpickobj(mtmp,otmp3); + if (!desire_value(otmp2)) { + obj_extract_self(otmp2); + obj_no_longer_held(otmp2); + place_object(otmp2, mtmp->mx, mtmp->my); + } + mmoved = 1; + } + mmoved = 0; + } +#else } else mmoved = 0; +#endif + goto postmov; } diff -bruNX ignore.txt ..\official/src/mthrowu.c ./src/mthrowu.c --- ..\official/src/mthrowu.c Mon Dec 8 01:39:14 2003 +++ ./src/mthrowu.c Mon Jul 19 15:27:16 2004 @@ -128,7 +128,11 @@ retvalu = 0; } } +#ifdef AOY_CONTAINER + } else obfree(obj, (struct obj*) 0, FALSE); +#else } else obfree(obj, (struct obj*) 0); +#endif return retvalu; } @@ -473,7 +477,11 @@ mon->misc_worn_check &= ~obj->owornmask; update_mon_intrinsics(mon, obj, FALSE, FALSE); } +#ifdef AOY_CONTAINER + obfree(obj, (struct obj*) 0, FALSE); +#else obfree(obj, (struct obj*) 0); +#endif } } diff -bruNX ignore.txt ..\official/src/objnam.c ./src/objnam.c --- ..\official/src/objnam.c Mon Dec 8 01:39:14 2003 +++ ./src/objnam.c Mon Jul 19 15:45:36 2004 @@ -2585,7 +2585,11 @@ break; case STATUE: otmp->corpsenm = mntmp; if (Has_contents(otmp) && verysmall(&mons[mntmp])) +#ifdef AOY_CONTAINER + delete_contents(otmp, FALSE); /* no spellbook */ +#else delete_contents(otmp); /* no spellbook */ +#endif otmp->spe = ishistoric ? STATUE_HISTORIC : 0; break; case SCALE_MAIL: @@ -2698,7 +2702,11 @@ #endif ) { artifact_exists(otmp, ONAME(otmp), FALSE); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *) 0, FALSE); +#else obfree(otmp, (struct obj *) 0); +#endif otmp = &zeroobj; pline("For a moment, you feel %s in your %s, but it disappears!", something, diff -bruNX ignore.txt ..\official/src/pickup.c ./src/pickup.c --- ..\official/src/pickup.c Mon Dec 8 01:39:14 2003 +++ ./src/pickup.c Mon Jul 19 15:46:14 2004 @@ -1790,6 +1790,8 @@ obj->bknown = 1; pline_The("stone%s won't leave your person.", plur(obj->quan)); return 0; + +#ifndef AOY_CONTAINER } else if (obj->otyp == AMULET_OF_YENDOR || obj->otyp == CANDELABRUM_OF_INVOCATION || obj->otyp == BELL_OF_OPENING || @@ -1800,6 +1802,8 @@ */ pline("%s cannot be confined in such trappings.", The(xname(obj))); return 0; +#endif + } else if (obj->otyp == LEASH && obj->leashmon != 0) { pline("%s attached to your pet.", Tobjnam(obj, "are")); return 0; @@ -1883,8 +1887,13 @@ doname(obj)); /* did not actually insert obj yet */ if (was_unpaid) addtobill(obj, FALSE, FALSE, TRUE); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); + delete_contents(current_container, TRUE); +#else obfree(obj, (struct obj *)0); delete_contents(current_container); +#endif if (!floor_container) useup(current_container); else if (obj_here(current_container, u.ux, u.uy)) @@ -1900,6 +1909,27 @@ Strcpy(buf, the(xname(current_container))); You("put %s into %s.", doname(obj), buf); +#ifdef AOY_CONTAINER + current_container->spe |= desire_value(obj); + if(!floor_container) + if (obj->otyp == AMULET_OF_YENDOR) { + if (u.uhave.amulet) impossible("already have amulet?"); + u.uhave.amulet = 1; + } else if (is_quest_artifact(obj)) { + if (u.uhave.questart) impossible("already have quest artifact?"); + u.uhave.questart = 1; + } else if (obj->otyp == BELL_OF_OPENING) { + if (u.uhave.bell) impossible("already have silver bell?"); + u.uhave.bell = 1; + } else if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { + if (u.uhave.book) impossible("already have the book?"); + u.uhave.book = 1; + } else if (obj->otyp == CANDELABRUM_OF_INVOCATION) { + if (u.uhave.menorah) impossible("already have candelabrum?"); + u.uhave.menorah = 1; + } +#endif + /* gold in container always needs to be added to credit */ if (floor_container && obj->oclass == COIN_CLASS) sellobj(obj, current_container->ox, current_container->oy); @@ -1968,6 +1998,27 @@ obj_extract_self(obj); current_container->owt = weight(current_container); +#ifdef AOY_CONTAINER + current_container->spe &= ~desire_value(obj); + if (carried(current_container)) + if (obj->otyp == AMULET_OF_YENDOR) { + if (!u.uhave.amulet) impossible("don't have amulet?"); + u.uhave.amulet = 0; + } else if (obj->otyp == CANDELABRUM_OF_INVOCATION) { + if (!u.uhave.menorah) impossible("don't have candelabrum?"); + u.uhave.menorah = 0; + } else if (obj->otyp == BELL_OF_OPENING) { + if (!u.uhave.bell) impossible("don't have silver bell?"); + u.uhave.bell = 0; + } else if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { + if (!u.uhave.book) impossible("don't have the book?"); + u.uhave.book = 0; + } else if (is_quest_artifact(obj)) { + if (!u.uhave.questart) impossible("don't have quest artifact?"); + u.uhave.questart = 0; + } +#endif + if (Icebox && !age_is_relative(obj)) { obj->age = monstermoves - obj->age; /* actual age */ if (obj->otyp == CORPSE) @@ -2020,7 +2071,11 @@ loss = stolen_value(item, u.ux, u.uy, (boolean)shkp->mpeaceful, TRUE); } +#ifdef AOY_CONTAINER + obfree(item, (struct obj *) 0, TRUE); +#else obfree(item, (struct obj *) 0); +#endif return loss; } @@ -2033,7 +2088,11 @@ struct monst *livecat; xchar ox, oy; +#ifdef AOY_CONTAINER + box->recharged = 0; /* box->owt will be updated below */ +#else box->spe = 0; /* box->owt will be updated below */ +#endif if (get_obj_location(box, &ox, &oy, 0)) box->ox = ox, box->oy = oy; /* in case it's being carried */ @@ -2108,7 +2167,11 @@ } current_container = obj; /* for use by in/out_container */ +#ifdef AOY_CONTAINER + if (obj->recharged == 1) { +#else if (obj->spe == 1) { +#endif observe_quantum_cat(obj); used = 1; quantum_cat = TRUE; /* for adjusting "it's empty" message */ diff -bruNX ignore.txt ..\official/src/potion.c ./src/potion.c --- ..\official/src/potion.c Mon Dec 8 01:39:14 2003 +++ ./src/potion.c Mon Jul 19 15:34:02 2004 @@ -1174,7 +1174,11 @@ subfrombill(obj, shkp); } } +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); +#else obfree(obj, (struct obj *)0); +#endif } /* vapors are inhaled or get in your eyes */ @@ -1696,7 +1700,11 @@ struct obj *otmp; otmp = mkobj(POTION_CLASS,FALSE); obj->otyp = otmp->otyp; +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif } break; default: @@ -1784,7 +1792,11 @@ yname(obj)); if (obj->oeroded == MAX_ERODE) { obj_extract_self(obj); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); +#else obfree(obj, (struct obj *)0); +#endif obj = (struct obj *) 0; } else { /* we know it's carried */ diff -bruNX ignore.txt ..\official/src/pray.c ./src/pray.c --- ..\official/src/pray.c Mon Dec 8 01:39:14 2003 +++ ./src/pray.c Mon Jul 19 13:15:18 2004 @@ -10,12 +10,14 @@ STATIC_DCL int NDECL(in_trouble); STATIC_DCL void FDECL(fix_worst_trouble,(int)); STATIC_DCL void FDECL(angrygods,(ALIGNTYP_P)); -STATIC_DCL void FDECL(at_your_feet, (const char *)); #ifdef ELBERETH STATIC_DCL void NDECL(gcrownu); #endif /*ELBERETH*/ STATIC_DCL void FDECL(pleased,(ALIGNTYP_P)); +#ifndef AOY_CONTAINER +STATIC_DCL void FDECL(at_your_feet, (const char *)); STATIC_DCL void FDECL(godvoice,(ALIGNTYP_P,const char*)); +#endif STATIC_DCL void FDECL(god_zaps_you,(ALIGNTYP_P)); STATIC_DCL void FDECL(fry_by_god,(ALIGNTYP_P)); STATIC_DCL void FDECL(gods_angry,(ALIGNTYP_P)); @@ -616,7 +618,11 @@ } /* helper to print "str appears at your feet", or appropriate */ -static void +#ifdef AOY_CONTAINER +void +#else +STATIC_OVL void +#endif at_your_feet(str) const char *str; { @@ -1057,7 +1063,11 @@ return((boolean)(changed > 0L)); } +#ifdef AOY_CONTAINER +void +#else STATIC_OVL void +#endif godvoice(g_align, words) aligntyp g_align; const char *words; diff -bruNX ignore.txt ..\official/src/rumors.c ./src/rumors.c --- ..\official/src/rumors.c Mon Dec 8 01:39:14 2003 +++ ./src/rumors.c Mon Jul 19 14:01:34 2004 @@ -28,6 +28,11 @@ * and placed there by 'makedefs'. */ +#ifdef AOY_CONTAINER +extern int oracle_knows = 0; +extern int oracle_has = 0; +#endif + STATIC_DCL void FDECL(init_rumors, (dlb *)); STATIC_DCL void FDECL(init_oracles, (dlb *)); @@ -287,6 +292,12 @@ doconsult(oracl) register struct monst *oracl; { + +#ifdef AOY_CONTAINER + struct obj *otmp, *otmp2; + int given = 0; +#endif + #ifdef GOLDOBJ long umoney = money_cnt(invent); #endif @@ -358,7 +369,40 @@ flags.botl = 1; add_xpts = 0; /* first oracle of each type gives experience points */ if (u_pay == minor_cost) { +#ifdef AOY_CONTAINER + if (oracle_has) { + pline("It seems that you have misplaced certain objects!"); + for (otmp = oracl->minvent; otmp; otmp = otmp2) { + otmp2 = otmp->nobj; + if (otmp->otyp == BELL_OF_OPENING || otmp->otyp == SPE_BOOK_OF_THE_DEAD || + otmp->otyp == CANDELABRUM_OF_INVOCATION) { + obj_extract_self(otmp); + possibly_unwield(oracl, FALSE); + if (otmp->owornmask) { + oracl->misc_worn_check &= ~otmp->owornmask; + update_mon_intrinsics(oracl, otmp, FALSE, FALSE); + } + dropy(otmp); + given++; + oracle_has &= ~desire_value(otmp); + } + } + if (!given) pline("But I don't know where they are. Have you checked my adobe?"); + else { + pline("Take better care for these items!"); + if (given == 1) at_your_feet("Missed object"); + else at_your_feet("Missed objects"); + if (oracle_has) pline("There should have been more. Have you checked my adobe?"); + } + oracle_has = 0; + } else if (oracle_knows) { + pline("It seems that you have misplaced certain objects!"); + pline("They tend to go where they used to be!"); + oracle_knows = 0; + } else +#endif outrumor(1, BY_ORACLE); + if (!u.uevent.minor_oracle) add_xpts = u_pay / (u.uevent.major_oracle ? 25 : 10); /* 5 pts if very 1st, or 2 pts if major already done */ diff -bruNX ignore.txt ..\official/src/shk.c ./src/shk.c --- ..\official/src/shk.c Mon Dec 8 01:39:14 2003 +++ ./src/shk.c Mon Jul 19 15:35:04 2004 @@ -26,6 +26,11 @@ extern const struct shclass shtypes[]; /* defined in shknam.c */ extern struct obj *thrownobj; /* defined in dothrow.c */ +#ifdef AOY_CONTAINER +extern int oracle_knows; +extern int oracle_has; +#endif + STATIC_VAR NEARDATA long int followmsg; /* last time of follow message */ STATIC_DCL void FDECL(setpaid, (struct monst *)); @@ -765,21 +770,106 @@ /* Delete the contents of the given object. */ void +#ifdef AOY_CONTAINER + +delete_contents(obj, is_boh) +register struct obj *obj; +register boolean is_boh; +{ + s_level *slev; + boolean on_oracle, on_nemesis, on_wiz1, on_tower; + +#else + delete_contents(obj) register struct obj *obj; { + +#endif + register struct obj *curr; while ((curr = obj->cobj) != 0) { obj_extract_self(curr); + +#ifndef AOY_CONTAINER obfree(curr, (struct obj *)0); +#else + if (curr->otyp == AMULET_OF_YENDOR || curr->otyp == CANDELABRUM_OF_INVOCATION || + curr->otyp == SPE_BOOK_OF_THE_DEAD || curr->otyp == BELL_OF_OPENING) + if (is_boh) + if (curr->otyp == AMULET_OF_YENDOR) { + if (u.uz.dnum == sanctum_level.dnum && u.uz.dlevel == sanctum_level.dlevel) + place_object(curr, obj->ox, obj->oy); + else { + add_to_migration(curr); + curr->ox = sanctum_level.dnum; + curr->oy = sanctum_level.dlevel; + curr->owornmask = MIGR_RANDOM; + oracle_knows |= DV_AMULET; + } + } else { + for (slev = sp_levchn; slev; slev = slev->next) + if (slev->dlevel.dnum != tower_dnum) continue; + + on_oracle = (u.uz.dnum == oracle_level.dnum && u.uz.dlevel == oracle_level.dlevel); + on_nemesis = (u.uz.dnum == nemesis_level.dnum && u.uz.dlevel == nemesis_level.dlevel); + on_wiz1 = (u.uz.dnum == wiz1_level.dnum && u.uz.dlevel == wiz1_level.dlevel); + on_tower = (u.uz.dnum == tower_dnum && u.uz.dlevel == depth(&slev->dlevel)); + if ((rn2(2) && !on_oracle) || + (curr->otyp == BELL_OF_OPENING && on_nemesis) || + (curr->otyp == SPE_BOOK_OF_THE_DEAD && on_wiz1) || + (curr->otyp == CANDELABRUM_OF_INVOCATION && on_tower)){ + add_to_migration(curr); + curr->ox = oracle_level.dnum; + curr->oy = oracle_level.dlevel; + curr->owornmask = MIGR_ORACLE; + oracle_has |= desire_value(curr); + } else if (curr->otyp == BELL_OF_OPENING) { + add_to_migration(curr); + curr->ox = nemesis_level.dnum; + curr->oy = nemesis_level.dlevel; + curr->owornmask = MIGR_RANDOM; + oracle_knows |= DV_BELL; + } else if (curr->otyp == SPE_BOOK_OF_THE_DEAD) { + add_to_migration(curr); + curr->ox = wiz1_level.dnum; + curr->oy = wiz1_level.dlevel; + curr->owornmask = MIGR_RANDOM; + oracle_knows |= DV_BOOK; + } else if (curr->otyp == CANDELABRUM_OF_INVOCATION) { + add_to_migration(curr); + curr->ox = tower_dnum; + curr->oy = depth(&slev->dlevel); + curr->owornmask = MIGR_RANDOM; + oracle_knows |= DV_CANDELABRA; + } + } + else place_object(curr, obj->ox, obj->oy); + else { + curr->ox = obj->ox; + curr->oy = obj->oy; + obfree(curr, (struct obj *) 0, is_boh); + } +#endif } } /* called with two args on merge */ void +#ifdef AOY_CONTAINER + +obfree(obj, merge, from_boh) +register struct obj *obj, *merge; +register boolean from_boh; + +#else + obfree(obj, merge) register struct obj *obj, *merge; + +#endif + { register struct bill_x *bp; register struct bill_x *bpm; @@ -788,7 +878,12 @@ if (obj->otyp == LEASH && obj->leashmon) o_unleash(obj); if (obj->oclass == FOOD_CLASS) food_disappears(obj); if (obj->oclass == SPBOOK_CLASS) book_disappears(obj); + +#ifdef AOY_CONTAINER + if (Has_contents(obj)) delete_contents(obj, from_boh || Is_mbag(obj)); +#else if (Has_contents(obj)) delete_contents(obj); +#endif shkp = 0; if (obj->unpaid) { @@ -3149,7 +3244,11 @@ /* Don't mess w/ boulders -- just merge into wall */ if ((otmp->otyp == BOULDER) || (otmp->otyp == ROCK)) { obj_extract_self(otmp); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif } else { while (!(litter[i = rn2(9)] & INSHOP)); remove_object(otmp); diff -bruNX ignore.txt ..\official/src/sp_lev.c ./src/sp_lev.c --- ..\official/src/sp_lev.c Mon Dec 8 01:39:14 2003 +++ ./src/sp_lev.c Mon Jul 19 15:47:24 2004 @@ -992,7 +992,11 @@ goto o_done; /* don't stack, but do other cleanup */ /* container */ case 2: +#ifdef AOY_CONTAINER + delete_contents(otmp, FALSE); +#else delete_contents(otmp); +#endif container = otmp; break; /* nothing */ diff -bruNX ignore.txt ..\official/src/spell.c ./src/spell.c --- ..\official/src/spell.c Mon Dec 8 01:39:14 2003 +++ ./src/spell.c Mon Jul 19 15:35:52 2004 @@ -952,14 +952,22 @@ break; default: impossible("Unknown spell %d attempted.", spell); +#ifdef AOY_CONTAINER + obfree(pseudo, (struct obj *)0, FALSE); +#else obfree(pseudo, (struct obj *)0); +#endif return(0); } /* gain skill for successful cast */ use_skill(skill, spellev(spell)); +#ifdef AOY_CONTAINER + obfree(pseudo, (struct obj *)0, FALSE); /* now, get rid of it */ +#else obfree(pseudo, (struct obj *)0); /* now, get rid of it */ +#endif return(1); } diff -bruNX ignore.txt ..\official/src/steal.c ./src/steal.c --- ..\official/src/steal.c Mon Dec 8 01:39:14 2003 +++ ./src/steal.c Mon Jul 19 15:36:26 2004 @@ -439,7 +439,11 @@ #ifndef GOLDOBJ if (otmp->oclass == COIN_CLASS) { mtmp->mgold += otmp->quan; +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif freed_otmp = 1; } else { #endif @@ -478,6 +482,10 @@ struct obj *otmp = (struct obj *)0; int real=0, fake=0; +#ifdef AOY_CONTAINER + struct obj *otmp2 = (struct obj *)0; +#endif + /* select the artifact to steal */ if(u.uhave.amulet) { real = AMULET_OF_YENDOR; @@ -500,8 +508,21 @@ for(otmp = invent; otmp; otmp = otmp->nobj) if(otmp->otyp == real || (otmp->otyp == fake && !mtmp->iswiz)) break; + +#ifdef AOY_CONTAINER + else + if(Is_container(otmp) && otmp->spe) + if(!otmp2 || desire_value(otmp2) < desire_value(otmp)) + otmp2 = otmp; +#endif + } +#ifdef AOY_CONTAINER + if (otmp2) + otmp = otmp2; +#endif + if (otmp) { /* we have something to snatch */ if (otmp->owornmask) remove_worn_item(otmp, TRUE); @@ -629,6 +650,20 @@ if (show & cansee(omx, omy)) newsym(omx, omy); } + +#ifdef AOY_CONTAINER +int desire_value(otmp) +struct obj *otmp; +{ + if (otmp->otyp == AMULET_OF_YENDOR) return DV_AMULET; + if (is_quest_artifact(otmp)) return DV_QUEST_ARTI; + if (otmp->otyp == BELL_OF_OPENING) return DV_BELL; + if (otmp->otyp == SPE_BOOK_OF_THE_DEAD) return DV_BOOK; + if (otmp->otyp == CANDELABRUM_OF_INVOCATION) return DV_CANDELABRA; + if (Is_container(otmp)) return otmp->spe; + return 0; +} +#endif #endif /* OVL0 */ diff -bruNX ignore.txt ..\official/src/timeout.c ./src/timeout.c --- ..\official/src/timeout.c Mon Dec 8 01:39:14 2003 +++ ./src/timeout.c Mon Jul 19 15:38:10 2004 @@ -575,7 +575,11 @@ } else { /* free egg here because we use it above */ obj_extract_self(egg); +#ifdef AOY_CONTAINER + obfree(egg, (struct obj *)0, FALSE); +#else obfree(egg, (struct obj *)0); +#endif } if (redraw) newsym(x, y); } @@ -766,7 +770,11 @@ } else if (Is_candle(obj) || obj->otyp == POT_OIL) { /* get rid of candles and burning oil potions */ obj_extract_self(obj); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); +#else obfree(obj, (struct obj *)0); +#endif obj = (struct obj *) 0; } @@ -806,7 +814,11 @@ } end_burn(obj, FALSE); /* turn off light source */ obj_extract_self(obj); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); +#else obfree(obj, (struct obj *)0); +#endif obj = (struct obj *) 0; break; @@ -982,7 +994,11 @@ obj->spe = 0; } else { obj_extract_self(obj); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *)0, FALSE); +#else obfree(obj, (struct obj *)0); +#endif obj = (struct obj *) 0; } break; diff -bruNX ignore.txt ..\official/src/trap.c ./src/trap.c --- ..\official/src/trap.c Mon Dec 8 01:39:14 2003 +++ ./src/trap.c Mon Jul 19 15:48:08 2004 @@ -652,7 +652,11 @@ else #endif if (thitu(8, dmgval(otmp, &youmonst), otmp, "arrow")) { +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif } else { place_object(otmp, u.ux, u.uy); if (!Blind) otmp->dknown = 1; @@ -681,7 +685,11 @@ if (thitu(7, dmgval(otmp, &youmonst), otmp, "little dart")) { if (otmp->opoisoned) poisoned("dart", A_CON, "little dart", -10); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif } else { place_object(otmp, u.ux, u.uy); if (!Blind) otmp->dknown = 1; @@ -3659,7 +3667,11 @@ if(costly) loss += stolen_value(obj, ox, oy, (boolean)shkp->mpeaceful, TRUE); +#ifdef AOY_CONTAINER + delete_contents(obj,FALSE); +#else delete_contents(obj); +#endif /* we're about to delete all things at this location, * which could include the ball & chain. * If we attempt to call unpunish() in the diff -bruNX ignore.txt ..\official/src/uhitm.c ./src/uhitm.c --- ..\official/src/uhitm.c Mon Dec 8 01:39:14 2003 +++ ./src/uhitm.c Mon Jul 19 15:41:12 2004 @@ -743,9 +743,15 @@ break; case EGG: { +#ifdef AOY_CONTAINER +#define useup_eggs(o) { if (thrown) obfree(o,(struct obj *)0, FALSE); \ + else useupall(o); \ + o = (struct obj *)0; } /* now gone */ +#else #define useup_eggs(o) { if (thrown) obfree(o,(struct obj *)0); \ else useupall(o); \ o = (struct obj *)0; } /* now gone */ +#endif long cnt = obj->quan; tmp = 1; /* nominal physical damage */ @@ -843,7 +849,11 @@ pline(obj->otyp==CREAM_PIE ? "Splat!" : "Splash!"); setmangry(mon); } +#ifdef AOY_CONTAINER + if (thrown) obfree(obj, (struct obj *)0, FALSE); +#else if (thrown) obfree(obj, (struct obj *)0); +#endif else useup(obj); hittxt = TRUE; get_dmg_bonus = FALSE; @@ -858,7 +868,11 @@ Your("venom burns %s!", mon_nam(mon)); tmp = dmgval(obj, mon); } +#ifdef AOY_CONTAINER + if (thrown) obfree(obj, (struct obj *)0, FALSE); +#else if (thrown) obfree(obj, (struct obj *)0); +#endif else useup(obj); hittxt = TRUE; get_dmg_bonus = FALSE; diff -bruNX ignore.txt ..\official/src/wizard.c ./src/wizard.c --- ..\official/src/wizard.c Mon Dec 8 01:39:14 2003 +++ ./src/wizard.c Mon Jul 19 14:32:48 2004 @@ -23,6 +23,10 @@ STATIC_DCL long FDECL(target_on, (int,struct monst *)); STATIC_DCL long FDECL(strategy, (struct monst *)); +#ifdef AOY_CONTAINER +STATIC_DCL int FDECL(desire_value_by_type, (SHORT_P)); +#endif + static NEARDATA const int nasties[] = { PM_COCKATRICE, PM_ETTIN, PM_STALKER, PM_MINOTAUR, PM_RED_DRAGON, PM_BLACK_DRAGON, PM_GREEN_DRAGON, PM_OWLBEAR, PM_PURPLE_WORM, @@ -102,7 +106,13 @@ register struct obj *otmp; for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj) - if(otmp->otyp == AMULET_OF_YENDOR) return(1); + if(otmp->otyp == AMULET_OF_YENDOR + +#ifdef AOY_CONTAINER + || (Is_container(otmp) && (otmp->spe & DV_AMULET)) +#endif + + ) return(1); return(0); } @@ -114,6 +124,11 @@ for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj) if(otmp->otyp == AMULET_OF_YENDOR || + +#ifdef AOY_CONTAINER + (Is_container(otmp) && otmp->spe) || +#endif + is_quest_artifact(otmp) || otmp->otyp == BELL_OF_OPENING || otmp->otyp == CANDELABRUM_OF_INVOCATION || @@ -160,6 +175,13 @@ for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj) { if(otyp) { + +#ifdef AOY_CONTAINER + if(Is_container(otmp)) + if(otmp->spe >= desire_value_by_type(otyp)) + return(1); +#endif + if(otmp->otyp == otyp) return(1); } @@ -190,14 +212,37 @@ { register struct obj *otmp; - for (otmp = fobj; otmp; otmp = otmp->nobj) + for (otmp = fobj; otmp; otmp = otmp->nobj) { + +#ifdef AOY_CONTAINER + if(Is_container(otmp)) + if(otmp->spe >= desire_value_by_type(otyp)) + return(otmp); +#endif + if (otyp) { if (otmp->otyp == otyp) return(otmp); } else if (is_quest_artifact(otmp)) return(otmp); + } return((struct obj *)0); } + +#ifdef AOY_CONTAINER +STATIC_OVL int +desire_value_by_type(otyp) + register short otyp; +{ + if(otyp) { + if (otyp == AMULET_OF_YENDOR) return DV_AMULET; + if (otyp == BELL_OF_OPENING) return DV_BELL; + if (otyp == SPE_BOOK_OF_THE_DEAD) return DV_BOOK; + if (otyp == CANDELABRUM_OF_INVOCATION) return DV_CANDELABRA; + } + return DV_QUEST_ARTI; +} +#endif STATIC_OVL boolean you_have(mask) diff -bruNX ignore.txt ..\official/src/write.c ./src/write.c --- ..\official/src/write.c Mon Dec 8 01:39:14 2003 +++ ./src/write.c Mon Jul 19 15:42:30 2004 @@ -168,7 +168,11 @@ basecost = cost(new_obj); if(pen->spe < basecost/2) { Your("marker is too dry to write that!"); +#ifdef AOY_CONTAINER + obfree(new_obj, (struct obj *) 0, FALSE); +#else obfree(new_obj, (struct obj *) 0); +#endif return(1); } @@ -190,7 +194,11 @@ pline_The("scroll is now useless and disappears!"); useup(paper); } +#ifdef AOY_CONTAINER + obfree(new_obj, (struct obj *) 0, FALSE); +#else obfree(new_obj, (struct obj *) 0); +#endif return(1); } pen->spe -= actualcost; @@ -214,7 +222,11 @@ You("write \"%s\" and the scroll disappears.", namebuf); useup(paper); } +#ifdef AOY_CONTAINER + obfree(new_obj, (struct obj *) 0, FALSE); +#else obfree(new_obj, (struct obj *) 0); +#endif return(1); } diff -bruNX ignore.txt ..\official/src/zap.c ./src/zap.c --- ..\official/src/zap.c Mon Dec 8 01:39:14 2003 +++ ./src/zap.c Mon Jul 19 16:13:10 2004 @@ -710,7 +710,11 @@ break; case OBJ_CONTAINED: obj_extract_self(obj); +#ifdef AOY_CONTAINER + obfree(obj, (struct obj *) 0, FALSE); +#else obfree(obj, (struct obj *) 0); +#endif break; default: panic("revive"); @@ -1275,6 +1279,9 @@ /* keep special fields (including charges on wands) */ if (index(charged_objs, otmp->oclass)) otmp->spe = obj->spe; +#ifdef AOY_CONTAINER + if (!Is_container(obj) && !Is_container(otmp)) /* recharged field is used for the quantumn mechanics special box */ +#endif otmp->recharged = obj->recharged; otmp->cursed = obj->cursed; @@ -1306,7 +1313,11 @@ } /* no box contents --KAA */ +#ifdef AOY_CONTAINER + if (Has_contents(otmp)) delete_contents(otmp, Is_mbag(otmp)); +#else if (Has_contents(otmp)) delete_contents(otmp); +#endif /* 'n' merged objects may be fused into 1 object */ if (otmp->quan > 1L && (!objects[otmp->otyp].oc_merge || @@ -1361,6 +1372,12 @@ /* for now, take off worn items being polymorphed */ if (obj_location == OBJ_INVENT) { + +#ifdef AOY_CONTAINER + obj->ox = u.ux; /* place to drop box content if not destroyed */ + obj->oy = u.uy; +#endif + if (id == STRANGE_OBJECT) remove_worn_item(obj, TRUE); else { @@ -3402,7 +3419,11 @@ otmp2 = otmp->nobj; if (!oresist_disintegration(otmp)) { obj_extract_self(otmp); +#ifdef AOY_CONTAINER + obfree(otmp, (struct obj *)0, FALSE); +#else obfree(otmp, (struct obj *)0); +#endif } }