diff --git a/include/dungeon.h b/include/dungeon.h index ed38f6e88..e7d12d706 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -141,9 +141,9 @@ typedef struct branch { #define MIGR_LADDER_DOWN 6 #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_WITH_HERO 9 /* mon: followers; obj: trap door */ #define MIGR_NOBREAK 1024 /* bitmask: don't break on delivery */ +#define MIGR_NOSCATTER 2048 /* don't scatter on delivery */ /* level information (saved via ledger number) */ diff --git a/src/dog.c b/src/dog.c index bdcd0be92..5fd97fb93 100644 --- a/src/dog.c +++ b/src/dog.c @@ -317,7 +317,7 @@ boolean with_you; break; case MIGR_EXACT_XY: wander = 0; break; - case MIGR_NEAR_PLAYER: xlocale = u.ux, ylocale = u.uy; + case MIGR_WITH_HERO: xlocale = u.ux, ylocale = u.uy; break; case MIGR_STAIRS_UP: xlocale = xupstair, ylocale = yupstair; break; diff --git a/src/dokick.c b/src/dokick.c index 6f8d0c390..7eb94a680 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1207,7 +1207,7 @@ xchar dlev; /* if !0 send to dlev near player */ /* send objects next to player falling through trap door. * checked in obj_delivery(). */ - toloc = MIGR_NEAR_PLAYER; + toloc = MIGR_WITH_HERO; cc.y = dlev; } @@ -1429,32 +1429,31 @@ boolean near_hero; { register struct obj *otmp, *otmp2; register int nx, ny; - long where; - boolean nobreak, noscatter = FALSE; + int where; + boolean nobreak, noscatter; for (otmp = migrating_objs; otmp; otmp = otmp2) { otmp2 = otmp->nobj; if (otmp->ox != u.uz.dnum || otmp->oy != u.uz.dlevel) continue; - where = otmp->owornmask; /* destination code */ + where = (int)(otmp->owornmask & 0x7fffL); /* destination code */ nobreak = (where & MIGR_NOBREAK) != 0; - where &= ~MIGR_NOBREAK; + noscatter = (where & MIGR_WITH_HERO) != 0; + where &= ~(MIGR_NOBREAK | MIGR_NOSCATTER); - if ((!near_hero && where == MIGR_NEAR_PLAYER) || - (near_hero && where != MIGR_NEAR_PLAYER)) continue; + if (!near_hero ^ (where == MIGR_WITH_HERO)) continue; obj_extract_self(otmp); otmp->owornmask = 0L; - switch ((int)where) { + switch (where) { case MIGR_STAIRS_UP: nx = xupstair, ny = yupstair; break; case MIGR_LADDER_UP: nx = xupladder, ny = yupladder; 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; + case MIGR_WITH_HERO: nx = u.ux, ny = u.uy; break; default: case MIGR_RANDOM: nx = ny = 0; @@ -1463,7 +1462,7 @@ boolean near_hero; if (nx > 0) { place_object(otmp, nx, ny); if (!nobreak && !IS_SOFT(levl[nx][ny].typ)) { - if (where == MIGR_NEAR_PLAYER) { + if (where == MIGR_WITH_HERO) { if (breaks(otmp, nx, ny)) continue; } else if (breaktest(otmp)) { /* assume it broke before player arrived, no messages */ diff --git a/src/files.c b/src/files.c index 9f4b89c88..3b4ac6acb 100644 --- a/src/files.c +++ b/src/files.c @@ -2428,7 +2428,7 @@ struct obj *obj; 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); + obj->owornmask = (long)(MIGR_WITH_HERO | MIGR_NOBREAK|MIGR_NOSCATTER); } else { (void)addinv(obj); }