modify #untrap prompting further
> The intention is, I believe, to cater for the situation where you, a > chest, and a dungeon-trap are all on the same square; previously > (C340-71), you wouldn't have been able to check the chest for traps > because an #untrap in direction '.' would always have tried to disarm > the dungeon trap. However, since you can't trap-check containers on > adjacent squares, it'd wouldn't hurt if the question was dispensed > with when you specify a direction that isn't your square. > > (Note that "you cannot deal with traps while trapped!", so there's > still several situations when you can't trap-check a chest on a > trap-square, even though you can loot it, until you've untrapped > yourself; is this really consistent? Should the if(u.utrap) check > be moved to the "case y:" branch of the switch?)
This commit is contained in:
40
src/trap.c
40
src/trap.c
@@ -3127,22 +3127,44 @@ boolean force;
|
|||||||
struct trap *ttmp;
|
struct trap *ttmp;
|
||||||
struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
boolean trap_skipped = FALSE;
|
boolean trap_skipped = FALSE;
|
||||||
|
boolean box_here = FALSE;
|
||||||
|
boolean deal_with_floor_trap = FALSE;
|
||||||
|
char the_trap[BUFSZ], qbuf[QBUFSZ];
|
||||||
|
int containercnt = 0;
|
||||||
|
|
||||||
if(!getdir((char *)0)) return(0);
|
if(!getdir((char *)0)) return(0);
|
||||||
x = u.ux + u.dx;
|
x = u.ux + u.dx;
|
||||||
y = u.uy + u.dy;
|
y = u.uy + u.dy;
|
||||||
|
|
||||||
if ((ttmp = t_at(x,y)) && ttmp->tseen) {
|
for(otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) {
|
||||||
if (u.utrap) {
|
if(Is_box(otmp) && !u.dx && !u.dy) {
|
||||||
You("cannot deal with traps while trapped!");
|
box_here = TRUE;
|
||||||
return 1;
|
containercnt++;
|
||||||
|
if (containercnt > 1) break;
|
||||||
}
|
}
|
||||||
There("is %s here.", an(defsyms[trap_to_defsym(ttmp->ttyp)].explanation));
|
}
|
||||||
|
|
||||||
switch (ynq(ttmp->ttyp == WEB ? "Remove it?" : "Disarm it?")) {
|
if ((ttmp = t_at(x,y)) && ttmp->tseen) {
|
||||||
case 'q': return(0);
|
deal_with_floor_trap = TRUE;
|
||||||
case 'n': trap_skipped = TRUE; break;
|
Strcpy(the_trap, the(defsyms[trap_to_defsym(ttmp->ttyp)].explanation));
|
||||||
case 'y':
|
if (box_here) {
|
||||||
|
Sprintf(qbuf, "There %s and %s here. %s %s?",
|
||||||
|
(containercnt == 1) ? "is a container" : "are containers",
|
||||||
|
an(defsyms[trap_to_defsym(ttmp->ttyp)].explanation),
|
||||||
|
ttmp->ttyp == WEB ? "Remove" : "Disarm", the_trap);
|
||||||
|
switch (ynq(qbuf)) {
|
||||||
|
case 'q': return(0);
|
||||||
|
case 'n': trap_skipped = TRUE;
|
||||||
|
deal_with_floor_trap = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (deal_with_floor_trap) {
|
||||||
|
if (u.utrap) {
|
||||||
|
You("cannot deal with %s while trapped%s!", the_trap,
|
||||||
|
(x == u.ux && y == u.uy) ? " in it" : "");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
switch(ttmp->ttyp) {
|
switch(ttmp->ttyp) {
|
||||||
case BEAR_TRAP:
|
case BEAR_TRAP:
|
||||||
case WEB:
|
case WEB:
|
||||||
|
|||||||
Reference in New Issue
Block a user