a few fewer update_inventory() calls
A couple of things I noticed while running umpteen tests for tty perm_invent. Remove the update_inventory() from unmul(), and limit the one that deals with seeing inventory when recovering from blindness. Just a drop in the bucket overall, and the screen updates nearly instantly for update_inventory() except when debugging perm_invent so players aren't likely to notice this.
This commit is contained in:
+28
-13
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 do_wear.c $NHDT-Date: 1650875489 2022/04/25 08:31:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.156 $ */
|
/* NetHack 3.7 do_wear.c $NHDT-Date: 1702017586 2023/12/08 06:39:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.175 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -213,8 +213,11 @@ Boots_on(void)
|
|||||||
default:
|
default:
|
||||||
impossible(unknown_type, c_boots, uarmf->otyp);
|
impossible(unknown_type, c_boots, uarmf->otyp);
|
||||||
}
|
}
|
||||||
if (uarmf) /* could be Null here (levitation boots put on over a sink) */
|
/* uarmf could be Null here (levitation boots put on over a sink) */
|
||||||
|
if (uarmf && !uarmf->known) {
|
||||||
uarmf->known = 1; /* boots' +/- evident because of status line AC */
|
uarmf->known = 1; /* boots' +/- evident because of status line AC */
|
||||||
|
update_inventory();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,8 +335,10 @@ Cloak_on(void)
|
|||||||
default:
|
default:
|
||||||
impossible(unknown_type, c_cloak, uarmc->otyp);
|
impossible(unknown_type, c_cloak, uarmc->otyp);
|
||||||
}
|
}
|
||||||
if (uarmc) /* no known instance of !uarmc here but play it safe */
|
if (uarmc && !uarmc->known) { /* no known instance of !uarmc here */
|
||||||
uarmc->known = 1; /* cloak's +/- evident because of status line AC */
|
uarmc->known = 1; /* cloak's +/- evident because of status line AC */
|
||||||
|
update_inventory();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,8 +466,10 @@ Helmet_on(void)
|
|||||||
impossible(unknown_type, c_helmet, uarmh->otyp);
|
impossible(unknown_type, c_helmet, uarmh->otyp);
|
||||||
}
|
}
|
||||||
/* uarmh could be Null due to uchangealign() */
|
/* uarmh could be Null due to uchangealign() */
|
||||||
if (uarmh)
|
if (uarmh && !uarmh->known) {
|
||||||
uarmh->known = 1; /* helmet's +/- evident because of status line AC */
|
uarmh->known = 1; /* helmet's +/- evident because of status line AC */
|
||||||
|
update_inventory();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -544,8 +551,10 @@ Gloves_on(void)
|
|||||||
default:
|
default:
|
||||||
impossible(unknown_type, c_gloves, uarmg->otyp);
|
impossible(unknown_type, c_gloves, uarmg->otyp);
|
||||||
}
|
}
|
||||||
if (uarmg) /* no known instance of !uarmg here but play it safe */
|
if (!uarmg->known) {
|
||||||
uarmg->known = 1; /* gloves' +/- evident because of status line AC */
|
uarmg->known = 1; /* gloves' +/- evident because of status line AC */
|
||||||
|
update_inventory();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,8 +676,10 @@ Shield_on(void)
|
|||||||
default:
|
default:
|
||||||
impossible(unknown_type, c_shield, uarms->otyp);
|
impossible(unknown_type, c_shield, uarms->otyp);
|
||||||
}
|
}
|
||||||
if (uarms) /* no known instance of !uarms here but play it safe */
|
if (!uarms->known) {
|
||||||
uarms->known = 1; /* shield's +/- evident because of status line AC */
|
uarms->known = 1; /* shield's +/- evident because of status line AC */
|
||||||
|
update_inventory();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,8 +719,10 @@ Shirt_on(void)
|
|||||||
default:
|
default:
|
||||||
impossible(unknown_type, c_shirt, uarmu->otyp);
|
impossible(unknown_type, c_shirt, uarmu->otyp);
|
||||||
}
|
}
|
||||||
if (uarmu) /* no known instances of !uarmu here but play it safe */
|
if (!uarmu->known) {
|
||||||
uarmu->known = 1; /* shirt's +/- evident because of status line AC */
|
uarmu->known = 1; /* shirt's +/- evident because of status line AC */
|
||||||
|
update_inventory();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,10 +840,12 @@ Armor_on(void)
|
|||||||
{
|
{
|
||||||
if (!uarm) /* no known instances of !uarm here but play it safe */
|
if (!uarm) /* no known instances of !uarm here but play it safe */
|
||||||
return 0;
|
return 0;
|
||||||
uarm->known = 1; /* suit's +/- evident because of status line AC */
|
if (!uarm->known) {
|
||||||
|
uarm->known = 1; /* suit's +/- evident because of status line AC */
|
||||||
|
update_inventory();
|
||||||
|
}
|
||||||
dragon_armor_handling(uarm, TRUE, TRUE);
|
dragon_armor_handling(uarm, TRUE, TRUE);
|
||||||
/* gold DSM requires special handling since it emits light when worn;
|
/* gold DSM requires extra handling since it emits light when worn;
|
||||||
do that after the special armor handling */
|
do that after the special armor handling */
|
||||||
if (artifact_light(uarm) && !uarm->lamplit) {
|
if (artifact_light(uarm) && !uarm->lamplit) {
|
||||||
begin_burn(uarm, FALSE);
|
begin_burn(uarm, FALSE);
|
||||||
@@ -1117,7 +1132,7 @@ adjust_attrib(struct obj *obj, int which, int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Ring_on(register struct obj *obj)
|
Ring_on(struct obj *obj)
|
||||||
{
|
{
|
||||||
long oldprop = u.uprops[objects[obj->otyp].oc_oprop].extrinsic;
|
long oldprop = u.uprops[objects[obj->otyp].oc_oprop].extrinsic;
|
||||||
boolean observable;
|
boolean observable;
|
||||||
@@ -1412,8 +1427,8 @@ Blindf_off(struct obj *otmp)
|
|||||||
/* called in moveloop()'s prologue to set side-effects of worn start-up items;
|
/* called in moveloop()'s prologue to set side-effects of worn start-up items;
|
||||||
also used by poly_obj() when a worn item gets transformed */
|
also used by poly_obj() when a worn item gets transformed */
|
||||||
void
|
void
|
||||||
set_wear(struct obj *obj) /* if null, do all worn items;
|
set_wear(
|
||||||
* otherwise just obj itself */
|
struct obj *obj) /* if Null, do all worn items; otherwise just obj */
|
||||||
{
|
{
|
||||||
gi.initial_don = !obj;
|
gi.initial_don = !obj;
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 hack.c $NHDT-Date: 1695932717 2023/09/28 20:25:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.410 $ */
|
/* NetHack 3.7 hack.c $NHDT-Date: 1702017600 2023/12/08 06:40:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.422 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -3766,6 +3766,7 @@ unmul(const char *msg_override)
|
|||||||
gn.nomovemsg = 0;
|
gn.nomovemsg = 0;
|
||||||
u.usleep = 0;
|
u.usleep = 0;
|
||||||
gm.multi_reason = NULL, gm.multireasonbuf[0] = '\0';
|
gm.multi_reason = NULL, gm.multireasonbuf[0] = '\0';
|
||||||
|
|
||||||
if (ga.afternmv) {
|
if (ga.afternmv) {
|
||||||
int (*f)(void) = ga.afternmv;
|
int (*f)(void) = ga.afternmv;
|
||||||
|
|
||||||
@@ -3773,8 +3774,6 @@ unmul(const char *msg_override)
|
|||||||
encumbrance hack for levitation--see weight_cap()) */
|
encumbrance hack for levitation--see weight_cap()) */
|
||||||
ga.afternmv = (int (*)(void)) 0;
|
ga.afternmv = (int (*)(void)) 0;
|
||||||
(void) (*f)();
|
(void) (*f)();
|
||||||
/* for finishing Armor/Boots/&c_on() */
|
|
||||||
update_inventory();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 invent.c $NHDT-Date: 1700869704 2023/11/24 23:48:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.476 $ */
|
/* NetHack 3.7 invent.c $NHDT-Date: 1702017603 2023/12/08 06:40:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.484 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -2611,6 +2611,7 @@ void
|
|||||||
learn_unseen_invent(void)
|
learn_unseen_invent(void)
|
||||||
{
|
{
|
||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
|
boolean invupdated = FALSE;
|
||||||
|
|
||||||
if (Blind)
|
if (Blind)
|
||||||
return; /* sanity check */
|
return; /* sanity check */
|
||||||
@@ -2618,6 +2619,7 @@ learn_unseen_invent(void)
|
|||||||
for (otmp = gi.invent; otmp; otmp = otmp->nobj) {
|
for (otmp = gi.invent; otmp; otmp = otmp->nobj) {
|
||||||
if (otmp->dknown && (otmp->bknown || !Role_if(PM_CLERIC)))
|
if (otmp->dknown && (otmp->bknown || !Role_if(PM_CLERIC)))
|
||||||
continue; /* already seen */
|
continue; /* already seen */
|
||||||
|
invupdated = TRUE;
|
||||||
/* xname() will set dknown, perhaps bknown (for priest[ess]);
|
/* xname() will set dknown, perhaps bknown (for priest[ess]);
|
||||||
result from xname() is immediately released for re-use */
|
result from xname() is immediately released for re-use */
|
||||||
maybereleaseobuf(xname(otmp));
|
maybereleaseobuf(xname(otmp));
|
||||||
@@ -2626,7 +2628,8 @@ learn_unseen_invent(void)
|
|||||||
* handle deferred discovery here.
|
* handle deferred discovery here.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
update_inventory();
|
if (invupdated)
|
||||||
|
update_inventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* persistent inventory window is maintained by interface code;
|
/* persistent inventory window is maintained by interface code;
|
||||||
|
|||||||
Reference in New Issue
Block a user