Merge branch 'NetHack-3.6.2'
This commit is contained in:
@@ -2236,16 +2236,19 @@ struct obj **optr;
|
||||
/* Passing FALSE arg here will result in messages displayed */
|
||||
if (!figurine_location_checks(obj, &cc, FALSE))
|
||||
return;
|
||||
You("%s and it transforms.",
|
||||
You("%s and it %stransforms.",
|
||||
(u.dx || u.dy) ? "set the figurine beside you"
|
||||
: (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)
|
||||
|| is_pool(cc.x, cc.y))
|
||||
? "release the figurine"
|
||||
: (u.dz < 0 ? "toss the figurine into the air"
|
||||
: "set the figurine on the ground"));
|
||||
: "set the figurine on the ground"),
|
||||
Blind ? "supposedly " : "");
|
||||
(void) make_familiar(obj, cc.x, cc.y, FALSE);
|
||||
(void) stop_timer(FIG_TRANSFORM, obj_to_any(obj));
|
||||
useup(obj);
|
||||
if (Blind)
|
||||
map_invisible(cc.x, cc.y);
|
||||
*optr = 0;
|
||||
}
|
||||
|
||||
|
||||
54
src/botl.c
54
src/botl.c
@@ -736,7 +736,7 @@ boolean *valsetlist;
|
||||
|
||||
if (update_all || chg || reset) {
|
||||
idxmax = curr->idxmax;
|
||||
pc = (idxmax > BL_FLUSH) ? percentage(curr, &blstats[idx][idxmax]) : 0;
|
||||
pc = (idxmax >= 0) ? percentage(curr, &blstats[idx][idxmax]) : 0;
|
||||
|
||||
if (!valsetlist[fld])
|
||||
(void) anything_to_s(curr->val, &curr->a, anytype);
|
||||
@@ -770,8 +770,7 @@ evaluate_and_notify_windowport(valsetlist, idx, idx_p)
|
||||
int idx, idx_p;
|
||||
boolean *valsetlist;
|
||||
{
|
||||
int i;
|
||||
boolean updated = FALSE;
|
||||
int i, updated = 0, notpresent = 0;
|
||||
|
||||
/*
|
||||
* Now pass the changed values to window port.
|
||||
@@ -781,27 +780,43 @@ boolean *valsetlist;
|
||||
|| ((i == BL_EXP) && !flags.showexp)
|
||||
|| ((i == BL_TIME) && !flags.time)
|
||||
|| ((i == BL_HD) && !Upolyd)
|
||||
|| ((i == BL_XP || i == BL_EXP) && Upolyd))
|
||||
|| ((i == BL_XP || i == BL_EXP) && Upolyd)) {
|
||||
notpresent++;
|
||||
continue;
|
||||
}
|
||||
if (evaluate_and_notify_windowport_field(i, valsetlist, idx, idx_p))
|
||||
updated = TRUE;
|
||||
updated++;
|
||||
}
|
||||
/*
|
||||
* It is possible to get here, with nothing having been pushed
|
||||
* to the window port, when none of the info has changed. In that
|
||||
* case, we need to force a call to status_update() when
|
||||
* context.botlx is set. The tty port in particular has a problem
|
||||
* if that isn't done, since it sets context.botlx when a menu or
|
||||
* text display obliterates the status line.
|
||||
* Notes:
|
||||
* 1. It is possible to get here, with nothing having been pushed
|
||||
* to the window port, when none of the info has changed.
|
||||
*
|
||||
* 2. Some window ports are also known to optimize by only drawing
|
||||
* fields that have changed since the previous update.
|
||||
*
|
||||
* In both of those situations, we need to force updates to
|
||||
* all of the fields when context.botlx is set. The tty port in
|
||||
* particular has a problem if that isn't done, since the core sets
|
||||
* context.botlx when a menu or text display obliterates the status
|
||||
* line.
|
||||
*
|
||||
* For those situations, to trigger the full update of every field
|
||||
* whether changed or not, call status_update() with BL_RESET.
|
||||
*
|
||||
* For regular processing and to notify the window port that a
|
||||
* bot() round has finished and it's time to trigger a flush of
|
||||
* all buffered changes received thus far but not reflected in
|
||||
* the display, call status_update() with BL_FLUSH.
|
||||
*
|
||||
* To work around it, we call status_update() with fictitious
|
||||
* index of BL_FLUSH (-1).
|
||||
*/
|
||||
if ((context.botlx && !updated)
|
||||
|| (windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
|
||||
if (context.botlx)
|
||||
status_update(BL_RESET, (genericptr_t) 0, 0, 0,
|
||||
NO_COLOR, &cond_hilites[0]);
|
||||
else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
|
||||
status_update(BL_FLUSH, (genericptr_t) 0, 0, 0,
|
||||
NO_COLOR, &cond_hilites[0]);
|
||||
|
||||
|
||||
context.botl = context.botlx = 0;
|
||||
update_all = FALSE;
|
||||
}
|
||||
@@ -1936,7 +1951,7 @@ boolean from_configfile;
|
||||
}
|
||||
|
||||
if (percent) {
|
||||
if (initblstats[fld].idxmax <= BL_FLUSH) {
|
||||
if (initblstats[fld].idxmax < 0) {
|
||||
config_error_add("Cannot use percent with '%s'",
|
||||
initblstats[fld].fldname);
|
||||
return FALSE;
|
||||
@@ -2674,7 +2689,7 @@ int fld;
|
||||
int at;
|
||||
int onlybeh = BL_TH_NONE, nopts = 0;
|
||||
|
||||
if (fld <= BL_FLUSH || fld >= MAXBLSTATS)
|
||||
if (fld < 0 || fld >= MAXBLSTATS)
|
||||
return BL_TH_NONE;
|
||||
|
||||
at = initblstats[fld].anytype;
|
||||
@@ -2717,7 +2732,7 @@ int fld;
|
||||
nopts++;
|
||||
}
|
||||
|
||||
if (initblstats[fld].idxmax > BL_FLUSH) {
|
||||
if (initblstats[fld].idxmax >= 0) {
|
||||
any = zeroany;
|
||||
any.a_int = onlybeh = BL_TH_VAL_PERCENTAGE;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, 'p', 0, ATR_NONE,
|
||||
@@ -2849,6 +2864,7 @@ choose_field:
|
||||
fld = origfld;
|
||||
if (fld == BL_FLUSH) {
|
||||
fld = status_hilite_menu_choose_field();
|
||||
/* isn't this redundant given what follows? */
|
||||
if (fld == BL_FLUSH)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -652,7 +652,6 @@ wiz_identify(VOID_ARGS)
|
||||
it doesn't matter whether the command has been remapped */
|
||||
if (display_inventory((char *) 0, TRUE) == C('I'))
|
||||
identify_pack(0, FALSE);
|
||||
/* [TODO? if player picks a specific inventory item, ID it] */
|
||||
iflags.override_ID = 0;
|
||||
} else
|
||||
pline("Unavailable command '%s'.",
|
||||
|
||||
37
src/hack.c
37
src/hack.c
@@ -2468,16 +2468,14 @@ register boolean newlev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* the ',' command */
|
||||
/* returns
|
||||
1 = cannot pickup, time taken
|
||||
0 = cannot pickup, no time taken
|
||||
-1 = do normal pickup
|
||||
-2 = loot the monster */
|
||||
int
|
||||
dopickup()
|
||||
pickup_checks()
|
||||
{
|
||||
int count, tmpcount;
|
||||
struct trap *traphere = t_at(u.ux, u.uy);
|
||||
|
||||
/* awful kludge to work around parse()'s pre-decrement */
|
||||
count = (multi || (save_cm && *save_cm == ',')) ? multi + 1 : 0;
|
||||
multi = 0; /* always reset */
|
||||
/* uswallow case added by GAN 01/29/87 */
|
||||
if (u.uswallow) {
|
||||
if (!u.ustuck->minvent) {
|
||||
@@ -2489,8 +2487,7 @@ dopickup()
|
||||
Blind ? "feel" : "see");
|
||||
return 1;
|
||||
} else {
|
||||
tmpcount = -count;
|
||||
return loot_mon(u.ustuck, &tmpcount, (boolean *) 0);
|
||||
return -2; /* loot the monster inventory */
|
||||
}
|
||||
}
|
||||
if (is_pool(u.ux, u.uy)) {
|
||||
@@ -2532,6 +2529,7 @@ dopickup()
|
||||
return 0;
|
||||
}
|
||||
if (!can_reach_floor(TRUE)) {
|
||||
struct trap *traphere = t_at(u.ux, u.uy);
|
||||
if (traphere && uteetering_at_seen_pit(traphere))
|
||||
You("cannot reach the bottom of the pit.");
|
||||
else if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
|
||||
@@ -2542,6 +2540,25 @@ dopickup()
|
||||
You("cannot reach the %s.", surface(u.ux, u.uy));
|
||||
return 0;
|
||||
}
|
||||
return -1; /* can do normal pickup */
|
||||
}
|
||||
|
||||
/* the ',' command */
|
||||
int
|
||||
dopickup(VOID_ARGS)
|
||||
{
|
||||
int count, tmpcount, ret;
|
||||
|
||||
/* awful kludge to work around parse()'s pre-decrement */
|
||||
count = (multi || (save_cm && *save_cm == cmd_from_func(dopickup))) ? multi + 1 : 0;
|
||||
multi = 0; /* always reset */
|
||||
|
||||
if ((ret = pickup_checks() >= 0))
|
||||
return ret;
|
||||
else if (ret == -2) {
|
||||
tmpcount = -count;
|
||||
return loot_mon(u.ustuck, &tmpcount, (boolean *) 0);
|
||||
} /* else ret == -1 */
|
||||
|
||||
return pickup(-count);
|
||||
}
|
||||
|
||||
117
src/invent.c
117
src/invent.c
@@ -2279,6 +2279,19 @@ int id_limit;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* count the unidentified items */
|
||||
int
|
||||
count_unidentified(objchn)
|
||||
struct obj *objchn;
|
||||
{
|
||||
int unid_cnt = 0;
|
||||
struct obj *obj;
|
||||
|
||||
for (obj = objchn; obj; obj = obj->nobj)
|
||||
if (not_fully_identified(obj))
|
||||
++unid_cnt;
|
||||
return unid_cnt;
|
||||
}
|
||||
|
||||
/* dialog with user to identify a given number of items; 0 means all */
|
||||
void
|
||||
@@ -2286,28 +2299,21 @@ identify_pack(id_limit, learning_id)
|
||||
int id_limit;
|
||||
boolean learning_id; /* true if we just read unknown identify scroll */
|
||||
{
|
||||
struct obj *obj, *the_obj;
|
||||
int n, unid_cnt;
|
||||
|
||||
unid_cnt = 0;
|
||||
the_obj = 0; /* if unid_cnt ends up 1, this will be it */
|
||||
for (obj = invent; obj; obj = obj->nobj)
|
||||
if (not_fully_identified(obj))
|
||||
++unid_cnt, the_obj = obj;
|
||||
struct obj *obj;
|
||||
int n, unid_cnt = count_unidentified(invent);
|
||||
|
||||
if (!unid_cnt) {
|
||||
You("have already identified all %sof your possessions.",
|
||||
learning_id ? "the rest " : "");
|
||||
} else if (!id_limit || id_limit >= unid_cnt) {
|
||||
/* identify everything */
|
||||
if (unid_cnt == 1) {
|
||||
(void) identify(the_obj);
|
||||
} else {
|
||||
/* TODO: use fully_identify_obj and cornline/menu/whatever here
|
||||
*/
|
||||
for (obj = invent; obj; obj = obj->nobj)
|
||||
if (not_fully_identified(obj))
|
||||
(void) identify(obj);
|
||||
/* TODO: use fully_identify_obj and cornline/menu/whatever here */
|
||||
for (obj = invent; obj; obj = obj->nobj) {
|
||||
if (not_fully_identified(obj)) {
|
||||
(void) identify(obj);
|
||||
if (unid_cnt == 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* identify up to `id_limit' items */
|
||||
@@ -2491,7 +2497,7 @@ boolean want_reply;
|
||||
long *out_cnt;
|
||||
{
|
||||
static const char not_carrying_anything[] = "Not carrying anything";
|
||||
struct obj *otmp;
|
||||
struct obj *otmp, wizid_fakeobj;
|
||||
char ilet, ret;
|
||||
char *invlet = flags.inv_order;
|
||||
int n, classcount;
|
||||
@@ -2500,6 +2506,7 @@ long *out_cnt;
|
||||
menu_item *selected;
|
||||
unsigned sortflags;
|
||||
Loot *sortedinvent, *srtinv;
|
||||
boolean wizid = FALSE;
|
||||
|
||||
if (lets && !*lets)
|
||||
lets = 0; /* simplify tests: (lets) instead of (lets && *lets) */
|
||||
@@ -2582,22 +2589,33 @@ long *out_cnt;
|
||||
start_menu(win);
|
||||
any = zeroany;
|
||||
if (wizard && iflags.override_ID) {
|
||||
int unid_cnt;
|
||||
char prompt[QBUFSZ];
|
||||
|
||||
/* C('I') == ^I == default keystroke for wiz_identify;
|
||||
it is guaranteed not to be in use as an inventory letter
|
||||
(wiz_identify might be remapped to an ordinary letter,
|
||||
making iflags.override_ID ambiguous as a return value) */
|
||||
any.a_char = C('I');
|
||||
/* wiz_identify stuffed the wiz_identify command character (^I)
|
||||
into iflags.override_ID for our use as an accelerator;
|
||||
it could be ambiguous as a selector but the only time it
|
||||
is wanted is in case where no item is being selected */
|
||||
Sprintf(prompt, "Debug Identify (%s to permanently identify)",
|
||||
visctrl(iflags.override_ID));
|
||||
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
|
||||
prompt, MENU_UNSELECTED);
|
||||
} else if (xtra_choice) {
|
||||
unid_cnt = count_unidentified(invent);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
"Debug Identify",
|
||||
MENU_UNSELECTED);
|
||||
if (!unid_cnt) {
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
"(all items are permanently identified already)",
|
||||
MENU_UNSELECTED);
|
||||
} else {
|
||||
any.a_obj = &wizid_fakeobj;
|
||||
/* wiz_identify stuffed the wiz_identify command character (^I)
|
||||
into iflags.override_ID for our use as an accelerator;
|
||||
it could be ambiguous as a selector but the only time it
|
||||
is wanted is in case where no item is being selected */
|
||||
Sprintf(prompt,
|
||||
"Select %sthe %d bolded item%s to permanently identify (%s for all)",
|
||||
(unid_cnt == 1) ? "": "any of ", unid_cnt,
|
||||
(unid_cnt > 1) ? "s" : "",
|
||||
visctrl(iflags.override_ID));
|
||||
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
|
||||
prompt, MENU_UNSELECTED);
|
||||
wizid = TRUE;
|
||||
}
|
||||
} else if (xtra_choice) {
|
||||
/* wizard override ID and xtra_choice are mutually exclusive */
|
||||
if (flags.sortpack)
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
|
||||
@@ -2621,8 +2639,13 @@ nextclass:
|
||||
MENU_UNSELECTED);
|
||||
classcount++;
|
||||
}
|
||||
any.a_char = ilet;
|
||||
add_menu(win, obj_to_glyph(otmp), &any, ilet, 0, ATR_NONE,
|
||||
if (wizid)
|
||||
any.a_obj = otmp;
|
||||
else
|
||||
any.a_char = ilet;
|
||||
add_menu(win, obj_to_glyph(otmp), &any, ilet, 0,
|
||||
(wizid && not_fully_identified(otmp)) ?
|
||||
ATR_BOLD : ATR_NONE,
|
||||
doname(otmp), MENU_UNSELECTED);
|
||||
}
|
||||
}
|
||||
@@ -2655,11 +2678,31 @@ nextclass:
|
||||
}
|
||||
end_menu(win, query && *query ? query : (char *) 0);
|
||||
|
||||
n = select_menu(win, want_reply ? PICK_ONE : PICK_NONE, &selected);
|
||||
n = select_menu(win, wizid ? PICK_ANY :
|
||||
want_reply ? PICK_ONE : PICK_NONE, &selected);
|
||||
if (n > 0) {
|
||||
ret = selected[0].item.a_char;
|
||||
if (out_cnt)
|
||||
*out_cnt = selected[0].count;
|
||||
if (wizid) {
|
||||
int i = n;
|
||||
|
||||
ret = '\0';
|
||||
while (--i >= 0) {
|
||||
otmp = selected[i].item.a_obj;
|
||||
if (otmp == &wizid_fakeobj) {
|
||||
/* C('I') == ^I == default keystroke for wiz_identify;
|
||||
it is guaranteed not to be in use as an inventory letter
|
||||
(wiz_identify might be remapped to an ordinary letter,
|
||||
making iflags.override_ID ambiguous as a return value) */
|
||||
ret = C('I');
|
||||
} else {
|
||||
if (not_fully_identified(otmp))
|
||||
(void) identify(otmp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = selected[0].item.a_char;
|
||||
if (out_cnt)
|
||||
*out_cnt = selected[0].count;
|
||||
}
|
||||
free((genericptr_t) selected);
|
||||
} else
|
||||
ret = !n ? '\0' : '\033'; /* cancelled */
|
||||
|
||||
Reference in New Issue
Block a user