split 'nothing_special' of arti_invoke() into separate function

This commit is contained in:
SHIRAKATA Kentaro
2023-11-16 18:10:17 +09:00
committed by PatR
parent 34d6c3cf7c
commit c68f870819

View File

@@ -22,9 +22,11 @@ staticfn struct artifact *get_artifact(struct obj *) NONNULL; /* never returns n
: &artilist[ART_NONARTIFACT]) */
staticfn boolean bane_applies(const struct artifact *, struct monst *)
NONNULLARG12;
staticfn int spec_applies(const struct artifact *, struct monst *) NONNULLARG12;
NONNULLARG12;
staticfn int spec_applies(const struct artifact *, struct monst *)
NONNULLARG12;
staticfn int invoke_ok(struct obj *);
staticfn void nothing_special(struct obj *) NONNULLARG1;
staticfn int arti_invoke(struct obj *);
staticfn boolean Mb_hit(struct monst * magr, struct monst *mdef,
struct obj *, int *, int, boolean, char *);
@@ -1666,6 +1668,13 @@ doinvoke(void)
return arti_invoke(obj);
}
staticfn void
nothing_special(struct obj *obj)
{
if (carried(obj))
You_feel("a surge of power, but nothing seems to happen.");
}
staticfn int
arti_invoke(struct obj *obj)
{
@@ -1722,8 +1731,10 @@ arti_invoke(struct obj *obj)
due to PermaBlind or eyeless polymorph;
vary the message in that situation */
&& (HBlinded & ~TIMEOUT) != 0L) ? "slightly " : "");
else
goto nothing_special;
else {
nothing_special(obj);
return ECMD_TIME;
}
if (healamt > 0) {
if (Upolyd)
u.mh += healamt;
@@ -1750,8 +1761,10 @@ arti_invoke(struct obj *obj)
u.uen += epboost;
disp.botl = TRUE;
You_feel("re-energized.");
} else
goto nothing_special;
} else {
nothing_special(obj);
return ECMD_TIME;
}
break;
}
case UNTRAP: {
@@ -1810,7 +1823,8 @@ arti_invoke(struct obj *obj)
n = select_menu(tmpwin, PICK_ONE, &selected);
if (n <= 0) {
destroy_nhwindow(tmpwin);
goto nothing_special;
nothing_special(obj);
return ECMD_TIME;
}
i = selected[0].item.a_int - 1;
free((genericptr_t) selected);
@@ -1848,8 +1862,10 @@ arti_invoke(struct obj *obj)
case CREATE_AMMO: {
struct obj *otmp = mksobj(ARROW, TRUE, FALSE);
if (!otmp)
goto nothing_special;
if (!otmp) {
nothing_special(obj);
return ECMD_TIME;
}
otmp->blessed = obj->blessed;
otmp->cursed = obj->cursed;
otmp->bknown = obj->bknown;
@@ -1979,10 +1995,8 @@ arti_invoke(struct obj *obj)
}
if ((eprop & ~W_ARTI) || iprop) {
nothing_special:
/* you had the property from some other source too */
if (carried(obj))
You_feel("a surge of power, but nothing seems to happen.");
nothing_special(obj);
return ECMD_TIME;
}
switch (oart->inv_prop) {
@@ -2000,8 +2014,10 @@ arti_invoke(struct obj *obj)
(void) float_down(I_SPECIAL | TIMEOUT, W_ARTI);
break;
case INVIS:
if (BInvis || Blind)
goto nothing_special;
if (BInvis || Blind) {
nothing_special(obj);
return ECMD_TIME;
}
newsym(u.ux, u.uy);
if (on)
Your("body takes on a %s transparency...",