container message tweaks (trunk only)
"You carefully open the <container>..." is rather tedious after
you've opened that container multiple times, so omit "carefully" once the
contents and lock-status are both known. (I don't think it's possible
for a container to still be trapped in such circumstances, but even if it
is, you'll now stop being careful....)
"<The container> is empty." becomes "<The container> is now empty."
if it just released Schroedinger's Cat. Do the same if a cursed bag of
holding just destroyed the last of its contents. Also, there's no need
to count the number of items inside a container; that dates to before the
container-and-contents overhaul done for 3.1.0.
And for the loot menu, change "q - do nothing" to "q - done" if some
prior action (prodding the Cat into life or death, loss of any cursed bag
contents, or using ':' to look inside when contents aren't yet known) has
been enough to cause this container access to use up a turn. I haven't
bothered to do the same in the help text for non-menu looting, which seems
like more trouble than it'd be worth.
This commit is contained in:
+25
-24
@@ -37,7 +37,7 @@ STATIC_DCL void NDECL(explain_container_prompt);
|
|||||||
STATIC_DCL int FDECL(traditional_loot, (BOOLEAN_P));
|
STATIC_DCL int FDECL(traditional_loot, (BOOLEAN_P));
|
||||||
STATIC_DCL int FDECL(menu_loot, (int,BOOLEAN_P));
|
STATIC_DCL int FDECL(menu_loot, (int,BOOLEAN_P));
|
||||||
STATIC_DCL char FDECL(in_or_out_menu, (const char *,struct obj *,
|
STATIC_DCL char FDECL(in_or_out_menu, (const char *,struct obj *,
|
||||||
BOOLEAN_P,BOOLEAN_P));
|
BOOLEAN_P,BOOLEAN_P,BOOLEAN_P));
|
||||||
STATIC_DCL int FDECL(container_at, (int, int, BOOLEAN_P));
|
STATIC_DCL int FDECL(container_at, (int, int, BOOLEAN_P));
|
||||||
STATIC_DCL boolean FDECL(able_to_loot, (int,int,BOOLEAN_P));
|
STATIC_DCL boolean FDECL(able_to_loot, (int,int,BOOLEAN_P));
|
||||||
STATIC_DCL boolean FDECL(mon_beside, (int, int));
|
STATIC_DCL boolean FDECL(mon_beside, (int, int));
|
||||||
@@ -1574,7 +1574,9 @@ lootcont:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
You("carefully open %s...", the(xname(cobj)));
|
You("%sopen %s...",
|
||||||
|
(!cobj->cknown || !cobj->lknown) ? "carefully " : "",
|
||||||
|
the(xname(cobj)));
|
||||||
timepassed |= use_container(&cobj, 0);
|
timepassed |= use_container(&cobj, 0);
|
||||||
/* might have triggered chest trap or magic bag explosion */
|
/* might have triggered chest trap or magic bag explosion */
|
||||||
if (multi < 0 || !cobj) return 1;
|
if (multi < 0 || !cobj) return 1;
|
||||||
@@ -2100,8 +2102,7 @@ int held;
|
|||||||
inokay, outokay, outmaybe;
|
inokay, outokay, outmaybe;
|
||||||
char c, emptymsg[BUFSZ],
|
char c, emptymsg[BUFSZ],
|
||||||
qbuf[QBUFSZ], pbuf[QBUFSZ], xbuf[QBUFSZ];
|
qbuf[QBUFSZ], pbuf[QBUFSZ], xbuf[QBUFSZ];
|
||||||
long loss;
|
int used = 0;
|
||||||
int cnt, used = 0;
|
|
||||||
|
|
||||||
emptymsg[0] = '\0';
|
emptymsg[0] = '\0';
|
||||||
if (nohands(youmonst.data)) {
|
if (nohands(youmonst.data)) {
|
||||||
@@ -2138,21 +2139,21 @@ int held;
|
|||||||
observe_quantum_cat(current_container);
|
observe_quantum_cat(current_container);
|
||||||
used = 1;
|
used = 1;
|
||||||
}
|
}
|
||||||
/* count the number of contained objects;
|
/* sometimes toss objects if a cursed magic bag */
|
||||||
sometimes toss objects if a cursed magic bag */
|
cursed_mbag = (Is_mbag(current_container) &&
|
||||||
cursed_mbag = Is_mbag(current_container) && current_container->cursed;
|
current_container->cursed &&
|
||||||
cnt = 0, loss = 0L;
|
Has_contents(current_container));
|
||||||
for (curr = current_container->cobj; curr; curr = otmp) {
|
if (cursed_mbag) {
|
||||||
otmp = curr->nobj;
|
long loss = 0L;
|
||||||
if (cursed_mbag && !rn2(13)) {
|
|
||||||
obj_extract_self(curr);
|
for (curr = current_container->cobj; curr; curr = otmp) {
|
||||||
loss += mbag_item_gone(held, curr);
|
otmp = curr->nobj;
|
||||||
used = 1;
|
if (!rn2(13)) {
|
||||||
} else {
|
obj_extract_self(curr);
|
||||||
cnt++;
|
loss += mbag_item_gone(held, curr);
|
||||||
|
used = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (cursed_mbag) { /* magic bag might have lost some contents */
|
|
||||||
if (loss)
|
if (loss)
|
||||||
You("owe %ld %s for lost merchandise.", loss, currency(loss));
|
You("owe %ld %s for lost merchandise.", loss, currency(loss));
|
||||||
current_container->owt = weight(current_container);
|
current_container->owt = weight(current_container);
|
||||||
@@ -2162,11 +2163,11 @@ int held;
|
|||||||
#ifndef GOLDOBJ
|
#ifndef GOLDOBJ
|
||||||
if (u.ugold) inokay = TRUE;
|
if (u.ugold) inokay = TRUE;
|
||||||
#endif
|
#endif
|
||||||
outokay = (cnt > 0);
|
outokay = Has_contents(current_container);
|
||||||
if (!outokay) /* preformat the empty-container message */
|
if (!outokay) /* preformat the empty-container message */
|
||||||
Sprintf(emptymsg, "%s is %sempty.",
|
Sprintf(emptymsg, "%s is %sempty.",
|
||||||
Ysimple_name2(current_container),
|
Ysimple_name2(current_container),
|
||||||
quantum_cat ? "now " : "");
|
(quantum_cat || cursed_mbag) ? "now " : "");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* What-to-do prompt's list of possible actions:
|
* What-to-do prompt's list of possible actions:
|
||||||
@@ -2209,7 +2210,7 @@ int held;
|
|||||||
c = 'b';
|
c = 'b';
|
||||||
} else {
|
} else {
|
||||||
c = in_or_out_menu(qbuf, current_container,
|
c = in_or_out_menu(qbuf, current_container,
|
||||||
outmaybe, inokay);
|
outmaybe, inokay, (used != 0));
|
||||||
}
|
}
|
||||||
} else { /* TRADITIONAL, COMBINATION, or PARTIAL */
|
} else { /* TRADITIONAL, COMBINATION, or PARTIAL */
|
||||||
xbuf[0] = '\0'; /* list of extra acceptable responses */
|
xbuf[0] = '\0'; /* list of extra acceptable responses */
|
||||||
@@ -2464,10 +2465,10 @@ boolean put_in;
|
|||||||
}
|
}
|
||||||
|
|
||||||
STATIC_OVL char
|
STATIC_OVL char
|
||||||
in_or_out_menu(prompt, obj, outokay, inokay)
|
in_or_out_menu(prompt, obj, outokay, inokay, alreadyused)
|
||||||
const char *prompt;
|
const char *prompt;
|
||||||
struct obj *obj;
|
struct obj *obj;
|
||||||
boolean outokay, inokay;
|
boolean outokay, inokay, alreadyused;
|
||||||
{
|
{
|
||||||
/* underscore is not a choice; it's used to skip element [0] */
|
/* underscore is not a choice; it's used to skip element [0] */
|
||||||
static const char lootchars[] = "_:oibrsq",
|
static const char lootchars[] = "_:oibrsq",
|
||||||
@@ -2517,7 +2518,7 @@ boolean outokay, inokay;
|
|||||||
buf, MENU_UNSELECTED);
|
buf, MENU_UNSELECTED);
|
||||||
}
|
}
|
||||||
any.a_int = 7; /* 'q' */
|
any.a_int = 7; /* 'q' */
|
||||||
Strcpy(buf, "do nothing");
|
Strcpy(buf, alreadyused ? "done" : "do nothing");
|
||||||
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE,
|
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE,
|
||||||
buf, MENU_SELECTED);
|
buf, MENU_SELECTED);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user