diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 01e68472e..c469edf68 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -290,6 +290,7 @@ can't engrave on floor while inside solid rock, wall, or closed door remove engravings at drawbridge location when it is opened, closed, or wrecked monster killed in midst of multi-shot volley throwing/shooting might cause freed memory to be accessed, potentially triggering a crash +can't arm bear traps or land mines on Planes of Air or Water Platform- and/or Interface-Specific Fixes diff --git a/src/apply.c b/src/apply.c index 7483aa46c..16ac4ae82 100644 --- a/src/apply.c +++ b/src/apply.c @@ -2112,6 +2112,7 @@ struct obj *otmp; int ttyp, tmp; const char *what = (char *)0; char buf[BUFSZ]; + int levtyp = levl[u.ux][u.uy].typ; const char *occutext = "setting the trap"; if (nohands(youmonst.data)) @@ -2132,10 +2133,13 @@ struct obj *otmp; else if (On_stairs(u.ux, u.uy)) what = (u.ux == xdnladder || u.ux == xupladder) ? "on the ladder" : "on the stairs"; - else if (IS_FURNITURE(levl[u.ux][u.uy].typ) || - IS_ROCK(levl[u.ux][u.uy].typ) || + else if (IS_FURNITURE(levtyp) || IS_ROCK(levtyp) || closed_door(u.ux, u.uy) || t_at(u.ux, u.uy)) what = "here"; + else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) + what = (levtyp == AIR) ? "in midair" : + (levtyp == CLOUD) ? "in a cloud" : + "in this place"; /* Air/Water Plane catch-all */ if (what) { You_cant("set a trap %s!",what); reset_trapset(); diff --git a/src/trap.c b/src/trap.c index 1924f976e..f53384490 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1446,9 +1446,14 @@ struct trap *trap; } /* convert landmine into pit */ if (trap) { - trap->ttyp = PIT; /* explosion creates a pit */ - trap->madeby_u = FALSE; /* resulting pit isn't yours */ - seetrap(trap); /* and it isn't concealed */ + if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) { + /* no pits here */ + deltrap(trap); + } else { + trap->ttyp = PIT; /* explosion creates a pit */ + trap->madeby_u = FALSE; /* resulting pit isn't yours */ + seetrap(trap); /* and it isn't concealed */ + } } }