diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 671f97c9c..b9ee5e937 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -250,6 +250,7 @@ sometimes when hero is forced to buy an unpaid shop item its price changed monster could attack with a polearm even after attempt to wield that failed sometimes got "you trip over it" after intervening messages following the one which described "it" +wizard mode: WIZKIT wishes could overflow inventory's 52 slots Platform- and/or Interface-Specific Fixes diff --git a/include/dungeon.h b/include/dungeon.h index 3b1b04fc9..ed38f6e88 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)dungeon.h 3.5 1999/07/02 */ +/* SCCS Id: @(#)dungeon.h 3.5 2007/06/15 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -142,6 +142,7 @@ typedef struct branch { #define MIGR_SSTAIRS 7 /* dungeon branch */ #define MIGR_PORTAL 8 /* magic portal */ #define MIGR_NEAR_PLAYER 9 /* mon: followers; obj: trap door */ +#define MIGR_AT_HERO 10 /* wizkit overflow */ #define MIGR_NOBREAK 1024 /* bitmask: don't break on delivery */ /* level information (saved via ledger number) */ diff --git a/src/allmain.c b/src/allmain.c index 70b975413..6e5f068fa 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -524,14 +524,12 @@ newgame() mklev(); u_on_upstairs(); +#ifdef WIZARD + if (wizard) obj_delivery(FALSE); /* finish wizkit */ +#endif vision_reset(); /* set up internals for level (after mklev) */ check_special_room(FALSE); - - /* Move the monster from under you or else - * makedog() will fail when it calls makemon(). - * - ucsfcgl!kneller - */ if(MON_AT(u.ux, u.uy)) mnexto(m_at(u.ux, u.uy)); (void) makedog(); docrt(); diff --git a/src/dokick.c b/src/dokick.c index 4bc983443..6f8d0c390 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1430,7 +1430,7 @@ boolean near_hero; register struct obj *otmp, *otmp2; register int nx, ny; long where; - boolean nobreak; + boolean nobreak, noscatter = FALSE; for (otmp = migrating_objs; otmp; otmp = otmp2) { otmp2 = otmp->nobj; @@ -1453,6 +1453,7 @@ boolean near_hero; break; case MIGR_SSTAIRS: nx = sstairs.sx, ny = sstairs.sy; break; + case MIGR_AT_HERO: noscatter = TRUE; /*FALLTHRU*/ case MIGR_NEAR_PLAYER: nx = u.ux, ny = u.uy; break; default: @@ -1471,7 +1472,7 @@ boolean near_hero; } } stackobj(otmp); - (void)scatter(nx, ny, rnd(2), 0, otmp); + if (!noscatter) (void)scatter(nx, ny, rnd(2), 0, otmp); } else { /* random location */ /* set dummy coordinates because there's no current position for rloco() to update */ diff --git a/src/files.c b/src/files.c index 5056b708a..9f4b89c88 100644 --- a/src/files.c +++ b/src/files.c @@ -127,6 +127,7 @@ boolean nethack_thinks_it_is_open; /* Does NetHack think it's open? */ #define WIZKIT_MAX 128 static char wizkit[WIZKIT_MAX]; STATIC_DCL FILE *NDECL(fopen_wizkit_file); +STATIC_DCL void FDECL(wizkit_addinv, (struct obj *)); #endif #ifdef AMIGA @@ -2409,6 +2410,30 @@ fopen_wizkit_file() return (FILE *)0; } +/* add to hero's inventory if there's room, otherwise put item on floor */ +STATIC_DCL void +wizkit_addinv(obj) +struct obj *obj; +{ + if (!obj || obj == &zeroobj) return; + + /* subset of starting inventory pre-ID */ + obj->dknown = 1; + if (Role_if(PM_PRIEST)) obj->bknown = 1; + /* same criteria as lift_object()'s check for available inventory slot */ + if (obj->oclass != COIN_CLASS && + inv_cnt(FALSE) >= 52 && !merge_choice(invent, obj)) { + /* inventory overflow; can't just place & stack object since + hero isn't in position yet, so schedule for arrival later */ + add_to_migration(obj); + obj->ox = 0; /* index of main dungeon */ + obj->oy = 1; /* starting level number */ + obj->owornmask = (long)(MIGR_AT_HERO|MIGR_NOBREAK); + } else { + (void)addinv(obj); + } +} + void read_wizkit() { @@ -2432,7 +2457,7 @@ read_wizkit() otmp = readobjnam(buf, (struct obj *)0); if (otmp) { if (otmp != &zeroobj) - otmp = addinv(otmp); + wizkit_addinv(otmp); } else { /* .60 limits output line width to 79 chars */ raw_printf("Bad wizkit item: \"%.60s\"", buf);