Instead of returning 0 or 1, we'll now use ECMD_OK or ECMD_TURN.
These have the same meaning as the hardcoded numbers; ECMD_TURN
means the command uses a turn.
In future, could add eg. a flag denoting "user cancelled command"
or "command failed", and should clear eg. the cmdq.
Mostly this was simply replacing return values with the defines
in the extended commands, so hopefully I didn't break anything.
struct ext_func_tab {
uchar key;
const char *ef_txt, *ef_desc;
- int (*ef_funct)(void);
+ int (*ef_funct)(void); /* must return ECMD_foo flags */
int flags;
const char *f_text;
};
#define BRK_KNOWN2NOTBREAK 8
#define BRK_KNOWN_OUTCOME (BRK_KNOWN2BREAK | BRK_KNOWN2NOTBREAK)
+/* extended command return values */
+#define ECMD_OK 0x00 /* cmd done successfully */
+#define ECMD_TIME 0x01 /* cmd took time, uses up a turn */
+
/* values returned from getobj() callback functions */
enum getobj_callback_returns {
/* generally invalid - can't be used for this purpose. will give a "silly
if (Underwater) {
pline("Using your camera underwater would void the warranty.");
- return 0;
+ return ECMD_OK;
}
if (!getdir((char *) 0))
- return 0;
+ return ECMD_OK;
if (obj->spe <= 0) {
pline1(nothing_happens);
- return 1;
+ return ECMD_TIME;
}
consume_obj_charge(obj, TRUE);
to be deferred until after flash_hits_mon() */
transient_light_cleanup();
}
- return 1;
+ return ECMD_TIME;
}
static int
if (!freehand()) {
You("have no free %s!", body_part(HAND));
- return 0;
+ return ECMD_OK;
} else if (obj == ublindf) {
You("cannot use it while you're wearing it!");
- return 0;
+ return ECMD_OK;
} else if (obj->cursed) {
long old;
(old ? "are filthier than ever" : "get slimy"));
if (is_wet_towel(obj))
dry_a_towel(obj, -1, drying_feedback);
- return 1;
+ return ECMD_TIME;
case 1:
if (!ublindf) {
old = u.ucreamed;
}
if (is_wet_towel(obj))
dry_a_towel(obj, -1, drying_feedback);
- return 1;
+ return ECMD_TIME;
case 0:
break;
}
!uarmg ? makeplural(body_part(HAND)) : gloves_simple_name(uarmg));
if (is_wet_towel(obj))
dry_a_towel(obj, -1, drying_feedback);
- return 1;
+ return ECMD_TIME;
} else if (u.ucreamed) {
Blinded -= u.ucreamed;
u.ucreamed = 0;
}
if (is_wet_towel(obj))
dry_a_towel(obj, -1, drying_feedback);
- return 1;
+ return ECMD_TIME;
}
Your("%s and %s are already clean.", body_part(FACE),
makeplural(body_part(HAND)));
- return 0;
+ return ECMD_OK;
}
/* maybe give a stethoscope message based on floor objects */
}
/* variations on "He's dead, Jim." (Star Trek's Dr McCoy) */
You_hear("a voice say, \"%s, Jim.\"", buf);
- *resp = 1;
+ *resp = ECMD_TIME;
return TRUE;
} else if (corpse) {
if (nohands(g.youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */
- return 0;
+ return ECMD_OK;
} else if (Deaf) {
You_cant("hear anything!");
- return 0;
+ return ECMD_OK;
} else if (!freehand()) {
You("have no free %s.", body_part(HAND));
- return 0;
+ return ECMD_OK;
}
if (!getdir((char *) 0))
- return 0;
+ return ECMD_OK;
- res = (g.hero_seq == g.context.stethoscope_seq);
+ res = (g.hero_seq == g.context.stethoscope_seq) ? ECMD_TIME : ECMD_OK;
g.context.stethoscope_seq = g.hero_seq;
g.bhitpos.x = u.ux, g.bhitpos.y = u.uy; /* tentative, reset below */
ry = u.uy + u.dy;
if (!isok(rx, ry)) {
You_hear("a faint typing noise.");
- return 0;
+ return ECMD_OK;
}
if ((mtmp = m_at(rx, ry)) != 0) {
const char *mnm = x_monnam(mtmp, ARTICLE_A, (const char *) 0,
? "unleash %s from inside."
: "unleash anything from inside %s."),
noit_mon_nam(u.ustuck));
- return 0;
+ return ECMD_OK;
}
if (!obj->leashmon && number_leashed() >= MAXLEASHED) {
You("cannot leash any more pets.");
- return 0;
+ return ECMD_OK;
}
if (!get_adjacent_loc((char *) 0, (char *) 0, u.ux, u.uy, &cc))
- return 0;
+ return ECMD_OK;
if (cc.x == u.ux && cc.y == u.uy) {
if (u.usteed && u.dz > 0) {
goto got_target;
}
pline("Leash yourself? Very funny...");
- return 0;
+ return ECMD_OK;
}
/*
if (!(mtmp = m_at(cc.x, cc.y))) {
There("is no creature there.");
(void) unmap_invisible(cc.x, cc.y);
- return 1;
+ return ECMD_TIME;
}
spotmon = canspotmon(mtmp);
spotmon ? "your " : "", l_monnam(mtmp));
}
}
- return 1;
+ return ECMD_TIME;
}
/* assuming mtmp->mleashed has been checked */
boolean vis, invis_mirror, useeit, monable;
if (!getdir((char *) 0))
- return 0;
+ return ECMD_OK;
invis_mirror = Invis;
useeit = !Blind && (!invis_mirror || See_invisible);
uvisage = beautiful();
pline_The("%s fogs up and doesn't reflect!", mirror);
else
pline("Nothing seems to happen.");
- return 1;
+ return ECMD_TIME;
}
if (!u.dx && !u.dy && !u.dz) {
if (!useeit) {
You("look as %s as ever.", uvisage);
}
}
- return 1;
+ return ECMD_TIME;
}
if (u.uswallow) {
if (useeit)
You("reflect %s %s.", s_suffix(mon_nam(u.ustuck)),
mbodypart(u.ustuck, STOMACH));
- return 1;
+ return ECMD_TIME;
}
if (Underwater) {
if (useeit)
You(Hallucination ? "give the fish a chance to fix their makeup."
: "reflect the murky water.");
- return 1;
+ return ECMD_TIME;
}
if (u.dz) {
if (useeit)
You("reflect the %s.",
(u.dz > 0) ? surface(u.ux, u.uy) : ceiling(u.ux, u.uy));
- return 1;
+ return ECMD_TIME;
}
mtmp = bhit(u.dx, u.dy, COLNO, INVIS_BEAM,
(int (*) (MONST_P, OBJ_P)) 0,
(int (*) (OBJ_P, OBJ_P)) 0, &obj);
if (!mtmp || !haseyes(mtmp->data) || g.notonhead)
- return 1;
+ return ECMD_TIME;
/* couldsee(mtmp->mx, mtmp->my) is implied by the fact that bhit()
targetted it, so we can ignore possibility of X-ray vision */
pline("%s doesn't have a reflection.", Monnam(mtmp));
} else if (monable && mtmp->data == &mons[PM_MEDUSA]) {
if (mon_reflects(mtmp, "The gaze is reflected away by %s %s!"))
- return 1;
+ return ECMD_TIME;
if (vis)
pline("%s is turned to stone!", Monnam(mtmp));
g.stoned = TRUE;
else
pline("%s ignores %s reflection.", Monnam(mtmp), mhis(mtmp));
}
- return 1;
+ return ECMD_TIME;
}
static void
return GETOBJ_EXCLUDE;
}
+/* the #rub command */
int
dorub(void)
{
if (nohands(g.youmonst.data)) {
You("aren't able to rub anything without hands.");
- return 0;
+ return ECMD_OK;
}
obj = getobj("rub", rub_ok, GETOBJ_NOFLAGS);
if (!obj) {
/* pline1(Never_mind); -- handled by getobj() */
- return 0;
+ return ECMD_OK;
}
if (obj->oclass == GEM_CLASS || obj->oclass == FOOD_CLASS) {
if (is_graystone(obj)) {
use_stone(obj);
- return 1;
+ return ECMD_TIME;
} else if (obj->otyp == LUMP_OF_ROYAL_JELLY) {
return use_royal_jelly(obj);
} else {
pline("Sorry, I don't know how to use that.");
- return 0;
+ return ECMD_OK;
}
}
if (!wield_tool(obj, "rub"))
- return 0;
+ return ECMD_OK;
/* now uwep is obj */
if (uwep->otyp == MAGIC_LAMP) {
pline("Anyway, nothing exciting happens.");
} else
pline1(nothing_happens);
- return 1;
+ return ECMD_TIME;
}
+/* the #jump command */
int
dojump(void)
{
/* normally (nolimbs || slithy) implies !Jumping,
but that isn't necessarily the case for knights */
You_cant("jump; you have no legs!");
- return 0;
+ return ECMD_OK;
} else if (!magic && !Jumping) {
You_cant("jump very far.");
- return 0;
+ return ECMD_OK;
/* if steed is immobile, can't do physical jump but can do spell one */
} else if (!magic && u.usteed && stucksteed(FALSE)) {
/* stucksteed gave "<steed> won't move" message */
- return 0;
+ return ECMD_OK;
} else if (u.uswallow) {
if (magic) {
You("bounce around a little.");
- return 1;
+ return ECMD_TIME;
}
pline("You've got to be kidding!");
- return 0;
+ return ECMD_OK;
} else if (u.uinwater) {
if (magic) {
You("swish around a little.");
- return 1;
+ return ECMD_TIME;
}
pline("This calls for swimming, not jumping!");
- return 0;
+ return ECMD_OK;
} else if (u.ustuck) {
if (u.ustuck->mtame && !Conflict && !u.ustuck->mconf) {
struct monst *mtmp = u.ustuck;
set_ustuck((struct monst *) 0);
You("pull free from %s.", mon_nam(mtmp));
- return 1;
+ return ECMD_TIME;
}
if (magic) {
You("writhe a little in the grasp of %s!", mon_nam(u.ustuck));
- return 1;
+ return ECMD_TIME;
}
You("cannot escape from %s!", mon_nam(u.ustuck));
- return 0;
+ return ECMD_OK;
} else if (Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) {
if (magic) {
You("flail around a little.");
- return 1;
+ return ECMD_TIME;
}
You("don't have enough traction to jump.");
- return 0;
+ return ECMD_OK;
} else if (!magic && near_capacity() > UNENCUMBERED) {
You("are carrying too much to jump!");
- return 0;
+ return ECMD_OK;
} else if (!magic && (u.uhunger <= 100 || ACURR(A_STR) < 6)) {
You("lack the strength to jump!");
- return 0;
+ return ECMD_OK;
} else if (!magic && Wounded_legs) {
legs_in_no_shape("jumping", u.usteed != 0);
- return 0;
+ return ECMD_OK;
} else if (u.usteed && u.utrap) {
pline("%s is stuck in a trap.", Monnam(u.usteed));
- return 0;
+ return ECMD_OK;
}
pline("Where do you want to jump?");
g.jumping_is_magic = magic;
getpos_sethilite(display_jump_positions, get_valid_jump_position);
if (getpos(&cc, TRUE, "the desired position") < 0)
- return 0; /* user pressed ESC */
+ return ECMD_OK; /* user pressed ESC */
if (!is_valid_jump_pos(cc.x, cc.y, magic, TRUE)) {
- return 0;
+ return ECMD_OK;
} else {
coord uc;
int range, temp;
case TT_LAVA:
You("pull yourself above the %s!", hliquid("lava"));
reset_utrap(TRUE);
- return 1;
+ return ECMD_TIME;
case TT_BURIEDBALL:
case TT_INFLOOR:
You("strain your %s, but you're still %s.",
: "attached to the buried ball");
set_wounded_legs(LEFT_SIDE, rn1(10, 11));
set_wounded_legs(RIGHT_SIDE, rn1(10, 11));
- return 1;
+ return ECMD_TIME;
}
/*
g.multi_reason = "jumping around";
g.nomovemsg = "";
morehungry(rnd(25));
- return 1;
+ return ECMD_TIME;
}
}
char buf[BUFSZ];
struct monst *mtmp;
struct obj *otmp;
- int rx, ry, proficient, res = 0;
+ int rx, ry, proficient, res = ECMD_OK;
const char *msg_slipsfree = "The bullwhip slips free.";
const char *msg_snap = "Snap!";
if (obj != uwep) {
if (!wield_tool(obj, "lash"))
- return 0;
- res = 1;
+ return ECMD_OK;
+ res = ECMD_TIME;
}
if (!getdir((char *) 0))
return res;
if (u.usteed && !rn2(proficient + 2)) {
You("whip %s!", mon_nam(u.usteed));
kick_steed();
- return 1;
+ return ECMD_TIME;
}
if (is_pool_or_lava(u.ux, u.uy)) {
You("cause a small splash.");
if (is_lava(u.ux, u.uy))
(void) fire_damage(uwep, FALSE, u.ux, u.uy);
- return 1;
+ return ECMD_TIME;
}
if (Levitation || u.usteed || Flying) {
/* Have a shot at snaring something on the floor. A flyer
otmp = g.level.objects[u.ux][u.uy];
if (otmp && otmp->otyp == CORPSE && otmp->corpsenm == PM_HORSE) {
pline("Why beat a dead horse?");
- return 1;
+ return ECMD_TIME;
}
if (otmp && proficient) {
You("wrap your bullwhip around %s on the %s.",
an(singular(otmp, xname)), surface(u.ux, u.uy));
if (rnl(6) || pickup_object(otmp, 1L, TRUE) < 1)
pline1(msg_slipsfree);
- return 1;
+ return ECMD_TIME;
}
}
dam = rnd(2) + dbon() + obj->spe;
You("hit your %s with your bullwhip.", body_part(FOOT));
Sprintf(buf, "killed %sself with %s bullwhip", uhim(), uhis());
losehp(Maybe_Half_Phys(dam), buf, NO_KILLER_PREFIX);
- return 1;
+ return ECMD_TIME;
} else if ((Fumbling || Glib) && !rn2(5)) {
pline_The("bullwhip slips out of your %s.", body_part(HAND));
You("flick your bullwhip towards %s.", mon_nam(mtmp));
}
if (proficient && force_attack(mtmp, FALSE))
- return 1;
+ return ECMD_TIME;
if (do_snap)
pline1(msg_snap);
}
} else {
pline1(msg_snap);
}
- return 1;
+ return ECMD_TIME;
}
static const char
use_pole(struct obj *obj, boolean autohit)
{
const char thump[] = "Thump! Your blow bounces harmlessly off the %s.";
- int res = 0, typ, max_range, min_range, glyph;
+ int res = ECMD_OK, typ, max_range, min_range, glyph;
coord cc;
struct monst *mtmp;
struct monst *hitm = g.context.polearm.hitmon;
/* Are you allowed to use the pole? */
if (u.uswallow) {
pline(not_enough_room);
- return 0;
+ return ECMD_OK;
}
if (obj != uwep) {
if (!wield_tool(obj, "swing"))
- return 0;
- res = 1;
+ return ECMD_OK;
+ res = ECMD_TIME;
}
/* assert(obj == uwep); */
res: 1 => polearm became wielded, 0 => already wielded;
g.context.move: 1 => discovered hidden monster at target spot,
0 => answered 'n' to "Really attack?" prompt */
- return res || g.context.move;
+ return res | (g.context.move ? ECMD_TIME : ECMD_OK);
if (overexertion())
- return 1; /* burn nutrition; maybe pass out */
+ return ECMD_TIME; /* burn nutrition; maybe pass out */
g.context.polearm.hitmon = mtmp;
check_caitiff(mtmp);
g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
}
}
u_wipe_engr(2); /* same as for melee or throwing */
- return 1;
+ return ECMD_TIME;
}
static int
costly_alteration(obj, COST_SPLAT);
obj_extract_self(obj);
delobj(obj);
- return 0;
+ return ECMD_OK;
}
/* getobj callback for object to rub royal jelly on */
addinv(obj); /* put the unused lump back; if it came from
* a split, it should merge back */
/* pline1(Never_mind); -- getobj() took care of this */
- return 0;
+ return ECMD_OK;
}
You("smear royal jelly all over %s.", yname(eobj));
/* not useup() because we've already done freeinv() */
setnotworn(obj);
obfree(obj, (struct obj *) 0);
- return 1;
+ return ECMD_TIME;
}
static int
use_grapple(struct obj *obj)
{
- int res = 0, typ, max_range = 4, tohit;
+ int res = ECMD_OK, typ, max_range = 4, tohit;
boolean save_confirm;
coord cc;
struct monst *mtmp;
/* Are you allowed to use the hook? */
if (u.uswallow) {
pline(not_enough_room);
- return 0;
+ return ECMD_OK;
}
if (obj != uwep) {
if (!wield_tool(obj, "cast"))
- return 0;
+ return ECMD_OK;
else
- res = 1;
+ res = ECMD_TIME;
}
/* assert(obj == uwep); */
(void) pickup_object(otmp, 1L, FALSE);
/* If pickup fails, leave it alone */
newsym(cc.x, cc.y);
- return 1;
+ return ECMD_TIME;
}
break;
case 2: /* Monster */
You("pull in %s!", mon_nam(mtmp));
mtmp->mundetected = 0;
rloc_to(mtmp, cc.x, cc.y);
- return 1;
+ return ECMD_TIME;
} else if ((!bigmonst(mtmp->data) && !strongmonst(mtmp->data))
|| rn2(4)) {
flags.confirm = FALSE;
flags.confirm = save_confirm;
check_caitiff(mtmp);
(void) thitmonst(mtmp, uwep);
- return 1;
+ return ECMD_TIME;
}
/*FALLTHRU*/
case 3: /* Surface */
hurtle(sgn(cc.x - u.ux), sgn(cc.y - u.uy), 1, FALSE);
spoteffects(TRUE);
}
- return 1;
+ return ECMD_TIME;
default: /* Yourself (oops!) */
if (P_SKILL(typ) <= P_BASIC) {
You("hook yourself!");
losehp(Maybe_Half_Phys(rn1(10, 10)), "a grappling hook",
KILLED_BY);
- return 1;
+ return ECMD_TIME;
}
break;
}
pline1(nothing_happens);
- return 1;
+ return ECMD_TIME;
}
#define BY_OBJECT ((struct monst *) 0)
if (nohands(g.youmonst.data)) {
You_cant("break %s without hands!", yname(obj));
- return 0;
+ return ECMD_OK;
} else if (!freehand()) {
Your("%s are occupied!", makeplural(body_part(HAND)));
- return 0;
+ return ECMD_OK;
} else if (ACURR(A_STR) < (is_fragile ? 5 : 10)) {
You("don't have the strength to break %s!", yname(obj));
- return 0;
+ return ECMD_OK;
}
if (!paranoid_query(ParanoidBreakwand,
safe_qbuf(confirm,
"Are you really sure you want to break ",
"?", obj, yname, ysimple_name, "the wand")))
- return 0;
+ return ECMD_OK;
pline("Raising %s high above your %s, you %s it in two!", yname(obj),
body_part(HEAD), is_fragile ? "snap" : "break");
if (obj)
delobj(obj);
nomul(0);
- return 1;
+ return ECMD_TIME;
}
/* getobj callback for object to apply - this is more complex than most other
return GETOBJ_EXCLUDE_SELECTABLE;
}
-/* the 'a' command */
+/* the #apply command, 'a' */
int
doapply(void)
{
struct obj *obj;
- register int res = 1;
+ register int res = ECMD_TIME;
if (nohands(g.youmonst.data)) {
You("aren't able to use or apply tools in your current form.");
- return 0;
+ return ECMD_OK;
}
if (check_capacity((char *) 0))
- return 0;
+ return ECMD_OK;
obj = getobj("use or apply", apply_ok, GETOBJ_NOFLAGS);
if (!obj)
- return 0;
+ return ECMD_OK;
if (!retouch_object(&obj, FALSE))
- return 1; /* evading your grasp costs a turn; just be
- grateful that you don't drop it as well */
+ return ECMD_TIME; /* evading your grasp costs a turn; just be
+ grateful that you don't drop it as well */
if (obj->oclass == WAND_CLASS)
return do_break_wand(obj);
case LOCK_PICK:
case CREDIT_CARD:
case SKELETON_KEY:
- res = (pick_lock(obj, 0, 0, NULL) != 0);
+ res = (pick_lock(obj, 0, 0, NULL) != 0) ? ECMD_TIME : ECMD_OK;
break;
case PICK_AXE:
case DWARVISH_MATTOCK:
}
pline("Sorry, I don't know how to use that.");
nomul(0);
- return 0;
+ return ECMD_OK;
}
- if (res && obj && obj->oartifact)
+ if ((res & ECMD_TIME) && obj && obj->oartifact)
arti_speak(obj);
nomul(0);
return res;
{
if (Underwater) {
pline("You don't want to get the pages even more soggy, do you?");
- return 0;
+ return ECMD_OK;
}
You("flip through the pages of %s.", thesimpleoname(obj));
fadeness[findx]);
}
- return 1;
+ return ECMD_TIME;
}
/*apply.c*/
obj = getobj("invoke", invoke_ok, GETOBJ_PROMPT);
if (!obj)
- return 0;
+ return ECMD_OK;
if (!retouch_object(&obj, FALSE))
- return 1;
+ return ECMD_TIME;
return arti_invoke(obj);
}
register const struct artifact *oart = get_artifact(obj);
if (!obj) {
impossible("arti_invoke without obj");
- return 0;
+ return ECMD_OK;
}
if (!oart || !oart->inv_prop) {
if (obj->otyp == CRYSTAL_BALL)
use_crystal_ball(&obj);
else
pline1(nothing_happens);
- return 1;
+ return ECMD_TIME;
}
if (oart->inv_prop > LAST_PROP) {
otense(obj, "are"));
/* and just got more so; patience is essential... */
obj->age += (long) d(3, 10);
- return 1;
+ return ECMD_TIME;
}
obj->age = g.moves + rnz(100);
case UNTRAP: {
if (!untrap(TRUE)) {
obj->age = 0; /* don't charge for changing their mind */
- return 0;
+ return ECMD_OK;
}
break;
}
if (!otmp) {
obj->age = 0;
- return 0;
+ return ECMD_OK;
}
b_effect = (obj->blessed && (oart->role == Role_switch
|| oart->role == NON_PM));
otense(obj, "are"));
/* can't just keep repeatedly trying */
obj->age += (long) d(3, 10);
- return 1;
+ return ECMD_TIME;
} else if (!on) {
/* when turning off property, determine downtime */
/* arbitrary for now until we can tune this -dlc */
/* you had the property from some other source too */
if (carried(obj))
You_feel("a surge of power, but nothing seems to happen.");
- return 1;
+ return ECMD_TIME;
}
switch (oart->inv_prop) {
case CONFLICT:
}
}
- return 1;
+ return ECMD_TIME;
}
/* will freeing this object from inventory cause levitation to end? */
carried effect was turned off, else we leave that alone;
we turn off invocation property here if still carried */
if (invoked && obj)
- arti_invoke(obj); /* reverse #invoke */
+ (void) arti_invoke(obj); /* reverse #invoke */
return TRUE;
}
}
/* for rejecting #if !SHELL, !SUSPEND */
static const char cmdnotavail[] = "'%s' command not available.";
+/* the #prevmsg command */
static int
doprev_message(void)
{
- return nh_doprev_message();
+ (void) nh_doprev_message();
+ return ECMD_OK;
}
/* Count down by decrementing multi */
do {
idx = get_ext_cmd();
if (idx < 0)
- return 0; /* quit */
+ return ECMD_OK; /* quit */
func = extcmdlist[idx].ef_funct;
if (!can_do_extcmd(&extcmdlist[idx]))
}
}
destroy_nhwindow(menuwin);
- return 0;
+ return ECMD_OK;
}
#if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
There("is no fountain here.");
} else if (is_unicorn(g.youmonst.data)) {
use_unicorn_horn((struct obj **) 0);
- return 1;
+ return ECMD_TIME;
} else if (g.youmonst.data->msound == MS_SHRIEK) {
You("shriek.");
if (u.uburied)
} else {
You("don't have a special ability in your normal form!");
}
- return 0;
+ return ECMD_OK;
}
int
|| !check_user_string(sysopt.explorers)) {
if (!wizard) {
You("cannot access explore mode.");
- return 0;
+ return ECMD_OK;
} else {
pline(
"Note: normally you wouldn't be allowed into explore mode.");
pline("Continuing with %s.", oldmode);
}
}
- return 0;
+ return ECMD_OK;
}
-/* ^W command - wish for something */
+/* #wizwish command - wish for something */
static int
wiz_wish(void) /* Unlimited wishes for debug mode by Paul Polderman */
{
(void) encumber_msg();
} else
pline(unavailcmd, visctrl((int) cmd_from_func(wiz_wish)));
- return 0;
+ return ECMD_OK;
}
-/* ^I command - reveal and optionally identify hero's inventory */
+/* #wizidentify command - reveal and optionally identify hero's inventory */
static int
wiz_identify(void)
{
iflags.override_ID = 0;
} else
pline(unavailcmd, visctrl((int) cmd_from_func(wiz_identify)));
- return 0;
+ return ECMD_OK;
}
void
} else {
pline(unavailcmd, "#wizmakemap");
}
- return 0;
+ return ECMD_OK;
}
-/* ^F command - reveal the level map and any traps on it */
+/* the #wizmap command - reveal the level map and any traps on it */
static int
wiz_map(void)
{
HHallucination = save_Hhallu;
} else
pline(unavailcmd, visctrl((int) cmd_from_func(wiz_map)));
- return 0;
+ return ECMD_OK;
}
-/* ^G command - generate monster(s); a count prefix will be honored */
+/* #wizgenesis - generate monster(s); a count prefix will be honored */
static int
wiz_genesis(void)
{
(void) create_particular();
else
pline(unavailcmd, visctrl((int) cmd_from_func(wiz_genesis)));
- return 0;
+ return ECMD_OK;
}
-/* ^O command - display dungeon layout */
+/* #wizwhere command - display dungeon layout */
static int
wiz_where(void)
{
(void) print_dungeon(FALSE, (schar *) 0, (xchar *) 0);
else
pline(unavailcmd, visctrl((int) cmd_from_func(wiz_where)));
- return 0;
+ return ECMD_OK;
}
-/* ^E command - detect unseen (secret doors, traps, hidden monsters) */
+/* the #wizdetect command - detect secret doors, traps, hidden monsters */
static int
wiz_detect(void)
{
(void) findit();
else
pline(unavailcmd, visctrl((int) cmd_from_func(wiz_detect)));
- return 0;
+ return ECMD_OK;
}
+/* the #wizloadlua command - load an arbitrary lua file */
static int
wiz_load_lua(void)
{
(void) load_lua(buf);
} else
pline("Unavailable command 'wiz_load_lua'.");
- return 0;
+ return ECMD_OK;
}
+/* the #wizloaddes command - load a special level lua file */
static int
wiz_load_splua(void)
{
} else
pline("Unavailable command 'wiz_load_splua'.");
- return 0;
+ return ECMD_OK;
}
-/* ^V command - level teleport */
+/* the #wizlevelport command - level teleport */
static int
wiz_level_tele(void)
{
level_tele();
else
pline(unavailcmd, visctrl((int) cmd_from_func(wiz_level_tele)));
- return 0;
+ return ECMD_OK;
}
/* #wizfliplevel - transpose the current level */
pline("%s", Never_mind);
}
}
- return 0;
+ return ECMD_OK;
}
/* #levelchange command - adjust hero's experience level */
if (ret != 1) {
pline1(Never_mind);
- return 0;
+ return ECMD_OK;
}
if (newlevel == u.ulevel) {
You("are already that experienced.");
} else if (newlevel < u.ulevel) {
if (u.ulevel == 1) {
You("are already as inexperienced as you can get.");
- return 0;
+ return ECMD_OK;
}
if (newlevel < 1)
newlevel = 1;
} else {
if (u.ulevel >= MAXULEV) {
You("are already as experienced as you can get.");
- return 0;
+ return ECMD_OK;
}
if (newlevel > MAXULEV)
newlevel = MAXULEV;
pluslvl(FALSE);
}
u.ulevelmax = u.ulevel;
- return 0;
+ return ECMD_OK;
}
/* #panic command - test program's panic handling */
if (iflags.debug_fuzzer) {
u.uhp = u.uhpmax = 1000;
u.uen = u.uenmax = 1000;
- return 0;
+ return ECMD_OK;
}
if (paranoid_query(TRUE,
"Do you want to call panic() and end your game?"))
panic("Crash test.");
- return 0;
+ return ECMD_OK;
}
/* #polyself command - change hero's form */
wiz_polyself(void)
{
polyself(1);
- return 0;
+ return ECMD_OK;
}
/* #seenv command */
}
display_nhwindow(win, TRUE);
destroy_nhwindow(win);
- return 0;
+ return ECMD_OK;
}
/* #vision command */
}
display_nhwindow(win, TRUE);
destroy_nhwindow(win);
- return 0;
+ return ECMD_OK;
}
/* #wmode command */
}
display_nhwindow(win, TRUE);
destroy_nhwindow(win);
- return 0;
+ return ECMD_OK;
}
/* wizard mode variant of #terrain; internal levl[][].typ values in base-36 */
mndx = 0; /* gcc -Wall lint */
if (!olfaction(g.youmonst.data)) {
You("are incapable of detecting odors in your present form.");
- return 0;
+ return ECMD_OK;
}
pline("You can move the cursor to a monster that you want to smell.");
pline("Pick a monster to smell.");
ans = getpos(&cc, TRUE, "a monster");
if (ans < 0 || cc.x < 0) {
- return 0; /* done */
+ return ECMD_OK; /* done */
}
/* Convert the glyph at the selected position to a mndxbol. */
glyph = glyph_at(cc.x, cc.y);
} else
pline("That is not a monster.");
} while (TRUE);
- return 0;
+ return ECMD_OK;
}
RESTORE_WARNING_CONDEXPR_IS_CONSTANT
doredraw();
} else
pline(unavailcmd, visctrl((int) cmd_from_func(wiz_intrinsic)));
- return 0;
+ return ECMD_OK;
}
RESTORE_WARNING_FORMAT_NONLITERAL
wiz_rumor_check(void)
{
rumor_check();
- return 0;
+ return ECMD_OK;
}
/* #terrain command -- show known map, inspired by crawl's '|' command */
default:
break;
}
- return 0; /* no time elapses */
+ return ECMD_OK; /* no time elapses */
}
/* extcmdlist: full command list, ordered by command name;
}
}
-/*
+/* the #stats command
* Display memory usage of all monsters and objects on the level.
*/
static int
display_nhwindow(win, FALSE);
destroy_nhwindow(win);
- return 0;
+ return ECMD_OK;
}
RESTORE_WARNING_FORMAT_NONLITERAL
getlin("How many random monsters to migrate? [0]", inbuf);
if (*inbuf == '\033')
- return 0;
+ return ECMD_OK;
mcount = atoi(inbuf);
if (mcount < 0 || mcount > (COLNO * ROWNO) || Is_botlevel(&u.uz))
- return 0;
+ return ECMD_OK;
while (mcount > 0) {
if (Is_stronghold(&u.uz))
assign_level(&tolevel, &valley_level);
(coord *) 0);
mcount--;
}
- return 0;
+ return ECMD_OK;
}
#endif
/* current - use *cmd to directly index cmdlist array */
if (tlist != 0) {
if (!can_do_extcmd(tlist)) {
- res = 0;
+ res = ECMD_OK;
cmdq_clear();
} else {
/* we discard 'const' because some compilers seem to have
set_occupation(func, tlist->f_text, g.multi);
res = (*func)(); /* perform the command */
}
- if (!res) {
+ if (!(res & ECMD_TIME)) {
g.context.move = FALSE;
g.multi = 0;
}
{
char ch = here_cmd_menu(TRUE);
- return ch ? 1 : 0;
+ return ch ? ECMD_TIME : ECMD_OK;
}
/* #therecmdmenu command, a way to test there_cmd_menu without mouse */
char ch;
if (!getdir((const char *) 0) || !isok(u.ux + u.dx, u.uy + u.dy))
- return 0;
+ return ECMD_OK;
if (u.dx || u.dy)
ch = there_cmd_menu(TRUE, u.ux + u.dx, u.uy + u.dy);
else
ch = here_cmd_menu(TRUE);
- return ch ? 1 : 0;
+ return ch ? ECMD_TIME : ECMD_OK;
}
static void
if (!getpos_menu(&cc, GLOC_INTERESTING)) {
iflags.getloc_filter = gf;
iflags.getloc_travelmode = FALSE;
- return 0;
+ return ECMD_OK;
}
iflags.getloc_filter = gf;
} else {
if (getpos(&cc, TRUE, "the desired destination") < 0) {
/* user pressed ESC */
iflags.getloc_travelmode = FALSE;
- return 0;
+ return ECMD_OK;
}
}
iflags.travelcc.x = u.tx = cc.x;
dotravel_target(void)
{
if (!isok(iflags.travelcc.x, iflags.travelcc.y))
- return 0;
+ return ECMD_OK;
iflags.getloc_travelmode = FALSE;
g.context.mv = TRUE;
domove();
- return 1;
+ return ECMD_TIME;
}
/* mouse click look command */
return 0;
g.context.move = FALSE;
- do_look(2, &g.clicklook_cc);
+ (void) do_look(2, &g.clicklook_cc);
- return 0;
+ return ECMD_OK;
}
/*
} else
#endif
Norep(cmdnotavail, "#suspend");
- return 0;
+ return ECMD_OK;
}
/* '!' command, #shell */
#else
Norep(cmdnotavail, "#shell");
#endif
- return 0;
+ return ECMD_OK;
}
/*cmd.c*/
return 1;
}
-/* the 's' command -- explicit searching */
+/* the #search command -- explicit searching */
int
dosearch(void)
{
if (cmd_safety_prevention("another search",
"You already found a monster.",
&g.already_found_flag))
- return 0;
- return dosearch0(0);
+ return ECMD_OK;
+ return dosearch0(0) ? ECMD_TIME : ECMD_OK;
}
void
const char *verb;
char *dsp, dirsyms[12], qbuf[BUFSZ];
boolean ispick;
- int rx, ry, downok, res = 0;
+ int rx, ry, downok, res = ECMD_OK;
int dir;
/* Check tool */
if (obj != uwep) {
if (!wield_tool(obj, "swing"))
- return 0;
+ return ECMD_OK;
else
- res = 1;
+ res = ECMD_TIME;
}
ispick = is_pick(obj);
verb = ispick ? "dig" : "chop";
Sprintf(buf, "%s own %s", uhis(), OBJ_NAME(objects[obj->otyp]));
losehp(Maybe_Half_Phys(dam), buf, KILLED_BY);
g.context.botl = 1;
- return 1;
+ return ECMD_TIME;
} else if (u.dz == 0) {
if (Stunned || (Confusion && !rn2(5)))
confdir();
ry = u.uy + u.dy;
if (!isok(rx, ry)) {
pline("Clash!");
- return 1;
+ return ECMD_TIME;
}
lev = &levl[rx][ry];
if (MON_AT(rx, ry) && do_attack(m_at(rx, ry)))
- return 1;
+ return ECMD_TIME;
dig_target = dig_typ(obj, rx, ry);
if (dig_target == DIGTYP_UNDIGGABLE) {
/* ACCESSIBLE or POOL */
g.did_dig_msg = FALSE;
set_occupation(dig, verbing, 0);
}
- return 1;
+ return ECMD_TIME;
}
/*
#endif /*0*/
#ifdef DEBUG
-/* bury everything at your loc and around */
+/* the #wizbury command - bury everything at your loc and around */
int
wiz_debug_cmd_bury(void)
{
for (y = u.uy - 1; y <= u.uy + 1; y++)
if (isok(x, y))
bury_objs(x, y);
- return 0;
+ return ECMD_OK;
}
#endif /* DEBUG */
flush_screen(1); /* Flush waiting glyphs & put cursor on hero */
}
+/* the #redraw command */
int
doredraw(void)
{
docrt();
- return 0;
+ return ECMD_OK;
}
void
/* static boolean badspot(xchar,xchar); */
-/* 'd' command: drop one inventory item */
+/* the #drop command: drop one inventory item */
int
dodrop(void)
{
drop(struct obj *obj)
{
if (!obj)
- return 0;
+ return ECMD_OK;
if (!canletgo(obj, "drop"))
- return 0;
+ return ECMD_OK;
if (obj == uwep) {
if (welded(uwep)) {
weldmsg(obj);
- return 0;
+ return ECMD_OK;
}
setuwep((struct obj *) 0);
}
if ((obj->oclass == RING_CLASS || obj->otyp == MEAT_RING)
&& IS_SINK(levl[u.ux][u.uy].typ)) {
dosinkring(obj);
- return 1;
+ return ECMD_TIME;
}
if (!can_reach_floor(TRUE)) {
/* we might be levitating due to #invoke Heart of Ahriman;
hitfloor(obj, TRUE);
if (levhack)
float_down(I_SPECIAL | TIMEOUT, W_ARTI | W_ART);
- return 1;
+ return ECMD_TIME;
}
if (!IS_ALTAR(levl[u.ux][u.uy].typ) && flags.verbose)
You("drop %s.", doname(obj));
}
dropx(obj);
- return 1;
+ return ECMD_TIME;
}
/* dropx - take dropped item out of inventory;
}
}
-/* 'D' command: drop several things */
+/* the #droptype command: drop several things */
int
doddrop(void)
{
- int result = 0;
+ int result = ECMD_OK;
if (!g.invent) {
You("have nothing to drop.");
- return 0;
+ return ECMD_OK;
}
add_valid_menu_class(0); /* clear any classes already there */
if (*u.ushops)
return result;
}
-static int
+static int /* check callers */
menudrop_split(struct obj *otmp, int cnt)
{
if (cnt && cnt < otmp->quan) {
bypass_objlist(g.invent, FALSE); /* clear bypass bit for invent */
while ((otmp = nxt_unbypassed_obj(g.invent)) != 0) {
if (drop_everything || all_categories || allow_category(otmp))
- n_dropped += drop(otmp);
+ n_dropped += ((drop(otmp) == ECMD_TIME) ? 1 : 0);
}
/* we might not have dropped everything (worn armor, welded weapon,
cursed loadstones), so reset any remaining inventory to normal */
/* drop the just picked item automatically, if only one stack */
otmp = find_justpicked(g.invent);
if (otmp)
- n_dropped += menudrop_split(otmp, justpicked_quan);
+ n_dropped += ((menudrop_split(otmp, justpicked_quan) == ECMD_TIME) ? 1 : 0);
} else {
/* should coordinate with perm invent, maybe not show worn items */
n = query_objlist("What would you like to drop?", &g.invent,
if (!otmp2 || !otmp2->bypass)
continue;
/* found next selected invent item */
- n_dropped += menudrop_split(otmp, pick_list[i].count);
+ n_dropped += ((menudrop_split(otmp, pick_list[i].count) == ECMD_TIME) ? 1 : 0);
}
bypass_objlist(g.invent, FALSE); /* reset g.invent to normal */
free((genericptr_t) pick_list);
}
drop_done:
- return n_dropped;
+ return (n_dropped ? ECMD_TIME : ECMD_OK);
}
-/* the '>' command */
+/* the #down command */
int
dodown(void)
{
ladder_down = (stway && !stway->up && stway->isladder);
if (u_rooted())
- return 1;
+ return ECMD_TIME;
if (stucksteed(TRUE)) {
- return 0;
+ return ECMD_OK;
}
/* Levitation might be blocked, but player can still use '>' to
turn off controlled levitation */
}
}
if (float_down(I_SPECIAL | TIMEOUT, W_ARTI)) {
- return 1; /* came down, so moved */
+ return ECMD_TIME; /* came down, so moved */
} else if (!HLevitation && !ELevitation) {
Your("latent levitation ceases.");
- return 1; /* did something, effectively moved */
+ return ECMD_TIME; /* did something, effectively moved */
}
}
if (BLevitation) {
floating_above(stairs_down ? "stairs" : ladder_down
? "ladder"
: surface(u.ux, u.uy));
- return 0; /* didn't move */
+ return ECMD_OK; /* didn't move */
}
if (Upolyd && ceiling_hider(&mons[u.umonnum]) && u.uundetected) {
dotrap(trap, TOOKPLUNGE);
}
}
- return 1; /* came out of hiding; might need '>' again to go down */
+ return ECMD_TIME; /* came out of hiding; might need '>' again to go down */
}
if (u.ustuck) {
!u.uswallow ? "being held" : is_animal(u.ustuck->data)
? "swallowed"
: "engulfed");
- return 1;
+ return ECMD_TIME;
}
if (!stairs_down && !ladder_down) {
trap = t_at(u.ux, u.uy);
if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) {
dotrap(trap, TOOKPLUNGE);
- return 1;
+ return ECMD_TIME;
} else if (!trap || !is_hole(trap->ttyp)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
if (flags.autodig && !g.context.nopick && uwep && is_pick(uwep)) {
return use_pick_axe2(uwep);
} else {
You_cant("go down here.");
- return 0;
+ return ECMD_OK;
}
}
}
You("are standing at the gate to Gehennom.");
pline("Unspeakable cruelty and harm lurk down there.");
if (yn("Are you sure you want to enter?") != 'y')
- return 0;
+ return ECMD_OK;
pline("So be it.");
u.uevent.gehennom_entered = 1; /* don't ask again */
}
if (!next_to_u()) {
You("are held back by your pet!");
- return 0;
+ return ECMD_OK;
}
if (trap) {
"contusion from a small passage", KILLED_BY);
} else {
You("were unable to fit %s.", down_or_thru);
- return 0;
+ return ECMD_OK;
}
} else {
- return 0;
+ return ECMD_OK;
}
}
You("%s %s the %s.", actn, down_or_thru,
next_level(!trap);
g.at_ladder = FALSE;
}
- return 1;
+ return ECMD_TIME;
}
-/* the '<' command */
+/* the #up command - move up a staircase */
int
doup(void)
{
stairway *stway = stairway_at(u.ux,u.uy);
if (u_rooted())
- return 1;
+ return ECMD_TIME;
/* "up" to get out of a pit... */
if (u.utrap && u.utraptype == TT_PIT) {
climb_pit();
- return 1;
+ return ECMD_TIME;
}
if (!stway || (stway && !stway->up)) {
You_cant("go up here.");
- return 0;
+ return ECMD_OK;
}
if (stucksteed(TRUE)) {
- return 0;
+ return ECMD_OK;
}
if (u.ustuck) {
You("are %s, and cannot go up.",
!u.uswallow ? "being held" : is_animal(u.ustuck->data)
? "swallowed"
: "engulfed");
- return 1;
+ return ECMD_TIME;
}
if (near_capacity() > SLT_ENCUMBER) {
/* No levitation check; inv_weight() already allows for it */
Your("load is too heavy to climb the %s.",
levl[u.ux][u.uy].typ == STAIRS ? "stairs" : "ladder");
- return 1;
+ return ECMD_TIME;
}
if (ledger_no(&u.uz) == 1) {
if (iflags.debug_fuzzer)
- return 0;
+ return ECMD_OK;
if (yn("Beware, there will be no return! Still climb?") != 'y')
- return 0;
+ return ECMD_OK;
}
if (!next_to_u()) {
You("are held back by your pet!");
- return 0;
+ return ECMD_OK;
}
g.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
prev_level(TRUE);
g.at_ladder = FALSE;
- return 1;
+ return ECMD_TIME;
}
/* check that we can write out the current level */
if (cmd_safety_prevention("a no-op (to rest)",
"Are you waiting to get hit?",
&g.did_nothing_flag))
- return 0;
- return 1; /* Do nothing, but let other things happen */
+ return ECMD_OK;
+ return ECMD_TIME; /* Do nothing, but let other things happen */
}
static int
return 1; /* still busy */
}
+/* the #wipe command - wipe off your face */
int
dowipe(void)
{
/* Not totally correct; what if they change back after now
* but before they're finished wiping?
*/
- return 1;
+ return ECMD_TIME;
}
Your("%s is already clean.", body_part(FACE));
- return 1;
+ return ECMD_TIME;
}
/* common wounded legs feedback */
return GETOBJ_SUGGEST;
}
-/* C and #name commands - player can name monster or object or type of obj */
+/* #call / #name command - player can name monster or object or type of obj */
int
docallcmd(void)
{
donamelevel();
break;
}
- return 0;
+ return ECMD_OK;
}
/* for use by safe_qbuf() */
{
if (!(obj->owornmask & (W_ARMOR | W_ACCESSORY))) {
You("are not wearing that.");
- return 0;
+ return ECMD_OK;
}
if (obj == uskin
|| ((obj == uarm) && uarmc)
Strcpy(why, "; it's embedded");
}
You_cant("take that off%s.", why);
- return 0;
+ return ECMD_OK;
}
reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */
(void) select_off(obj);
if (!g.context.takeoff.mask)
- return 0;
+ return ECMD_OK;
/* none of armoroff()/Ring_/Amulet/Blindf_off() use context.takeoff.mask */
reset_remarm();
if (obj->owornmask)
remove_worn_item(obj, FALSE);
}
- return 1;
+ return ECMD_TIME;
}
-/* the 'T' command */
+/* the #takeoff command - remove worn armor */
int
dotakeoff(void)
{
: "dragon scale mail is");
else
pline("Not wearing any armor or accessories.");
- return 0;
+ return ECMD_OK;
}
if (Narmorpieces != 1 || ParanoidRemove)
otmp = getobj("take off", takeoff_ok, GETOBJ_NOFLAGS);
if (!otmp)
- return 0;
+ return ECMD_OK;
return armor_or_accessory_off(otmp);
}
-/* the 'R' command */
+/* the #remove command - take off ring or other accessory */
int
doremring(void)
{
count_worn_stuff(&otmp, TRUE);
if (!Naccessories && !Narmorpieces) {
pline("Not wearing any accessories or armor.");
- return 0;
+ return ECMD_OK;
}
if (Naccessories != 1 || ParanoidRemove)
otmp = getobj("remove", remove_ok, GETOBJ_NOFLAGS);
if (!otmp)
- return 0;
+ return ECMD_OK;
return armor_or_accessory_off(otmp);
}
if (obj->owornmask & (W_ACCESSORY | W_ARMOR)) {
already_wearing(c_that_);
- return 0;
+ return ECMD_OK;
}
armor = (obj->oclass == ARMOR_CLASS);
ring = (obj->oclass == RING_CLASS || obj->otyp == MEAT_RING);
/* checks which are performed prior to actually touching the item */
if (armor) {
if (!canwearobj(obj, &mask, TRUE))
- return 0;
+ return ECMD_OK;
if (obj->otyp == HELM_OF_OPPOSITE_ALIGNMENT
&& qstart_level.dnum == u.uz.dnum) { /* in quest */
u.ublessed = 0; /* lose your god's protection */
makeknown(obj->otyp);
g.context.botl = 1; /*for AC after zeroing u.ublessed */
- return 1;
+ return ECMD_TIME;
}
} else {
/*
if (nolimbs(g.youmonst.data)) {
You("cannot make the ring stick to your body.");
- return 0;
+ return ECMD_OK;
}
if (uleft && uright) {
There("are no more %s%s to fill.",
humanoid(g.youmonst.data) ? "ring-" : "",
fingers_or_gloves(FALSE));
- return 0;
+ return ECMD_OK;
}
if (uleft) {
mask = RIGHT_RING;
switch (answer) {
case '\0':
case '\033':
- return 0;
+ return ECMD_OK;
case 'l':
case 'L':
mask = LEFT_RING;
Your(
"%s are too slippery to remove, so you cannot put on the ring.",
gloves_simple_name(uarmg));
- return 1; /* always uses move */
+ return ECMD_TIME; /* always uses move */
}
if (uarmg && uarmg->cursed) {
res = !uarmg->bknown;
set_bknown(uarmg, 1);
You("cannot remove your %s to put on the ring.", c_gloves);
- return res; /* uses move iff we learned gloves are cursed */
+ /* uses move iff we learned gloves are cursed */
+ return res ? ECMD_TIME : ECMD_OK;
}
if (uwep) {
res = !uwep->bknown; /* check this before calling welded() */
hand = makeplural(hand);
You("cannot free your weapon %s to put on the ring.",
hand);
- return res; /* uses move iff we learned weapon is cursed */
+ /* uses move iff we learned weapon is cursed */
+ return res ? ECMD_TIME : ECMD_OK;
}
}
} else if (obj->oclass == AMULET_CLASS) {
if (uamul) {
already_wearing("an amulet");
- return 0;
+ return ECMD_OK;
}
} else if (eyewear) {
if (!has_head(g.youmonst.data)) {
You("have no head to wear %s on.", ansimpleoname(obj));
- return 0;
+ return ECMD_OK;
}
if (ublindf) {
} else {
already_wearing(something); /* ??? */
}
- return 0;
+ return ECMD_OK;
}
} else {
/* neither armor nor accessory */
You_cant("wear that!");
- return 0;
+ return ECMD_OK;
}
}
if (!retouch_object(&obj, FALSE))
- return 1; /* costs a turn even though it didn't get worn */
+ return ECMD_TIME; /* costs a turn even though it didn't get worn */
if (armor) {
int delay;
if (give_feedback && is_worn(obj))
prinv((char *) 0, obj, 0L);
}
- return 1;
+ return ECMD_TIME;
}
-/* the 'W' command */
+/* the #wear command */
int
dowear(void)
{
verysmall() or nohands() checks for shields, gloves, etc... */
if (verysmall(g.youmonst.data) || nohands(g.youmonst.data)) {
pline("Don't even bother.");
- return 0;
+ return ECMD_OK;
}
if (uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf
&& uleft && uright && uamul && ublindf) {
/* 'W' message doesn't mention accessories */
You("are already wearing a full complement of armor.");
- return 0;
+ return ECMD_OK;
}
otmp = getobj("wear", wear_ok, GETOBJ_NOFLAGS);
- return otmp ? accessory_or_armor_on(otmp) : 0;
+ return otmp ? accessory_or_armor_on(otmp) : ECMD_OK;
}
-/* the 'P' command */
+/* the #puton command */
int
doputon(void)
{
humanoid(g.youmonst.data) ? "ring-" : "",
fingers_or_gloves(FALSE),
(ublindf->otyp == LENSES) ? "some lenses" : "a blindfold");
- return 0;
+ return ECMD_OK;
}
otmp = getobj("put on", puton_ok, GETOBJ_NOFLAGS);
- return otmp ? accessory_or_armor_on(otmp) : 0;
+ return otmp ? accessory_or_armor_on(otmp) : ECMD_OK;
}
/* calculate current armor class */
g.context.takeoff.disrobing[0] = '\0';
}
-/* the 'A' command -- remove multiple worn items */
+/* the #takeoffall command -- remove multiple worn items */
int
doddoremarm(void)
{
if (g.context.takeoff.what || g.context.takeoff.mask) {
You("continue %s.", g.context.takeoff.disrobing);
set_occupation(take_off, g.context.takeoff.disrobing, 0);
- return 0;
+ return ECMD_OK;
} else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf && !uleft
&& !uright && !wearing_armor()) {
You("are not wearing anything.");
- return 0;
+ return ECMD_OK;
}
add_valid_menu_class(0); /* reset */
* in take_off(); if we return 1, that would add an extra turn to each
* disrobe.
*/
- return 0;
+ return ECMD_OK;
}
static int
return strcat(strcpy(buf, "kicking "), what);
}
+/* the #kick command */
int
dokick(void)
{
if (yn_function("Kick your steed?", ynchars, 'y') == 'y') {
You("kick %s.", mon_nam(u.usteed));
kick_steed();
- return 1;
+ return ECMD_TIME;
} else {
- return 0;
+ return ECMD_OK;
}
} else if (Wounded_legs) {
legs_in_no_shape("kicking", FALSE);
if (no_kick) {
/* ignore direction typed before player notices kick failed */
display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
- return 0;
+ return ECMD_OK;
}
if (!getdir((char *) 0))
- return 0;
+ return ECMD_OK;
if (!u.dx && !u.dy)
- return 0;
+ return ECMD_OK;
x = u.ux + u.dx;
y = u.uy + u.dy;
Your("feeble kick has no effect.");
break;
}
- return 1;
+ return ECMD_TIME;
} else if (u.utrap && u.utraptype == TT_PIT) {
/* must be Passes_walls */
You("kick at the side of the pit.");
- return 1;
+ return ECMD_TIME;
}
if (Levitation) {
int xx, yy;
&& !IS_DOOR(levl[xx][yy].typ)
&& (!Is_airlevel(&u.uz) || !OBJ_AT(xx, yy))) {
You("have nothing to brace yourself against.");
- return 0;
+ return ECMD_OK;
}
}
if (mtmp) {
oldglyph = glyph_at(x, y);
if (!maybe_kick_monster(mtmp, x, y))
- return g.context.move;
+ return (g.context.move ? ECMD_TIME : ECMD_OK);
}
wake_nearby();
range = 1;
hurtle(-u.dx, -u.dy, range, TRUE);
}
- return 1;
+ return ECMD_TIME;
}
(void) unmap_invisible(x, y);
if (is_pool(x, y) ^ !!u.uinwater) {
/* objects normally can't be removed from water by kicking */
You("splash some %s around.", hliquid("water"));
- return 1;
+ return ECMD_TIME;
}
if (OBJ_AT(x, y) && (!Levitation || Is_airlevel(&u.uz)
if (kick_object(x, y, kickobjnam)) {
if (Is_airlevel(&u.uz))
hurtle(-u.dx, -u.dy, 1, TRUE); /* assume it's light */
- return 1;
+ return ECMD_TIME;
}
goto ouch;
}
if (g.maploc->doormask == D_ISOPEN
|| g.maploc->doormask == D_NODOOR)
unblock_point(x, y); /* vision */
- return 1;
+ return ECMD_TIME;
} else
goto ouch;
}
g.maploc->typ = CORR;
feel_newsym(x, y); /* we know it's gone */
unblock_point(x, y); /* vision */
- return 1;
+ return ECMD_TIME;
} else
goto ouch;
}
newsym(x, y);
}
exercise(A_DEX, TRUE);
- return 1;
+ return ECMD_TIME;
} else if (Luck > 0 && !rn2(3) && !g.maploc->looted) {
(void) mkgold((long) rn1(201, 300), x, y);
i = Luck + 1;
}
/* prevent endless milking */
g.maploc->looted = T_LOOTED;
- return 1;
+ return ECMD_TIME;
} else if (!rn2(4)) {
if (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)) {
fall_through(FALSE, 0);
- return 1;
+ return ECMD_TIME;
} else
goto ouch;
}
if (!rn2(3))
goto ouch;
exercise(A_DEX, TRUE);
- return 1;
+ return ECMD_TIME;
}
if (IS_FOUNTAIN(g.maploc->typ)) {
if (Levitation)
/* could cause short-lived fumbling here */
}
exercise(A_DEX, TRUE);
- return 1;
+ return ECMD_TIME;
}
if (IS_GRAVE(g.maploc->typ)) {
if (Levitation)
pline_The("headstone topples over and breaks!");
newsym(x, y);
}
- return 1;
+ return ECMD_TIME;
}
if (g.maploc->typ == IRONBARS)
goto ouch;
exercise(A_WIS, TRUE); /* discovered a new food source! */
newsym(x, y);
g.maploc->looted |= TREE_LOOTED;
- return 1;
+ return ECMD_TIME;
} else if (!(g.maploc->looted & TREE_SWARM)) {
int cnt = rnl(4) + 2;
int made = 0;
else
You("smell stale honey.");
g.maploc->looted |= TREE_SWARM;
- return 1;
+ return ECMD_TIME;
}
goto ouch;
}
else
pline("Klunk!");
exercise(A_DEX, TRUE);
- return 1;
+ return ECMD_TIME;
} else if (!(g.maploc->looted & S_LPUDDING) && !rn2(3)
&& !(g.mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) {
if (Blind)
exercise(A_DEX, TRUE);
newsym(x, y);
g.maploc->looted |= S_LPUDDING;
- return 1;
+ return ECMD_TIME;
} else if (!(g.maploc->looted & S_LDWASHER) && !rn2(3)
&& !(g.mvitals[PM_AMOROUS_DEMON].mvflags & G_GONE)) {
/* can't resist... */
newsym(x, y);
g.maploc->looted |= S_LDWASHER;
exercise(A_DEX, TRUE);
- return 1;
+ return ECMD_TIME;
} else if (!rn2(3)) {
if (Blind && Deaf)
Sprintf(buf, " %s", body_part(FACE));
exercise(A_WIS, TRUE); /* a discovery! */
g.maploc->looted |= S_LRING;
}
- return 1;
+ return ECMD_TIME;
}
goto ouch;
}
losehp(Maybe_Half_Phys(dmg), kickstr(buf, kickobjnam), KILLED_BY);
if (Is_airlevel(&u.uz) || Levitation)
hurtle(-u.dx, -u.dy, rn1(2, 4), TRUE); /* assume it's heavy */
- return 1;
+ return ECMD_TIME;
}
goto dumb;
}
}
if ((Is_airlevel(&u.uz) || Levitation) && rn2(2))
hurtle(-u.dx, -u.dy, 1, TRUE);
- return 1; /* uses a turn */
+ return ECMD_TIME; /* uses a turn */
}
/* not enough leverage to kick open doors while levitating */
}
}
}
- return 1;
+ return ECMD_TIME;
}
static void
if (obj->o_id == g.context.objsplit.parent_oid
|| obj->o_id == g.context.objsplit.child_oid)
(void) unsplitobj(obj);
- return 0; /* no time passes */
+ return ECMD_OK; /* no time passes */
}
/*
* possibly using a sling.
*/
if (obj->oclass == COIN_CLASS && obj != uquiver)
- return throw_gold(obj);
+ return throw_gold(obj); /* check */
if (!canletgo(obj, "throw")) {
- return 0;
+ return ECMD_OK;
}
if (obj->oartifact == ART_MJOLLNIR && obj != uwep) {
pline("%s must be wielded before it can be thrown.", The(xname(obj)));
- return 0;
+ return ECMD_OK;
}
if ((obj->oartifact == ART_MJOLLNIR && ACURR(A_STR) < STR19(25))
|| (obj->otyp == BOULDER && !throws_rocks(g.youmonst.data))) {
pline("It's too heavy.");
- return 1;
+ return ECMD_TIME;
}
if (!u.dx && !u.dy && !u.dz) {
You("cannot throw an object at yourself.");
- return 0;
+ return ECMD_OK;
}
u_wipe_engr(2);
if (!uarmg && obj->otyp == CORPSE && touch_petrifies(&mons[obj->corpsenm])
}
if (welded(obj)) {
weldmsg(obj);
- return 1;
+ return ECMD_TIME;
}
if (is_wet_towel(obj))
dry_a_towel(obj, -1, FALSE);
g.m_shot.o = STRANGE_OBJECT;
g.m_shot.s = FALSE;
- return 1;
+ return ECMD_TIME;
}
/* common to dothrow() and dofire() */
return GETOBJ_DOWNPLAY;
}
-/* t command - throw */
+/* the #throw command */
int
dothrow(void)
{
* [3.6.0: shot count setup has been moved into ok_to_throw().]
*/
if (!ok_to_throw(&shotlimit))
- return 0;
+ return ECMD_OK;
obj = getobj("throw", throw_ok, GETOBJ_PROMPT | GETOBJ_ALLOWCNT);
/* it is also possible to throw food */
/* (or jewels, or iron balls... ) */
- return obj ? throw_obj(obj, shotlimit) : 0;
+ return obj ? throw_obj(obj, shotlimit) : ECMD_OK;
}
/* KMH -- Automatically fill quiver */
return (struct obj *)0;
}
-/* f command -- fire: throw from the quiver or use wielded polearm */
+/* the #fire command -- throw from the quiver or use wielded polearm */
int
dofire(void)
{
* aborted (ESC at the direction prompt).]
*/
if (!ok_to_throw(&shotlimit))
- return 0;
+ return ECMD_OK;
if ((obj = uquiver) == 0) {
if (!flags.autoquiver) {
swap to it and retry */
cmdq_add_ec(doswapweapon);
cmdq_add_ec(dofire);
- return 0;
+ return ECMD_OK;
} else
You("have no ammunition readied.");
}
/* swap weapons and retry fire */
cmdq_add_ec(doswapweapon);
cmdq_add_ec(dofire);
- return 0;
+ return ECMD_OK;
} else if ((olauncher = find_launcher(obj)) != 0) {
/* wield launcher, retry fire */
if (uwep && !flags.pushweapon)
cmdq_add_ec(dowield);
cmdq_add_key(olauncher->invlet);
cmdq_add_ec(dofire);
- return 0;
+ return ECMD_OK;
}
}
- return obj ? throw_obj(obj, shotlimit) : 0;
+ return obj ? throw_obj(obj, shotlimit) : ECMD_OK;
}
/* if in midst of multishot shooting/throwing, stop early */
if (obj->o_id == g.context.objsplit.parent_oid
|| obj->o_id == g.context.objsplit.child_oid)
(void) unsplitobj(obj);
- return 0;
+ return ECMD_OK;
}
freeinv(obj);
if (u.uswallow) {
: "%s into %s.",
"The gold disappears", mon_nam(u.ustuck));
add_to_minv(u.ustuck, obj);
- return 1;
+ return ECMD_TIME;
}
if (u.dz) {
(int (*)(MONST_P, OBJ_P)) 0,
(int (*)(OBJ_P, OBJ_P)) 0, &obj);
if (!obj)
- return 1; /* object is gone */
+ return ECMD_TIME; /* object is gone */
if (mon) {
if (ghitm(mon, obj)) /* was it caught? */
- return 1;
+ return ECMD_TIME;
} else {
if (ship_object(obj, g.bhitpos.x, g.bhitpos.y, FALSE))
- return 1;
+ return ECMD_TIME;
}
}
}
if (flooreffects(obj, g.bhitpos.x, g.bhitpos.y, "fall"))
- return 1;
+ return ECMD_TIME;
if (u.dz > 0)
pline_The("gold hits the %s.", surface(g.bhitpos.x, g.bhitpos.y));
place_object(obj, g.bhitpos.x, g.bhitpos.y);
sellobj(obj, g.bhitpos.x, g.bhitpos.y);
stackobj(obj);
newsym(g.bhitpos.x, g.bhitpos.y);
- return 1;
+ return ECMD_TIME;
}
/*dothrow.c*/
char nbuf[BUFSZ]; /* Buffer for response */
if (!(mptr = find_mapseen(&u.uz)))
- return 0;
+ return ECMD_OK;
nbuf[0] = '\0';
#ifdef EDIT_GETLIN
/* empty input or ESC means don't add or change annotation;
space-only means discard current annotation without adding new one */
if (!*nbuf || *nbuf == '\033')
- return 0;
+ return ECMD_OK;
/* strip leading and trailing spaces, compress out consecutive spaces */
(void) mungspaces(nbuf);
mptr->custom = dupstr(nbuf);
mptr->custom_lth = strlen(mptr->custom);
}
- return 0;
+ return ECMD_OK;
}
/* find the particular mapseen object in the chain; may return null */
dooverview(void)
{
show_overview(0, 0);
- return 0;
+ return ECMD_OK;
}
/* called for #overview or for end of game disclosure */
return 0;
}
-/* 'e' command */
+/* the #eat command */
int
doeat(void)
{
if (Strangled) {
pline("If you can't breathe air, how can you consume solids?");
- return 0;
+ return ECMD_OK;
}
if (!(otmp = floorfood("eat", 0)))
- return 0;
+ return ECMD_OK;
if (check_capacity((char *) 0))
- return 0;
+ return ECMD_OK;
if (u.uedibility) {
int res = edibility_prompts(otmp);
body_part(NOSE));
u.uedibility = 0;
if (res == 1)
- return 0;
+ return ECMD_OK;
}
}
bars so wouldn't know that more turns of eating are required */
You("pause to swallow.");
}
- return 1;
+ return ECMD_TIME;
}
/* We have to make non-foods take 1 move to eat, unless we want to
* do ridiculous amounts of coding to deal with partly eaten plate
*/
if (!is_edible(otmp)) {
You("cannot eat that!");
- return 0;
+ return ECMD_OK;
} else if ((otmp->owornmask & (W_ARMOR | W_TOOL | W_AMUL | W_SADDLE))
!= 0) {
/* let them eat rings */
You_cant("eat %s you're wearing.", something);
- return 0;
+ return ECMD_OK;
} else if (!(carried(otmp) ? retouch_object(&otmp, FALSE)
: touch_artifact(otmp, &g.youmonst))) {
- return 1; /* got blasted so use a turn */
+ return ECMD_TIME; /* got blasted so use a turn */
}
if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER
&& otmp->oerodeproof) {
}
stackobj(otmp);
}
- return 1;
+ return ECMD_TIME;
}
/* KMH -- Slow digestion is... indigestible */
if (otmp->otyp == RIN_SLOW_DIGESTION) {
if (otmp->dknown && !objects[otmp->otyp].oc_name_known
&& !objects[otmp->otyp].oc_uname)
docall(otmp);
- return 1;
+ return ECMD_TIME;
}
if (otmp->oclass != FOOD_CLASS) {
int material;
: singular(otmp, xname));
}
eatspecial();
- return 1;
+ return ECMD_TIME;
}
if (otmp == g.context.victual.piece) {
You("%s your meal.",
!one_bite_left ? "resume" : "consume the last bite of");
start_eating(g.context.victual.piece, FALSE);
- return 1;
+ return ECMD_TIME;
}
/* nothing in progress - so try to find something. */
/* tins must also check conduct separately in case they're discarded */
if (otmp->otyp == TIN) {
start_tin(otmp);
- return 1;
+ return ECMD_TIME;
}
/* KMH, conduct */
/* used up */
g.context.victual.piece = (struct obj *) 0;
g.context.victual.o_id = 0;
- return 1;
+ return ECMD_TIME;
} else if (tmp)
dont_start = TRUE;
/* if not used up, eatcorpse sets up reqtime and may modify oeaten */
if (!dont_start)
start_eating(otmp, already_partly_eaten);
- return 1;
+ return ECMD_TIME;
}
/* getobj callback for object to be opened with a tin opener */
use_tin_opener(struct obj *obj)
{
struct obj *otmp;
- int res = 0;
+ int res = ECMD_OK;
if (!carrying(TIN)) {
You("have no tin to open.");
- return 0;
+ return ECMD_OK;
}
if (obj != uwep) {
if (ynq(safe_qbuf(qbuf, "Really wield ", "?",
obj, doname, thesimpleoname, "that")) != 'y')
- return 0;
+ return ECMD_OK;
}
if (!wield_tool(obj, "use"))
- return 0;
- res = 1;
+ return ECMD_OK;
+ res = ECMD_TIME;
}
otmp = getobj("open", tinopen_ok, GETOBJ_NOFLAGS);
return res;
start_tin(otmp);
- return 1;
+ return ECMD_TIME;
}
/* Take a single bite from a piece of food, checking for choking and
u.uinvulnerable = FALSE; /* avoid ctrl-C bug -dlc */
u.usleep = 0;
}
- return 0;
+ return ECMD_OK;
}
#if (defined(UNIX) || defined(VMS) || defined(LATTICE))
if (wizard) {
#ifndef LINT
done(QUIT);
#endif
- return 0;
+ return ECMD_OK;
}
#ifndef NO_SIGNAL
* moonstone - 6 (orthoclase) * amber - 2-2.5
*/
-/* return 1 if action took 1 (or more) moves, 0 if error or aborted */
+/* the #engrave command */
int
doengrave(void)
{
/* Can the adventurer engrave at all? */
if (!u_can_engrave())
- return 0;
+ return ECMD_OK;
jello = (u.uswallow && !(is_animal(u.ustuck->data)
|| is_whirly(u.ustuck->data)));
otmp = getobj("write with", stylus_ok, GETOBJ_PROMPT);
if (!otmp) /* otmp == cg.zeroobj if fingers */
- return 0;
+ return ECMD_OK;
if (otmp == &cg.zeroobj) {
Strcat(strcpy(fbuf, "your "), body_part(FINGERTIP));
*/
if (!freehand() && otmp != uwep && !otmp->owornmask) {
You("have no free %s to write with!", body_part(HAND));
- return 0;
+ return ECMD_OK;
}
if (jello) {
You("tickle %s with %s.", mon_nam(u.ustuck), writer);
Your("message dissolves...");
- return 0;
+ return ECMD_OK;
}
if (otmp->oclass != WAND_CLASS && !can_reach_floor(TRUE)) {
cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
- return 0;
+ return ECMD_OK;
}
if (IS_ALTAR(levl[u.ux][u.uy].typ)) {
You("make a motion towards the altar with %s.", writer);
altar_wrath(u.ux, u.uy);
- return 0;
+ return ECMD_OK;
}
if (IS_GRAVE(levl[u.ux][u.uy].typ)) {
if (otmp == &cg.zeroobj) { /* using only finger */
You("would only make a small smudge on the %s.",
surface(u.ux, u.uy));
- return 0;
+ return ECMD_OK;
} else if (!levl[u.ux][u.uy].disturbed) {
You("disturb the undead!");
levl[u.ux][u.uy].disturbed = 1;
(void) makemon(&mons[PM_GHOUL], u.ux, u.uy, NO_MM_FLAGS);
exercise(A_WIS, FALSE);
- return 1;
+ return ECMD_TIME;
}
}
check_unpaid(otmp);
if (otmp->cursed && !rn2(WAND_BACKFIRE_CHANCE)) {
wand_explode(otmp, 0);
- return 1;
+ return ECMD_TIME;
}
zapwand = TRUE;
if (!can_reach_floor(TRUE))
if (otmp == ublindf) {
pline(
"That is a bit difficult to engrave with, don't you think?");
- return 0;
+ return ECMD_OK;
}
switch (otmp->otyp) {
case MAGIC_MARKER:
if (!ptext) {
if (otmp && otmp->oclass == WAND_CLASS && !can_reach_floor(TRUE))
cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
- return 1;
+ return ECMD_TIME;
}
/*
* Special effects should have deleted the current engraving (if
ynqchars, 'y');
if (c == 'q') {
pline1(Never_mind);
- return 0;
+ return ECMD_OK;
}
}
? (is_ice(u.ux, u.uy) ? "melted into" : "burned into")
: "engraved in",
surface(u.ux, u.uy));
- return 1;
+ return ECMD_TIME;
} else if (type != oep->engr_type || c == 'n') {
if (!Blind || can_reach_floor(TRUE))
You("will overwrite the current message.");
}
} else if (oep && (int) strlen(oep->engr_txt) >= BUFSZ - 1) {
There("is no room to add anything else here.");
- return 1;
+ return ECMD_TIME;
}
}
if (!Blind)
pline("%s, then %s.", Tobjnam(otmp, "glow"),
otense(otmp, "fade"));
- return 1;
+ return ECMD_TIME;
} else {
pline1(Never_mind);
- return 0;
+ return ECMD_OK;
}
}
/* Engraving will always take at least one action via being run as an
* occupation, so do not count this setup as taking time. */
- return 0;
+ return ECMD_OK;
}
/* occupation callback for engraving some text */
if (flags.autoopen && !g.context.run
&& !Confusion && !Stunned && !Fumbling) {
g.context.door_opened
- = g.context.move = doopen_indir(x, y);
+ = g.context.move = (doopen_indir(x, y) == ECMD_TIME ? 1 : 0);
} else if (x == ux || y == uy) {
if (Blind || Stunned || ACURR(A_DEX) < 10
|| Fumbling) {
return -1; /* can do normal pickup */
}
-/* the ',' command */
+/* the #pickup command */
int
dopickup(void)
{
g.multi = 0; /* always reset */
if ((ret = pickup_checks()) >= 0) {
- return ret;
+ return (ret ? ECMD_TIME : ECMD_OK);
} else if (ret == -2) {
tmpcount = -count;
- return loot_mon(u.ustuck, &tmpcount, (boolean *) 0);
+ return (loot_mon(u.ustuck, &tmpcount, (boolean *) 0) ? ECMD_TIME : ECMD_OK);
} /* else ret == -1 */
- return pickup(-count);
+ return (pickup(-count) ? ECMD_TIME : ECMD_OK);
}
/* stop running if we see something interesting next to us */
mode |= MAGICENLIGHTENMENT;
enlightenment(mode, ENL_GAMEINPROGRESS);
- return 0;
+ return ECMD_OK;
}
void
doconduct(void)
{
show_conduct(0);
- return 0;
+ return ECMD_OK;
}
/* display conducts; for doconduct(), also disclose() and dump_everything() */
dovanquished(void)
{
list_vanquished('a', FALSE);
- return 0;
+ return ECMD_OK;
}
DISABLE_WARNING_FORMAT_NONLITERAL
display_nhwindow(datawin, FALSE);
destroy_nhwindow(datawin);
- return 0;
+ return ECMD_OK;
}
RESTORE_WARNING_FORMAT_NONLITERAL
(*windowprocs.win_update_inventory)(0);
}
-/* '|' command - call interface's persistent inventory manipulation routine */
+/* the #perminv command - call interface's persistent inventory routine */
int
doperminv(void)
{
} /* iflags.perm_invent */
- return 0;
+ return ECMD_OK;
}
/* should of course only be called for things in invent */
RESTORE_WARNING_FORMAT_NONLITERAL
-/* the 'i' command */
+/* the #inventory command */
int
ddoinv(void)
{
(void) display_inventory((char *) 0, FALSE);
- return 0;
+ return ECMD_OK;
}
/*
return res;
}
-/* the 'I' command */
+/* the #inventtype command */
int
dotypeinv(void)
{
if (!g.invent && !billx) {
You("aren't carrying anything.");
- return 0;
+ return ECMD_OK;
}
unpaid_count = count_unpaid(g.invent);
tally_BUCX(g.invent, FALSE, &bcnt, &ucnt, &ccnt, &xcnt, &ocnt, &jcnt);
i |= INCLUDE_VENOM;
n = query_category(prompt, g.invent, i, &pick_list, PICK_ONE);
if (!n)
- return 0;
+ return ECMD_OK;
g.this_type = c = pick_list[0].item.a_int;
free((genericptr_t) pick_list);
}
savech(c);
if (c == '\0') {
clear_nhwindow(WIN_MESSAGE);
- return 0;
+ return ECMD_OK;
}
} else {
/* only one thing to itemize */
else
pline("No used-up objects%s.",
unpaid_count ? " on your shopping bill" : "");
- return 0;
+ return ECMD_OK;
}
if (c == 'u' || (c == 'U' && unpaid_count && !ucnt)) {
if (unpaid_count)
dounpaid();
else
You("are not carrying any unpaid objects.");
- return 0;
+ return ECMD_OK;
}
if (traditional) {
if (index("BUCXP", c))
break;
}
You("have no %sobjects%s.", before, after);
- return 0;
+ return ECMD_OK;
}
g.this_type = oclass;
}
| INVORDER_SORT | INCLUDE_VENOM),
&pick_list, PICK_NONE, this_type_only) > 0)
free((genericptr_t) pick_list);
- return 0;
+ return ECMD_OK;
}
/* return a string describing the dungeon feature at <x,y> if there
} else {
You("%s no objects here.", verb);
}
- return !!Blind;
+ return (!!Blind ? ECMD_TIME : ECMD_OK);
}
if (!skip_objects && (trap = t_at(u.ux, u.uy)) && trap->tseen)
There("is %s here.", an(trapname(trap->ttyp, FALSE)));
trap = t_at(u.ux, u.uy);
if (!can_reach_floor(trap && is_pit(trap->ttyp))) {
pline("But you can't reach it!");
- return 0;
+ return ECMD_OK;
}
}
read_engr_at(u.ux, u.uy); /* Eric Backus */
if (!skip_objects && (Blind || !dfeature))
You("%s no objects here.", verb);
- return !!Blind;
+ return (!!Blind ? ECMD_TIME : ECMD_OK);
}
/* we know there is something here */
feel_cockatrice(otmp, FALSE);
read_engr_at(u.ux, u.uy); /* Eric Backus */
}
- return !!Blind;
+ return (!!Blind ? ECMD_TIME : ECMD_OK);
}
-/* the ':' command - explicitly look at what is here, including all objects */
+/* #look command - explicitly look at what is here, including all objects */
int
dolook(void)
{
return FALSE;
}
-/* the '$' command */
+/* the #showgold command */
int
doprgold(void)
{
else
Your("wallet contains %ld %s.", umoney, currency(umoney));
shopper_financial_report();
- return 0;
+ return ECMD_OK;
}
-/* the ')' command */
+/* the #seeweapon command */
int
doprwep(void)
{
if (u.twoweap)
prinv((char *) 0, uswapwep, 0L);
}
- return 0;
+ return ECMD_OK;
}
/* caller is responsible for checking !wearing_armor() */
}
}
-/* the '[' command */
+/* the #seearmor command */
int
doprarm(void)
{
lets[ct] = 0;
(void) display_inventory(lets, FALSE);
}
- return 0;
+ return ECMD_OK;
}
-/* the '=' command */
+/* the #seerings command */
int
doprring(void)
{
lets[ct] = 0;
(void) display_inventory(lets, FALSE);
}
- return 0;
+ return ECMD_OK;
}
-/* the '"' command */
+/* the #seeamulet command */
int
dopramulet(void)
{
You("are not wearing an amulet.");
else
prinv((char *) 0, uamul, 0L);
- return 0;
+ return ECMD_OK;
}
/* is 'obj' a tool that's in use? can't simply check obj->owornmask */
|| (obj->otyp == LEASH && obj->leashmon));
}
-/* the '(' command */
+/* the #seetools command */
int
doprtool(void)
{
You("are not using any tools.");
else
(void) display_inventory(lets, FALSE);
- return 0;
+ return ECMD_OK;
}
-/* '*' command; combines the ')' + '[' + '=' + '"' + '(' commands;
+/* the #seeall command; combines the ')' + '[' + '=' + '"' + '(' commands;
show inventory of all currently wielded, worn, or used objects */
int
doprinuse(void)
You("are not wearing or wielding anything.");
else
(void) display_inventory(lets, FALSE);
- return 0;
+ return ECMD_OK;
}
/*
&& g.invent->invlet == GOLD_SYM && !g.invent->nobj)) {
You("aren't carrying anything %s.",
!g.invent ? "to adjust" : "adjustable");
- return 0;
+ return ECMD_OK;
}
if (!flags.invlet_constant)
/* get object the user wants to organize (the 'from' slot) */
obj = getobj("adjust", adjust_filter, GETOBJ_PROMPT | GETOBJ_ALLOWCNT);
if (!obj)
- return 0;
+ return ECMD_OK;
/* can only be gold if check_invent_gold() found a problem: multiple '$'
stacks and/or gold in some other slot, otherwise (*adjust_filter)()
won't allow gold to be picked; if player has picked any stack of gold
(void) merged(&splitting, &obj);
if (!ever_mind)
pline1(Never_mind);
- return 0;
+ return ECMD_OK;
} else if (let == GOLD_SYM && obj->oclass != COIN_CLASS) {
pline("Only gold coins may be moved into the '%c' slot.",
GOLD_SYM);
(void) merged(&splitting, &obj); /* undo split */
/* "knapsack cannot accommodate any more items" */
Your("pack is too full.");
- return 0;
+ return ECMD_OK;
} else {
bumped = otmp;
extract_nobj(bumped, &g.invent);
if (splitting)
clear_splitobjs(); /* reset splitobj context */
update_inventory();
- return 0;
+ return ECMD_OK;
}
/* common to display_minventory and display_cinventory */
return "strangely";
}
+/* the #lightsources command */
int
wiz_light_sources(void)
{
win = create_nhwindow(NHW_MENU); /* corner text window */
if (win == WIN_ERR)
- return 0;
+ return ECMD_OK;
Sprintf(buf, "Mobile light sources: hero @ (%2d,%2d)", u.ux, u.uy);
putstr(win, 0, buf);
display_nhwindow(win, FALSE);
destroy_nhwindow(win);
- return 0;
+ return ECMD_OK;
}
/*light.c*/
return PICKLOCK_DID_SOMETHING;
}
-/* try to force a chest with your weapon */
+/* the #force command - try to force a chest with your weapon */
int
doforce(void)
{
if (u.uswallow) {
You_cant("force anything from inside here.");
- return 0;
+ return ECMD_OK;
}
if (!uwep /* proper type test */
|| ((uwep->oclass == WEAPON_CLASS || is_weptool(uwep))
: (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))
? "without a proper"
: "with that");
- return 0;
+ return ECMD_OK;
}
if (!can_reach_floor(TRUE)) {
cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
- return 0;
+ return ECMD_OK;
}
picktyp = is_blade(uwep) && !is_pick(uwep);
if (g.xlock.usedtime && g.xlock.box && picktyp == g.xlock.picktyp) {
You("resume your attempt to force the lock.");
set_occupation(forcelock, "forcing the lock", 0);
- return 1;
+ return ECMD_TIME;
}
/* A lock is made only for the honest man, the thief will break it. */
c = ynq(qbuf);
if (c == 'q')
- return 0;
+ return ECMD_OK;
if (c == 'n')
continue;
set_occupation(forcelock, "forcing the lock", 0);
else
You("decide not to force the issue.");
- return 1;
+ return ECMD_TIME;
}
boolean
return FALSE;
}
-/* the 'O' command - try to open a door */
+/* the #open command - try to open a door */
int
doopen(void)
{
coord cc;
register struct rm *door;
boolean portcullis;
- int res = 0;
+ int res = ECMD_OK;
if (nohands(g.youmonst.data)) {
You_cant("open anything -- you have no hands!");
- return 0;
+ return ECMD_OK;
}
if (u.utrap && u.utraptype == TT_PIT) {
You_cant("reach over the edge of the pit.");
- return 0;
+ return ECMD_OK;
}
if (x > 0 && y > 0) {
cc.x = x;
cc.y = y;
} else if (!get_adjacent_loc((char *) 0, (char *) 0, u.ux, u.uy, &cc))
- return 0;
+ return ECMD_OK;
/* open at yourself/up/down */
if ((cc.x == u.ux) && (cc.y == u.uy))
return doloot();
if (stumble_on_door_mimic(cc.x, cc.y))
- return 1;
+ return ECMD_TIME;
/* when choosing a direction is impaired, use a turn
regardless of whether a door is successfully targetted */
if (Confusion || Stunned)
- res = 1;
+ res = ECMD_TIME;
door = &levl[cc.x][cc.y];
portcullis = (is_drawbridge_wall(cc.x, cc.y) >= 0);
feel_location(cc.x, cc.y);
if (door->glyph != oldglyph
|| g.lastseentyp[cc.x][cc.y] != oldlastseentyp)
- res = 1; /* learned something */
+ res = ECMD_TIME; /* learned something */
}
if (portcullis || !IS_DOOR(door->typ)) {
}
pline("This door%s.", mesg);
if (locked && flags.autounlock && (unlocktool = autokey(TRUE)) != 0) {
- res = pick_lock(unlocktool, cc.x, cc.y, (struct obj *) 0);
+ res = pick_lock(unlocktool, cc.x, cc.y, (struct obj *) 0) ? ECMD_TIME : ECMD_OK;
}
return res;
}
pline_The("door resists!");
}
- return 1;
+ return ECMD_TIME;
}
static boolean
return FALSE;
}
-/* the 'C' command - try to close a door */
+/* the #close command - try to close a door */
int
doclose(void)
{
register int x, y;
register struct rm *door;
boolean portcullis;
- int res = 0;
+ int res = ECMD_OK;
if (nohands(g.youmonst.data)) {
You_cant("close anything -- you have no hands!");
- return 0;
+ return ECMD_OK;
}
if (u.utrap && u.utraptype == TT_PIT) {
You_cant("reach over the edge of the pit.");
- return 0;
+ return ECMD_OK;
}
if (!getdir((char *) 0))
- return 0;
+ return ECMD_OK;
x = u.ux + u.dx;
y = u.uy + u.dy;
if ((x == u.ux) && (y == u.uy)) {
You("are in the way!");
- return 1;
+ return ECMD_TIME;
}
if (!isok(x, y))
goto nodoor;
if (stumble_on_door_mimic(x, y))
- return 1;
+ return ECMD_TIME;
/* when choosing a direction is impaired, use a turn
regardless of whether a door is successfully targetted */
if (Confusion || Stunned)
- res = 1;
+ res = ECMD_TIME;
door = &levl[x][y];
portcullis = (is_drawbridge_wall(x, y) >= 0);
feel_location(x, y);
if (door->glyph != oldglyph || g.lastseentyp[x][y] != oldlastseentyp)
- res = 1; /* learned something */
+ res = ECMD_TIME; /* learned something */
}
if (portcullis || !IS_DOOR(door->typ)) {
}
}
- return 1;
+ return ECMD_TIME;
}
/* box obj was hit with spell or wand effect otmp;
if (Underwater) {
You_cant("play music underwater!");
- return 0;
+ return ECMD_OK;
} else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE
|| instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN
|| instr->otyp == FIRE_HORN || instr->otyp == BUGLE)
&& !can_blow(&g.youmonst)) {
You("are incapable of playing %s.", the(distant_name(instr, xname)));
- return 0;
+ return ECMD_OK;
}
if (instr->otyp != LEATHER_DRUM && instr->otyp != DRUM_OF_EARTHQUAKE
&& !(Stunned || Confusion || Hallucination)) {
close_drawbridge(x, y);
else
open_drawbridge(x, y);
- return 1;
+ return ECMD_TIME;
}
} else if (!Deaf) {
if (u.uevent.uheard_tune < 1)
}
}
}
- return 1;
+ return ECMD_TIME;
} else
- return do_improvisation(instr);
+ return do_improvisation(instr) ? ECMD_TIME : ECMD_OK;
nevermind:
pline1(Never_mind);
- return 0;
+ return ECMD_OK;
}
/*music.c*/
return n;
}
-/* the '\' command - show discovered object types */
+/* the #known command - show discovered object types */
int
dodiscovered(void) /* free after Robert Viduya */
{
if (iflags.menu_requested) {
if (choose_disco_sort(1) < 0)
- return 0;
+ return ECMD_OK;
}
alphabyclass = (flags.discosort == 'c');
alphabetized = (flags.discosort == 'a' || alphabyclass);
}
destroy_nhwindow(tmpwin);
- return 0;
+ return ECMD_OK;
}
/* lower case let_to_name() output, which differs from def_oc_syms[].name */
return buf;
}
-/* the '`' command - show discovered object types for one class */
+/* the #knownclass command - show discovered object types for one class */
int
doclassdisco(void)
{
if (iflags.menu_requested) {
if (choose_disco_sort(2) < 0)
- return 0;
+ return ECMD_OK;
}
alphabetized = (flags.discosort == 'a' || flags.discosort == 'c');
lootsort = (flags.discosort == 's');
You(havent_discovered_any, "items");
if (tmpwin != WIN_ERR)
destroy_nhwindow(tmpwin);
- return 0;
+ return ECMD_OK;
}
/* have player choose a class */
destroy_nhwindow(tmpwin);
}
if (!c)
- return 0; /* player declined to make a selection */
+ return ECMD_OK; /* player declined to make a selection */
/*
* show discoveries for object class c
if (ct)
display_nhwindow(tmpwin, TRUE);
destroy_nhwindow(tmpwin);
- return 0;
+ return ECMD_OK;
}
/* put up nameable subset of discoveries list as a menu */
return longest_name_len;
}
-/* the 'O' command */
+/* the #options command */
int
doset(void) /* changing options via menu by Per Liboriussen */
{
if (g.context.botl || g.context.botlx) {
bot();
}
- return 0;
+ return ECMD_OK;
}
/* doset('O' command) menu entries for compound options */
Strcpy(buf, "OFF");
}
pline("Autopickup: %s.", buf);
- return 0;
+ return ECMD_OK;
}
int
switch (i) {
default:
case 'q':
- return 0;
+ return ECMD_OK;
case 'y':
case '/':
from_screen = TRUE;
invlet = display_inventory((const char *) 0, TRUE);
if (!invlet || invlet == '\033')
- return 0;
+ return ECMD_OK;
*out_str = '\0';
for (invobj = g.invent; invobj; invobj = invobj->nobj)
if (invobj->invlet == invlet) {
}
if (*out_str)
checkfile(out_str, pm, TRUE, TRUE, (char *) 0);
- return 0;
+ return ECMD_OK;
}
case '?':
from_screen = FALSE;
condense consecutive internal whitespace */
mungspaces(out_str);
if (out_str[0] == '\0' || out_str[0] == '\033')
- return 0;
+ return ECMD_OK;
if (out_str[1]) { /* user typed in a complete string */
checkfile(out_str, pm, TRUE, TRUE, (char *) 0);
- return 0;
+ return ECMD_OK;
}
sym = out_str[0];
break;
case 'm':
look_all(TRUE, TRUE); /* list nearby monsters */
- return 0;
+ return ECMD_OK;
case 'M':
look_all(FALSE, TRUE); /* list all monsters */
- return 0;
+ return ECMD_OK;
case 'o':
look_all(TRUE, FALSE); /* list nearby objects */
- return 0;
+ return ECMD_OK;
case 'O':
look_all(FALSE, FALSE); /* list all objects */
- return 0;
+ return ECMD_OK;
case '^':
look_traps(TRUE); /* list nearby traps */
- return 0;
+ return ECMD_OK;
case '\"':
look_traps(FALSE); /* list all traps (visible or remembered) */
- return 0;
+ return ECMD_OK;
}
} else { /* clicklook */
cc.x = click_cc->x;
} while (from_screen && !quick && ans != LOOK_ONCE && !clicklook);
flags.verbose = save_verbose;
- return 0;
+ return ECMD_OK;
}
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after do_supplemental_info() */
RESTORE_WARNING_FORMAT_NONLITERAL
-/* the '/' command */
+/* the #whatis command */
int
dowhatis(void)
{
return do_look(0, (coord *) 0);
}
-/* the ';' command */
+/* the #glance command */
int
doquickwhatis(void)
{
return do_look(1, (coord *) 0);
}
-/* the '^' command */
+/* the #showtrap command */
int
doidtrap(void)
{
int x, y, tt, glyph;
if (!getdir("^"))
- return 0;
+ return ECMD_OK;
x = u.ux + u.dx;
y = u.uy + u.dy;
if (chesttrap || trapped_door_at(tt, x, y)) {
pline("That is a trapped %s.", chesttrap ? "chest" : "door");
- return 0; /* trap ID'd, but no time elapses */
+ return ECMD_OK; /* trap ID'd, but no time elapses */
}
}
? " dug"
: " set",
!trap->madeby_u ? "" : " by you");
- return 0;
+ return ECMD_OK;
}
pline("I can't see a trap there.");
- return 0;
+ return ECMD_OK;
}
/*
#endif /* 0 */
}
+/* the whatdoes command */
int
dowhatdoes(void)
{
pline("No such command '%s', char code %d (0%03o or 0x%02x).",
visctrl(q), (uchar) q, (uchar) q, (uchar) q);
}
- return 0;
+ return ECMD_OK;
}
static void
DISABLE_WARNING_FORMAT_NONLITERAL
-/* the '?' command */
+/* the #help command */
int
dohelp(void)
{
free((genericptr_t) selected);
(void) (*help_menu_items[sel].f)();
}
- return 0;
+ return ECMD_OK;
}
RESTORE_WARNING_FORMAT_NONLITERAL
dohistory(void)
{
display_file(HISTORY, TRUE);
- return 0;
+ return ECMD_OK;
}
/*pager.c*/
struct obj *cobj = *cobjp;
if (!cobj)
- return 0;
+ return ECMD_OK;
if (cobj->olocked) {
struct obj *unlocktool;
/* pass ox and oy to avoid direction prompt */
return (pick_lock(unlocktool, cobj->ox, cobj->oy, cobj) != 0);
}
- return 0;
+ return ECMD_OK;
}
cobj->lknown = 1; /* floor container, so no need for update_inventory() */
losehp(Maybe_Half_Phys(tmp), "carnivorous bag", KILLED_BY_AN);
makeknown(BAG_OF_TRICKS);
g.abort_looting = TRUE;
- return 1;
+ return ECMD_TIME;
}
You("%sopen %s...", (!cobj->cknown || !cobj->lknown) ? "carefully " : "",
if (check_capacity((char *) 0)) {
/* "Can't do that while carrying so much stuff." */
- return 0;
+ return ECMD_OK;
}
if (nohands(g.youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */
- return 0;
+ return ECMD_OK;
}
if (Confusion) {
if (rn2(6) && reverse_loot())
- return 1;
+ return ECMD_TIME;
if (rn2(2)) {
pline("Being confused, you find nothing to loot.");
- return 1; /* costs a turn */
+ return ECMD_TIME; /* costs a turn */
} /* else fallthrough to normal looting */
}
cc.x = u.ux;
boolean anyfound = FALSE;
if (!able_to_loot(cc.x, cc.y, TRUE))
- return 0;
+ return ECMD_OK;
if (Blind && !uarmg) {
/* if blind and without gloves, attempting to #loot at the
feel_cockatrice(nobj, FALSE);
/* if life-saved (or poly'd into stone golem),
terminate attempt to loot */
- return 1;
+ return ECMD_TIME;
}
}
if (g.abort_looting) {
/* chest trap or magic bag explosion or <esc> */
free((genericptr_t) pick_list);
- return timepassed;
+ return (timepassed ? ECMD_TIME : ECMD_OK);
}
}
free((genericptr_t) pick_list);
cobj, doname, ansimpleoname,
"a container"));
if (c == 'q')
- return timepassed;
+ return (timepassed ? ECMD_TIME : ECMD_OK);
if (c == 'n')
continue;
anyfound = TRUE;
timepassed |= do_loot_cont(&cobj, 1, 1);
if (g.abort_looting)
/* chest trap or magic bag explosion or <esc> */
- return timepassed;
+ return (timepassed ? ECMD_TIME : ECMD_OK);
}
}
if (anyfound)
if (c != 'y' && mon_beside(u.ux, u.uy)) {
if (!get_adjacent_loc("Loot in what direction?",
"Invalid loot location", u.ux, u.uy, &cc))
- return 0;
+ return ECMD_OK;
if (cc.x == u.ux && cc.y == u.uy) {
underfoot = TRUE;
if (container_at(cc.x, cc.y, FALSE))
You("%s to loot on the %s.", dont_find_anything,
ceiling(cc.x, cc.y));
timepassed = 1;
- return timepassed;
+ return (timepassed ? ECMD_TIME : ECMD_OK);
}
mtmp = m_at(cc.x, cc.y);
if (mtmp)
if (mtmp) {
You_cant("loot anything %sthere with %s in the way.",
prev_inquiry ? "else " : "", mon_nam(mtmp));
- return timepassed;
+ return (timepassed ? ECMD_TIME : ECMD_OK);
} else {
You("have to be at a container to loot it.");
}
} else {
You("%s %sthere to loot.", dont_find_anything,
(prev_inquiry || prev_loot) ? "else " : "");
- return timepassed;
+ return (timepassed ? ECMD_TIME : ECMD_OK);
}
}
} else if (c != 'y' && c != 'n') {
You("%s %s to loot.", dont_find_anything,
underfoot ? "here" : "there");
}
- return timepassed;
+ return (timepassed ? ECMD_TIME : ECMD_OK);
}
/* called when attempting to #loot while confused */
boolean quantum_cat, cursed_mbag, loot_out, loot_in, loot_in_first,
stash_one, inokay, outokay, outmaybe;
char c, emptymsg[BUFSZ], qbuf[QBUFSZ], pbuf[QBUFSZ], xbuf[QBUFSZ];
- int used = 0;
+ int used = ECMD_OK;
long loss;
g.abort_looting = FALSE;
emptymsg[0] = '\0';
if (!u_handsy())
- return 0;
+ return ECMD_OK;
if (!obj->lknown) { /* do this in advance */
obj->lknown = 1;
pline("%s locked.", Tobjnam(obj, "are"));
if (held)
You("must put it down to unlock.");
- return 0;
+ return ECMD_OK;
} else if (obj->otrapped) {
if (held)
You("open %s...", the(xname(obj)));
g.nomovemsg = "";
}
g.abort_looting = TRUE;
- return 1;
+ return ECMD_TIME;
}
g.current_container = obj; /* for use by in/out_container */
quantum_cat = SchroedingersBox(g.current_container);
if (quantum_cat) {
observe_quantum_cat(g.current_container, TRUE, TRUE);
- used = 1;
+ used = ECMD_TIME;
}
cursed_mbag = Is_mbag(g.current_container)
&& Has_contents(g.current_container);
if (cursed_mbag
&& (loss = boh_loss(g.current_container, held)) != 0) {
- used = 1;
+ used = ECMD_TIME;
You("owe %ld %s for lost merchandise.", loss, currency(loss));
g.current_container->owt = weight(g.current_container);
}
} else {
c = in_or_out_menu(qbuf, g.current_container,
outmaybe, inokay,
- (boolean) (used != 0), more_containers);
+ (boolean) (used != ECMD_OK), more_containers);
}
} else { /* TRADITIONAL or COMBINATION */
xbuf[0] = '\0'; /* list of extra acceptable responses */
explain_container_prompt(more_containers);
} else if (c == ':') { /* note: will set obj->cknown */
if (!g.current_container->cknown)
- used = 1; /* gaining info */
+ used = ECMD_TIME; /* gaining info */
container_contents(g.current_container, FALSE, FALSE, TRUE);
} else
break;
if (!Has_contents(g.current_container)) {
pline1(emptymsg); /* <whatever> is empty. */
if (!g.current_container->cknown)
- used = 1;
+ used = ECMD_TIME;
g.current_container->cknown = 1;
} else {
add_valid_menu_class(0); /* reset */
char selection[MAXOCLASSES + 10]; /* +10: room for B,U,C,X plus slop */
const char *action;
boolean one_by_one, allflag;
- int used = 0, menu_on_request = 0;
+ int used = ECMD_OK, menu_on_request = 0;
if (put_in) {
action = "put in";
FALSE, &menu_on_request)) {
if (askchain(objlist, (one_by_one ? (char *) 0 : selection), allflag,
actionfunc, checkfunc, 0, action))
- used = 1;
+ used = ECMD_TIME;
} else if (menu_on_request < 0) {
used = (menu_loot(menu_on_request, put_in) > 0);
}
n = query_category(buf, put_in ? g.invent : g.current_container->cobj,
mflags, &pick_list, PICK_ANY);
if (!n)
- return 0;
+ return ECMD_OK;
for (i = 0; i < n; i++) {
if (pick_list[i].item.a_int == 'A') {
loot_everything = autopick = TRUE;
free((genericptr_t) pick_list);
}
}
- return n_looted;
+ return n_looted ? ECMD_TIME : ECMD_OK;
}
static char
free((genericptr_t) pick_list);
if (otmp && otmp != &dummyobj) {
tipcontainer(otmp);
- return 1;
+ return ECMD_TIME;
}
if (n == -1)
- return 0;
+ return ECMD_OK;
/* else pick-from-g.invent below */
} else {
for (cobj = g.level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
cobj,
doname, ansimpleoname, "container"));
if (c == 'q')
- return 0;
+ return ECMD_OK;
if (c == 'n')
continue;
tipcontainer(cobj);
/* can only tip one container at a time */
- return 1;
+ return ECMD_TIME;
}
}
}
/* either no floor container(s) or couldn't tip one or didn't tip any */
cobj = getobj("tip", tip_ok, GETOBJ_PROMPT);
if (!cobj)
- return 0;
+ return ECMD_OK;
/* normal case */
if (Is_container(cobj) || cobj->otyp == HORN_OF_PLENTY) {
tipcontainer(cobj);
- return 1;
+ return ECMD_TIME;
}
/* assorted other cases */
if (Is_candle(cobj) && cobj->lamplit) {
consume_obj_charge(cobj, TRUE);
}
/* something [useless] happened */
- return 1;
+ return ECMD_TIME;
}
/* anything not covered yet */
if (cobj->oclass == POTION_CLASS) /* can't pour potions... */
pline_The("%s %s securely sealed.", xname(cobj), otense(cobj, "are"));
else if (uarmh && cobj == uarmh)
- return tiphat();
+ return tiphat() ? ECMD_TIME : ECMD_OK;
else if (cobj->otyp == STATUE)
pline("Nothing interesting happens.");
else
pline1(nothing_happens);
- return 0;
+ return ECMD_OK;
}
static void
if (Strangled) {
You_cant("breathe. Sorry.");
- return 0;
+ return ECMD_OK;
}
if (u.uen < 15) {
You("don't have enough energy to breathe!");
- return 0;
+ return ECMD_OK;
}
u.uen -= 15;
g.context.botl = 1;
if (!getdir((char *) 0))
- return 0;
+ return ECMD_OK;
mattk = attacktype_fordmg(g.youmonst.data, AT_BREA, AD_ANY);
if (!mattk)
else
buzz((int) (20 + mattk->adtyp - 1), (int) mattk->damn, u.ux, u.uy,
u.dx, u.dy);
- return 1;
+ return ECMD_TIME;
}
int
struct attack *mattk;
if (!getdir((char *) 0))
- return 0;
+ return ECMD_OK;
mattk = attacktype_fordmg(g.youmonst.data, AT_SPIT, AD_ANY);
if (!mattk) {
impossible("bad spit attack?");
otmp->spe = 1; /* to indicate it's yours */
throwit(otmp, 0L, FALSE, (struct obj *) 0);
}
- return 1;
+ return ECMD_TIME;
}
int
if (u.utrap && u.utraptype == TT_BURIEDBALL) {
pline_The("ball and chain are buried firmly in the %s.",
surface(u.ux, u.uy));
- return 0;
+ return ECMD_OK;
}
You("are not chained to anything!");
- return 0;
+ return ECMD_OK;
}
unpunish();
- return 1;
+ return ECMD_TIME;
}
int
if (Levitation || Is_airlevel(&u.uz) || Underwater
|| Is_waterlevel(&u.uz)) {
You("must be on the ground to spin a web.");
- return 0;
+ return ECMD_OK;
}
if (u.uswallow) {
You("release web fluid inside %s.", mon_nam(u.ustuck));
if (is_animal(u.ustuck->data)) {
expels(u.ustuck, u.ustuck->data, TRUE);
- return 0;
+ return ECMD_OK;
}
if (is_whirly(u.ustuck->data)) {
int i;
}
pline_The("web %sis swept away!", sweep);
}
- return 0;
+ return ECMD_OK;
} /* default: a nasty jelly-like creature */
pline_The("web dissolves into %s.", mon_nam(u.ustuck));
- return 0;
+ return ECMD_OK;
}
if (u.utrap) {
You("cannot spin webs while stuck in a trap.");
- return 0;
+ return ECMD_OK;
}
exercise(A_DEX, TRUE);
if (ttmp) {
deltrap(ttmp);
bury_objs(u.ux, u.uy);
newsym(u.ux, u.uy);
- return 1;
+ return ECMD_TIME;
case SQKY_BOARD:
pline_The("squeaky board is muffled.");
deltrap(ttmp);
newsym(u.ux, u.uy);
- return 1;
+ return ECMD_TIME;
case TELEP_TRAP:
case LEVEL_TELEP:
case MAGIC_PORTAL:
case VIBRATING_SQUARE:
Your("webbing vanishes!");
- return 0;
+ return ECMD_OK;
case WEB:
You("make the web thicker.");
- return 1;
+ return ECMD_TIME;
case HOLE:
case TRAPDOOR:
You("web over the %s.",
(ttmp->ttyp == TRAPDOOR) ? "trap door" : "hole");
deltrap(ttmp);
newsym(u.ux, u.uy);
- return 1;
+ return ECMD_TIME;
case ROLLING_BOULDER_TRAP:
You("spin a web, jamming the trigger.");
deltrap(ttmp);
newsym(u.ux, u.uy);
- return 1;
+ return ECMD_TIME;
case ARROW_TRAP:
case DART_TRAP:
case BEAR_TRAP:
case POLY_TRAP:
You("have triggered a trap!");
dotrap(ttmp, 0);
- return 1;
+ return ECMD_TIME;
default:
impossible("Webbing over trap type %d?", ttmp->ttyp);
- return 0;
+ return ECMD_OK;
}
} else if (On_stairs(u.ux, u.uy)) {
/* cop out: don't let them hide the stairs */
Your("web fails to impede access to the %s.",
(levl[u.ux][u.uy].typ == STAIRS) ? "stairs" : "ladder");
- return 1;
+ return ECMD_TIME;
}
ttmp = maketrap(u.ux, u.uy, WEB);
if (ttmp) {
if (*in_rooms(u.ux, u.uy, SHOPBASE))
add_damage(u.ux, u.uy, SHOP_WEB_COST);
}
- return 1;
+ return ECMD_TIME;
}
int
int placeholder;
if (u.uen < 10) {
You("lack the energy to send forth a call for help!");
- return 0;
+ return ECMD_OK;
}
u.uen -= 10;
g.context.botl = 1;
exercise(A_WIS, TRUE);
if (!were_summon(g.youmonst.data, TRUE, &placeholder, (char *) 0))
pline("But none arrive.");
- return 1;
+ return ECMD_TIME;
}
int
}
if (adtyp != AD_CONF && adtyp != AD_FIRE) {
impossible("gaze attack %d?", adtyp);
- return 0;
+ return ECMD_OK;
}
if (Blind) {
You_cant("see anything to gaze at.");
- return 0;
+ return ECMD_OK;
} else if (Hallucination) {
You_cant("gaze at anything you can see.");
- return 0;
+ return ECMD_OK;
}
if (u.uen < 15) {
You("lack the energy to use your special gaze!");
- return 0;
+ return ECMD_OK;
}
u.uen -= 15;
g.context.botl = 1;
: -200);
g.multi_reason = "frozen by a monster's gaze";
g.nomovemsg = 0;
- return 1;
+ return ECMD_TIME;
} else
You("stiffen momentarily under %s gaze.",
s_suffix(mon_nam(mtmp)));
}
if (!looked)
You("gaze at no place in particular.");
- return 1;
+ return ECMD_TIME;
}
int
g.youmonst.m_ap_type = M_AP_NOTHING;
newsym(u.ux, u.uy);
}
- return 0;
+ return ECMD_OK;
}
/* note: the eel and hides_under cases are hypothetical;
such critters aren't offered the option of hiding via #monster */
else
There("is no %s to hide in here.", hliquid("water"));
u.uundetected = 0;
- return 0;
+ return ECMD_OK;
}
if (hides_under(g.youmonst.data) && !g.level.objects[u.ux][u.uy]) {
There("is nothing to hide under here.");
u.uundetected = 0;
- return 0;
+ return ECMD_OK;
}
/* Planes of Air and Water */
if (on_ceiling && !has_ceiling(&u.uz)) {
There("is nowhere to hide above you.");
u.uundetected = 0;
- return 0;
+ return ECMD_OK;
}
if ((is_hider(g.youmonst.data) && !Flying) /* floor hider */
&& (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))) {
There("is nowhere to hide beneath you.");
u.uundetected = 0;
- return 0;
+ return ECMD_OK;
}
/* TODO? inhibit floor hiding at furniture locations, or
* else make youhiding() give smarter messages at such spots.
if (u.uundetected || (ismimic && U_AP_TYPE != M_AP_NOTHING)) {
youhiding(FALSE, 1); /* "you are already hiding" */
- return 0;
+ return ECMD_OK;
}
if (ismimic) {
u.uundetected = 1;
newsym(u.ux, u.uy);
youhiding(FALSE, 0); /* "you are now hiding" */
- return 1;
+ return ECMD_TIME;
}
int
newsym(u.ux, u.uy);
}
}
- return 1;
+ return ECMD_TIME;
}
/* #monster for hero-as-mind_flayer giving psychic blast */
if (u.uen < 10) {
You("concentrate but lack the energy to maintain doing so.");
- return 0;
+ return ECMD_OK;
}
u.uen -= 10;
g.context.botl = 1;
killed(mtmp);
}
}
- return 1;
+ return ECMD_TIME;
}
void
}
/* "Quaffing is like drinking, except you spill more." - Terry Pratchett */
+/* the #quaff command */
int
dodrink(void)
{
if (Strangled) {
pline("If you can't breathe air, how can you drink liquid?");
- return 0;
+ return ECMD_OK;
}
/* Is there a fountain to drink from here? */
if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)
&& can_reach_floor(FALSE)) {
if (yn("Drink from the fountain?") == 'y') {
drinkfountain();
- return 1;
+ return ECMD_TIME;
}
}
/* Or a kitchen sink? */
&& can_reach_floor(FALSE)) {
if (yn("Drink from the sink?") == 'y') {
drinksink();
- return 1;
+ return ECMD_TIME;
}
}
/* Or are you surrounded by water? */
if (Underwater && !u.uswallow) {
if (yn("Drink the water around you?") == 'y') {
pline("Do you know what lives in this water?");
- return 1;
+ return ECMD_TIME;
}
}
otmp = getobj("drink", drink_ok, GETOBJ_NOFLAGS);
if (!otmp)
- return 0;
+ return ECMD_OK;
/* quan > 1 used to be left to useup(), but we need to force
the current potion to be unworn, and don't want to do
&& !rn2(POTION_OCCUPANT_CHANCE(g.mvitals[PM_GHOST].born))) {
ghost_from_bottle();
useup(otmp);
- return 1;
+ return ECMD_TIME;
} else if (objdescr_is(otmp, "smoky")
&& !(g.mvitals[PM_DJINNI].mvflags & G_GONE)
&& !rn2(POTION_OCCUPANT_CHANCE(g.mvitals[PM_DJINNI].born))) {
djinni_from_bottle(otmp);
useup(otmp);
- return 1;
+ return ECMD_TIME;
}
return dopotion(otmp);
}
otmp->in_use = TRUE;
g.potion_nothing = g.potion_unkn = 0;
if ((retval = peffects(otmp)) >= 0)
- return retval;
+ return retval ? ECMD_TIME : ECMD_OK;
if (g.potion_nothing) {
g.potion_unkn++;
docall(otmp);
}
useup(otmp);
- return 1;
+ return ECMD_TIME;
}
static void
const char *shortestname; /* last resort obj name for prompt */
if (!(obj = getobj("dip", dip_ok, GETOBJ_PROMPT)))
- return 0;
+ return ECMD_OK;
if (inaccessible_equipment(obj, "dip", FALSE))
- return 0;
+ return ECMD_OK;
shortestname = (is_plural(obj) || pair_of(obj)) ? "them" : "it";
/*
/* "Dip <the object> into the fountain?" */
if (yn(qbuf) == 'y') {
dipfountain(obj);
- return 1;
+ return ECMD_TIME;
}
} else if (is_pool(u.ux, u.uy)) {
const char *pooltype = waterbody_name(u.ux, u.uy);
if (water_damage(obj, 0, TRUE) != ER_DESTROYED && obj->in_use)
useup(obj);
}
- return 1;
+ return ECMD_TIME;
}
}
flags.verbose ? obuf : shortestname);
potion = getobj(qbuf, drink_ok, GETOBJ_NOFLAGS);
if (!potion)
- return 0;
+ return ECMD_OK;
if (potion == obj && potion->quan == 1L) {
pline("That is a potion bottle, not a Klein bottle!");
- return 0;
+ return ECMD_OK;
}
potion->in_use = TRUE; /* assume it will be used up */
if (potion->otyp == POT_WATER) {
*/
if (!obj) {
makeknown(POT_POLYMORPH);
- return 1;
+ return ECMD_TIME;
} else if (obj->otyp != save_otyp) {
makeknown(POT_POLYMORPH);
useup(potion);
prinv((char *) 0, obj, 0L);
- return 1;
+ return ECMD_TIME;
} else {
pline("Nothing seems to happen.");
goto poof;
}
}
potion->in_use = FALSE; /* didn't go poof */
- return 1;
+ return ECMD_TIME;
} else if (obj->oclass == POTION_CLASS && obj->otyp != potion->otyp) {
int amt = (int) obj->quan;
boolean magic;
useupall(obj);
losehp(amt + rnd(9), /* not physical damage */
"alchemic blast", KILLED_BY_AN);
- return 1;
+ return ECMD_TIME;
}
obj->blessed = obj->cursed = obj->bknown = 0;
useupall(obj);
pline_The("mixture %sevaporates.",
!Blind ? "glows brightly and " : "");
- return 1;
+ return ECMD_TIME;
}
}
obj->odiluted = (obj->otyp != POT_WATER);
as a consequence, mixing while Fumbling drops the mixture */
freeinv(obj);
hold_potion(obj, "You drop %s!", doname(obj), (const char *) 0);
- return 1;
+ return ECMD_TIME;
}
if (potion->otyp == POT_ACID && obj->otyp == CORPSE
&& !objects[potion->otyp].oc_name_known
&& !objects[potion->otyp].oc_uname)
docall(potion);
- return 1;
+ return ECMD_TIME;
}
if (potion->otyp == POT_WATER && obj->otyp == TOWEL) {
if (potion->dknown)
makeknown(potion->otyp);
useup(potion);
- return 1;
+ return ECMD_TIME;
}
more_dips:
useup(potion);
explode(u.ux, u.uy, 11, d(6, 6), 0, EXPL_FIERY);
exercise(A_WIS, FALSE);
- return 1;
+ return ECMD_TIME;
}
/* Adding oil to an empty magic lamp renders it into an oil lamp */
if ((obj->otyp == MAGIC_LAMP) && obj->spe == 0) {
makeknown(POT_OIL);
obj->spe = 1;
update_inventory();
- return 1;
+ return ECMD_TIME;
}
potion->in_use = FALSE; /* didn't go poof */
with compatible ones; override 'pickup_burden' while doing so */
hold_potion(singlepotion, "You juggle and drop %s!",
doname(singlepotion), (const char *) 0);
- return 1;
+ return ECMD_TIME;
}
pline("Interesting...");
- return 1;
+ return ECMD_TIME;
poof:
if (potion->dknown
&& !objects[potion->otyp].oc_uname)
docall(potion);
useup(potion);
- return 1;
+ return ECMD_TIME;
}
/* *monp grants a wish and then leaves the game */
exercise(A_WIS, TRUE);
}
+/* the #offer command - sacrifice something to the gods */
int
dosacrifice(void)
{
if (!on_altar() || u.uswallow) {
You("are not standing on an altar.");
- return 0;
+ return ECMD_OK;
}
highaltar = ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz))
&& (levl[u.ux][u.uy].altarmask & AM_SHRINE));
otmp = floorfood("sacrifice", 1);
if (!otmp)
- return 0;
+ return ECMD_OK;
/*
* Was based on nutritional value and aging behavior (< 50 moves).
* Sacrificing a food ration got you max luck instantly, making the
*/
feel_cockatrice(otmp, TRUE);
if (rider_corpse_revival(otmp, FALSE))
- return 1;
+ return ECMD_TIME;
if (otmp->corpsenm == PM_ACID_BLOB
|| (g.moves <= peek_at_iced_corpse_age(otmp) + 50)) {
useup(otmp);
else
useupf(otmp, 1L);
- return 1;
+ return ECMD_TIME;
} else if (has_omonst(otmp)
&& (mtmp = get_mtraits(otmp, FALSE)) != 0
&& mtmp->mtame) {
? "an urge to return to the surface"
/* else headed towards celestial disgrace */
: "ashamed");
- return 1;
+ return ECMD_TIME;
} else {
/* The final Test. Did you win? */
if (uamul == otmp)
Hallucination ? "boo-boo" : "mistake");
otmp->known = TRUE;
change_luck(-1);
- return 1;
+ return ECMD_TIME;
} else {
/* don't you dare try to fool the gods */
if (Deaf)
if (value == 0) {
pline1(nothing_happens);
- return 1;
+ return ECMD_TIME;
}
if (altaralign != u.ualign.type && highaltar) {
if (!Inhell)
angrygods(u.ualign.type);
}
- return 1;
+ return ECMD_TIME;
} else {
consume_offering(otmp);
You("sense a conflict between %s and %s.", u_gname(),
&& rnd(u.ualign.record) > (7 * ALIGNLIM) / 8)
summon_minion(altaralign, TRUE);
}
- return 1;
+ return ECMD_TIME;
}
}
makeknown(otmp->otyp);
discover_artifact(otmp->oartifact);
}
- return 1;
+ return ECMD_TIME;
}
}
change_luck((value * LUCKMAX) / (MAXVALUE * 2));
}
}
}
- return 1;
+ return ECMD_TIME;
}
/* determine prayer results in advance; also used for enlightenment */
{
/* Confirm accidental slips of Alt-P */
if (ParanoidPray && yn("Are you sure you want to pray?") != 'y')
- return 0;
+ return ECMD_OK;
u.uconduct.gnostic++;
/* set up p_type and p_alignment */
if (!can_pray(TRUE))
- return 0;
+ return ECMD_OK;
if (wizard && g.p_type >= 0) {
if (yn("Force the gods to be pleased?") == 'y') {
u.uinvulnerable = TRUE;
}
- return 1;
+ return ECMD_TIME;
}
static int
return spelleffects(sp_no, FALSE);
}
You("don't know how to turn undead!");
- return 0;
+ return ECMD_OK;
}
u.uconduct.gnostic++;
Gname = halu_gname(u.ualign.type);
/* violates agnosticism due to intent; conduct tracking is not
supposed to affect play but we make an exception here: use a
move if this is the first time agnostic conduct has been broken */
- return (u.uconduct.gnostic == 1);
+ return (u.uconduct.gnostic == 1) ? ECMD_TIME : ECMD_OK;
}
if ((u.ualign.type != A_CHAOTIC
&& (is_demon(g.youmonst.data)
pline("For some reason, %s seems to ignore you.", Gname);
aggravate();
exercise(A_WIS, FALSE);
- return 1;
+ return ECMD_TIME;
}
if (Inhell) {
pline("Since you are in Gehennom, %s %s help you.",
phrasing anyway if hallucinatory feedback says it's him */
Gname, !strcmp(Gname, Moloch) ? "won't" : "can't");
aggravate();
- return 1;
+ return ECMD_TIME;
}
pline("Calling upon %s, you chant an arcane formula.", Gname);
exercise(A_WIS, TRUE);
nomul(-(5 - ((u.ulevel - 1) / 6))); /* -5 .. -1 */
g.multi_reason = "trying to turn the monsters";
g.nomovemsg = You_can_move_again;
- return 1;
+ return ECMD_TIME;
}
int
return GETOBJ_DOWNPLAY;
}
-/* the 'r' command; read a scroll or spell book or various other things */
+/* the #read command; read a scroll or spell book or various other things */
int
doread(void)
{
g.known = FALSE;
if (check_capacity((char *) 0))
- return 0;
+ return ECMD_OK;
scroll = getobj("read", read_ok, GETOBJ_PROMPT);
if (!scroll)
- return 0;
+ return ECMD_OK;
otyp = scroll->otyp;
/* outrumor has its own blindness check */
if (!Blind)
u.uconduct.literate++;
useup(scroll);
- return 1;
+ return ECMD_TIME;
} else if (otyp == T_SHIRT || otyp == ALCHEMY_SMOCK
|| otyp == HAWAIIAN_SHIRT) {
char buf[BUFSZ], *mesg;
if (Blind) {
You_cant(find_any_braille);
- return 0;
+ return ECMD_OK;
}
/* can't read shirt worn under suit (under cloak is ok though) */
if ((otyp == T_SHIRT || otyp == HAWAIIAN_SHIRT) && uarm
pline("%s shirt is obscured by %s%s.",
scroll->unpaid ? "That" : "Your", shk_your(buf, uarm),
suit_simple_name(uarm));
- return 0;
+ return ECMD_OK;
}
if (otyp == HAWAIIAN_SHIRT) {
pline("%s features %s.", flags.verbose ? "The design" : "It",
hawaiian_design(scroll, buf));
- return 1;
+ return ECMD_TIME;
}
u.uconduct.literate++;
/* populate 'buf[]' */
pline("It reads:");
}
pline("\"%s\"%s", mesg, endpunct);
- return 1;
+ return ECMD_TIME;
} else if ((otyp == DUNCE_CAP || otyp == CORNUTHAUM)
/* note: "DUNCE" isn't directly connected to tourists but
if everyone could read it, they would always be able to
because it suggests that there might be something on others */
You_cant("find anything to read on this %s.",
simpleonames(scroll));
- return 0;
+ return ECMD_OK;
}
pline("%s on the %s. It reads: %s.",
!Blind ? "There is writing" : "You feel lettering",
the object type, don't make it become a discovery for hero */
if (!objects[otyp].oc_name_known && !objects[otyp].oc_uname)
docall(scroll);
- return 1;
+ return ECMD_TIME;
} else if (otyp == CREDIT_CARD) {
static const char *card_msgs[] = {
"Leprechaun Gold Tru$t - Shamrock Card",
(((int) scroll->o_id * 7) % 10),
(flags.verbose || Blind) ? "." : "");
u.uconduct.literate++;
- return 1;
+ return ECMD_TIME;
} else if (otyp == CAN_OF_GREASE) {
pline("This %s has no label.", singular(scroll, xname));
- return 0;
+ return ECMD_OK;
} else if (otyp == MAGIC_MARKER) {
if (Blind) {
You_cant(find_any_braille);
- return 0;
+ return ECMD_OK;
}
if (flags.verbose)
pline("It reads:");
pline("\"Magic Marker(TM) Red Ink Marker Pen. Water Soluble.\"");
u.uconduct.literate++;
- return 1;
+ return ECMD_TIME;
} else if (scroll->oclass == COIN_CLASS) {
if (Blind)
You("feel the embossed words:");
You("read:");
pline("\"1 Zorkmid. 857 GUE. In Frobs We Trust.\"");
u.uconduct.literate++;
- return 1;
+ return ECMD_TIME;
} else if (scroll->oartifact == ART_ORB_OF_FATE) {
if (Blind)
You("feel the engraved signature:");
pline("It is signed:");
pline("\"Odin.\"");
u.uconduct.literate++;
- return 1;
+ return ECMD_TIME;
} else if (otyp == CANDY_BAR) {
const char *wrapper = candy_wrapper_text(scroll);
if (Blind) {
You_cant(find_any_braille);
- return 0;
+ return ECMD_OK;
}
if (!*wrapper) {
pline("The candy bar's wrapper is blank.");
- return 0;
+ return ECMD_OK;
}
pline("The wrapper reads: \"%s\".", wrapper);
u.uconduct.literate++;
- return 1;
+ return ECMD_TIME;
} else if (scroll->oclass != SCROLL_CLASS
&& scroll->oclass != SPBOOK_CLASS) {
pline(silly_thing_to, "read");
- return 0;
+ return ECMD_OK;
} else if (Blind && otyp != SPE_BOOK_OF_THE_DEAD) {
const char *what = 0;
what = "formula on the scroll";
if (what) {
pline("Being blind, you cannot read the %s.", what);
- return 0;
+ return ECMD_OK;
}
}
if (!scroll->spe && yn(
"Reading mail will violate \"illiterate\" conduct. Read anyway?"
) != 'y')
- return 0;
+ return ECMD_OK;
}
}
#endif
u.uconduct.literate++;
if (scroll->oclass == SPBOOK_CLASS) {
- return study_book(scroll);
+ return study_book(scroll) ? ECMD_TIME : ECMD_OK;
}
scroll->in_use = TRUE; /* scroll, not spellbook, now being read */
if (otyp != SCR_BLANK_PAPER) {
if (otyp != SCR_BLANK_PAPER)
useup(scroll);
}
- return 1;
+ return ECMD_TIME;
}
static void
if (!oracl) {
There("is no one here to consult.");
- return 0;
+ return ECMD_OK;
} else if (!oracl->mpeaceful) {
pline("%s is in no mood for consultations.", Monnam(oracl));
- return 0;
+ return ECMD_OK;
} else if (!umoney) {
You("have no gold.");
- return 0;
+ return ECMD_OK;
}
Sprintf(qbuf, "\"Wilt thou settle for a minor consultation?\" (%d %s)",
switch (ynq(qbuf)) {
default:
case 'q':
- return 0;
+ return ECMD_OK;
case 'y':
if (umoney < (long) minor_cost) {
You("don't even have enough gold for that!");
- return 0;
+ return ECMD_OK;
}
u_pay = minor_cost;
break;
case 'n':
if (umoney <= (long) minor_cost /* don't even ask */
|| (g.oracle_cnt == 1 || g.oracle_flg < 0))
- return 0;
+ return ECMD_OK;
Sprintf(qbuf, "\"Then dost thou desire a major one?\" (%d %s)",
major_cost, currency((long) major_cost));
if (yn(qbuf) != 'y')
- return 0;
+ return ECMD_OK;
u_pay = (umoney < (long) major_cost) ? (int) umoney : major_cost;
break;
}
more_experienced(add_xpts, u_pay / 50);
newexplevel();
}
- return 1;
+ return ECMD_TIME;
}
static void
#define HUP
#endif
+/* the #save command */
int
dosave(void)
{
} else
(void) doredraw();
}
- return 0;
+ return ECMD_OK;
}
/* returns 1 if save successful */
return gmin;
}
+/* the #pay command */
int
dopay(void)
{
if ((!sk && (!Blind || Blind_telepat)) || (!Blind && !seensk)) {
There("appears to be no shopkeeper here to receive your payment.");
- return 0;
+ return ECMD_OK;
}
if (!seensk) {
You_cant("see...");
- return 0;
+ return ECMD_OK;
}
/* The usual case. Allow paying at a distance when
if (shkp != resident && distu(shkp->mx, shkp->my) > 2) {
pline("%s is not near enough to receive your payment.",
Shknam(shkp));
- return 0;
+ return ECMD_OK;
}
} else {
struct monst *mtmp;
cc.x = u.ux;
cc.y = u.uy;
if (getpos(&cc, TRUE, "the creature you want to pay") < 0)
- return 0; /* player pressed ESC */
+ return ECMD_OK; /* player pressed ESC */
cx = cc.x;
cy = cc.y;
if (cx < 0) {
pline("Try again...");
- return 0;
+ return ECMD_OK;
}
if (u.ux == cx && u.uy == cy) {
You("are generous to yourself.");
- return 0;
+ return ECMD_OK;
}
mtmp = m_at(cx, cy);
if (!cansee(cx, cy) && (!mtmp || !canspotmon(mtmp))) {
You("can't %s anyone there.", !Blind ? "see" : "sense");
- return 0;
+ return ECMD_OK;
}
if (!mtmp) {
There("is no one there to receive your payment.");
- return 0;
+ return ECMD_OK;
}
if (!mtmp->isshk) {
pline("%s is not interested in your payment.", Monnam(mtmp));
- return 0;
+ return ECMD_OK;
}
if (mtmp != resident && distu(mtmp->mx, mtmp->my) > 2) {
pline("%s is too far to receive your payment.", Shknam(mtmp));
- return 0;
+ return ECMD_OK;
}
shkp = mtmp;
}
if (!shkp) {
debugpline0("dopay: null shkp.");
- return 0;
+ return ECMD_OK;
}
proceed:
eshkp = ESHK(shkp);
if (!shkp->mcanmove || shkp->msleeping) { /* still asleep/paralyzed */
pline("%s %s.", Shknam(shkp),
rn2(2) ? "seems to be napping" : "doesn't respond");
- return 0;
+ return ECMD_OK;
}
if (shkp != resident && NOTANGRY(shkp)) {
else
make_happy_shk(shkp, FALSE);
}
- return 1;
+ return ECMD_TIME;
}
/* ltmp is still eshkp->robbed here */
pline(no_money, stashed_gold ? " seem to" : "");
else
pline(not_enough_money, noit_mhim(shkp));
- return 1;
+ return ECMD_TIME;
}
pline("But since %s shop has been robbed recently,",
noit_mhis(shkp));
pline(no_money, stashed_gold ? " seem to" : "");
else
pline(not_enough_money, noit_mhim(shkp));
- return 1;
+ return ECMD_TIME;
}
You("try to appease %s by giving %s 1000 gold pieces.",
canspotmon(shkp)
else
pline("But %s is as angry as ever.", shkname(shkp));
}
- return 1;
+ return ECMD_TIME;
}
if (shkp != resident) {
impossible("dopay: not to shopkeeper?");
if (resident)
setpaid(resident);
- return 0;
+ return ECMD_OK;
}
/* pay debt, if any, first */
if (eshkp->debit) {
pline("But you don't%s have enough gold%s.",
stashed_gold ? " seem to" : "",
eshkp->credit ? " or credit" : "");
- return 1;
+ return ECMD_TIME;
} else {
if (eshkp->credit >= dtmp) {
eshkp->credit -= dtmp;
if (!umoney && !eshkp->credit) {
You("%shave no gold or credit%s.",
stashed_gold ? "seem to " : "", paid ? " left" : "");
- return 0;
+ return ECMD_OK;
}
if ((umoney + eshkp->credit) < cheapest_item(shkp)) {
You("don't have enough gold to buy%s the item%s you picked.",
eshkp->billct > 1 ? " any of" : "", plur(eshkp->billct));
if (stashed_gold)
pline("Maybe you have some gold stashed away?");
- return 0;
+ return ECMD_OK;
}
/* this isn't quite right; it itemizes without asking if the
} else {
impossible("Shopkeeper administration out of order.");
setpaid(shkp); /* be nice to the player */
- return 1;
+ return ECMD_TIME;
}
if (pass == bp->useup && otmp->quan == bp->bquan) {
/* pay for used-up items on first pass and others
} else {
switch (dopayobj(shkp, bp, &otmp, pass, itemize)) {
case PAY_CANT:
- return 1; /*break*/
+ return ECMD_TIME; /*break*/
case PAY_BROKE:
paid = TRUE;
goto thanks; /*break*/
Shknam(shkp), noit_mhis(shkp),
shtypes[eshkp->shoptype - SHOPBASE].name);
}
- return 1;
+ return ECMD_TIME;
}
/* return 2 if used-up portion paid
if (u.usteed) {
You("are already sitting on %s.", mon_nam(u.usteed));
- return 0;
+ return ECMD_OK;
}
if (u.uundetected && is_hider(g.youmonst.data) && u.umonnum != PM_TRAPPER)
u.uundetected = 0; /* no longer on the ceiling */
You("tumble in place.");
else
You("are sitting on air.");
- return 0;
+ return ECMD_OK;
} else if (u.ustuck && !sticks(g.youmonst.data)) {
/* holding monster is next to hero rather than beneath, but
hero is in no condition to actually sit at has/her own spot */
pline("%s won't offer %s lap.", Monnam(u.ustuck), mhis(u.ustuck));
else
pline("%s has no lap.", Monnam(u.ustuck));
- return 0;
+ return ECMD_OK;
} else if (is_pool(u.ux, u.uy) && !Underwater) { /* water walking */
goto in_water;
}
burn_away_slime();
if (likes_lava(g.youmonst.data)) {
pline_The("%s feels warm.", hliquid("lava"));
- return 1;
+ return ECMD_TIME;
}
pline_The("%s burns you!", hliquid("lava"));
losehp(d((Fire_resistance ? 2 : 10), 10), /* lava damage */
Hallucination
? "You may think you are a platypus, but a male still"
: "Males");
- return 0;
+ return ECMD_OK;
} else if (u.uhunger < (int) objects[EGG].oc_nutrition) {
You("don't have enough energy to lay an egg.");
- return 0;
+ return ECMD_OK;
} else if (eggs_in_water(g.youmonst.data)) {
if (!(Underwater || Is_waterlevel(&u.uz))) {
pline("A splash tetra you are not.");
- return 0;
+ return ECMD_OK;
}
if (Upolyd
&& (g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL])) {
You("yearn for the Sargasso Sea.");
- return 0;
+ return ECMD_OK;
}
}
uegg = mksobj(EGG, FALSE, FALSE);
} else {
pline("Having fun sitting on the %s?", surface(u.ux, u.uy));
}
- return 1;
+ return ECMD_TIME;
}
/* curse a few inventory items at random! */
DISABLE_WARNING_FORMAT_NONLITERAL
-static int
+static int /* check calls to this */
domonnoise(register struct monst* mtmp)
{
char verbuf[BUFSZ];
/* presumably nearness and sleep checks have already been made */
if (Deaf)
- return 0;
+ return ECMD_OK;
if (is_silent(ptr))
- return 0;
+ return ECMD_OK;
/* leader might be poly'd; if he can still speak, give leader speech */
if (mtmp->m_id == g.quest_status.leader_m_id && msound > MS_ANIMAL)
switch (msound) {
case MS_ORACLE:
- return doconsult(mtmp);
+ return doconsult(mtmp); /* check this */
case MS_PRIEST:
priest_talk(mtmp);
break;
if (!mtmp->mpeaceful)
pline_msg = "hisses!";
else
- return 0; /* no sound */
+ return ECMD_OK; /* no sound */
break;
case MS_BUZZ:
pline_msg = mtmp->mpeaceful ? "drones." : "buzzes angrily.";
verbalize1(verbl_msg);
}
}
- return 1;
+ return ECMD_TIME;
}
RESTORE_WARNING_FORMAT_NONLITERAL
if (is_silent(g.youmonst.data)) {
pline("As %s, you cannot speak.",
an(pmname(g.youmonst.data, flags.female ? FEMALE : MALE)));
- return 0;
+ return ECMD_OK;
}
if (Strangled) {
You_cant("speak. You're choking!");
- return 0;
+ return ECMD_OK;
}
if (u.uswallow) {
pline("They won't hear you out there.");
- return 0;
+ return ECMD_OK;
}
if (Underwater) {
Your("speech is unintelligible underwater.");
- return 0;
+ return ECMD_OK;
}
if (!Deaf && !Blind && (otmp = shop_object(u.ux, u.uy)) != (struct obj *) 0) {
/* standing on something in a shop and chatting causes the shopkeeper
contains any objects other than just gold.
*/
price_quote(otmp);
- return 1;
+ return ECMD_TIME;
}
if (!getdir("Talk to whom? (in what direction)")) {
/* decided not to chat */
- return 0;
+ return ECMD_OK;
}
if (u.usteed && u.dz > 0) {
if (!u.usteed->mcanmove || u.usteed->msleeping) {
pline("%s seems not to notice you.", Monnam(u.usteed));
- return 1;
+ return ECMD_TIME;
} else
return domonnoise(u.usteed);
}
if (u.dz) {
pline("They won't hear you %s there.", u.dz < 0 ? "up" : "down");
- return 0;
+ return ECMD_OK;
}
if (u.dx == 0 && u.dy == 0) {
}
*/
pline("Talking to yourself is a bad habit for a dungeoneer.");
- return 0;
+ return ECMD_OK;
}
tx = u.ux + u.dx;
ty = u.uy + u.dy;
if (!isok(tx, ty))
- return 0;
+ return ECMD_OK;
mtmp = m_at(tx, ty);
pline_The("%s seems not to notice you.",
/* if hallucinating, you can't tell it's a statue */
Hallucination ? rndmonnam((char *) 0) : "statue");
- return 0;
+ return ECMD_OK;
}
if (!Deaf && (IS_WALL(levl[tx][ty].typ) || levl[tx][ty].typ == SDOOR)) {
/* Talking to a wall; secret door remains hidden by behaving
idx = SIZE(walltalk) - 1;
pline_The("wall %s", walltalk[idx]);
}
- return 0;
+ return ECMD_OK;
}
}
if (!mtmp || mtmp->mundetected
|| M_AP_TYPE(mtmp) == M_AP_FURNITURE
|| M_AP_TYPE(mtmp) == M_AP_OBJECT)
- return 0;
+ return ECMD_OK;
/* sleeping monsters won't talk, except priests (who wake up) */
if ((!mtmp->mcanmove || mtmp->msleeping) && !mtmp->ispriest) {
not noticing him and just not existing, so skip the message. */
if (canspotmon(mtmp))
pline("%s seems not to notice you.", Monnam(mtmp));
- return 0;
+ return ECMD_OK;
}
/* if this monster is waiting for something, prod it into action */
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
pline("%s is eating noisily.", Monnam(mtmp));
- return 0;
+ return ECMD_OK;
}
if (Deaf) {
const char *xresponse = humanoid(g.youmonst.data)
canspotmon(mtmp) ? " from " : "",
canspotmon(mtmp) ? mon_nam(mtmp) : "",
xresponse);
- return 0;
+ return ECMD_OK;
}
return domonnoise(mtmp);
}
spell_no);
}
-/* the 'Z' command -- cast a spell */
+/* the #cast command -- cast a spell */
int
docast(void)
{
if (getspell(&spell_no))
return spelleffects(spell_no, FALSE);
- return 0;
+ return ECMD_OK;
}
static const char *
spelleffects(int spell, boolean atme)
{
int energy, damage, chance, n, intell;
- int otyp, skill, role_skill, res = 0;
+ int otyp, skill, role_skill, res = ECMD_OK;
boolean confused = (Confusion != 0);
boolean physical_damage = FALSE;
struct obj *pseudo;
* place in getspell(), we don't get called.)
*/
if (rejectcasting()) {
- return 0; /* no time elapses */
+ return ECMD_OK; /* no time elapses */
}
/*
Your("knowledge of this spell is twisted.");
pline("It invokes nightmarish images in your mind...");
spell_backfire(spell);
- return 1;
+ return ECMD_TIME;
} else if (spellknow(spell) <= KEEN / 200) { /* 100 turns left */
You("strain to recall the spell.");
} else if (spellknow(spell) <= KEEN / 40) { /* 500 turns left */
if (u.uhunger <= 10 && spellid(spell) != SPE_DETECT_FOOD) {
You("are too hungry to cast that spell.");
- return 0;
+ return ECMD_OK;
} else if (ACURR(A_STR) < 4 && spellid(spell) != SPE_RESTORE_ABILITY) {
You("lack the strength to cast spells.");
- return 0;
+ return ECMD_OK;
} else if (check_capacity(
"Your concentration falters while carrying so much stuff.")) {
- return 1;
+ return ECMD_TIME;
}
/* if the cast attempt is already going to fail due to insufficient
if (u.uen < 0)
u.uen = 0;
g.context.botl = 1;
- res = 1; /* time is going to elapse even if spell doesn't get cast */
+ res = ECMD_TIME; /* time is used even if spell doesn't get cast */
}
if (energy > u.uen) {
You("fail to cast the spell correctly.");
u.uen -= energy / 2;
g.context.botl = 1;
- return 1;
+ return ECMD_TIME;
}
u.uen -= energy;
cast_protection();
break;
case SPE_JUMPING:
- if (!jump(max(role_skill, 1)))
+ if (!(jump(max(role_skill, 1)) & ECMD_TIME))
pline1(nothing_happens);
break;
default:
impossible("Unknown spell %d attempted.", spell);
obfree(pseudo, (struct obj *) 0);
- return 0;
+ return ECMD_OK;
}
/* gain skill for successful cast */
use_skill(skill, spellev(spell));
obfree(pseudo, (struct obj *) 0); /* now, get rid of it */
- return 1;
+ return ECMD_TIME;
}
/*ARGSUSED*/
return FALSE;
}
-/* the '+' command -- view known spells */
+/* the #showspells command -- view known spells */
int
dovspell(void)
{
g.spl_orderindx = 0;
}
g.spl_sortmode = SORTBY_LETTER; /* 0 */
- return 0;
+ return ECMD_OK;
}
DISABLE_WARNING_FORMAT_NONLITERAL
int chance;
if (!u_handsy())
- return 0;
+ return ECMD_OK;
/* Select an animal */
if (u.uswallow || Underwater || !getdir((char *) 0)) {
pline1(Never_mind);
- return 0;
+ return ECMD_OK;
}
if (!u.dx && !u.dy) {
pline("Saddle yourself? Very funny...");
- return 0;
+ return ECMD_OK;
}
if (!isok(u.ux + u.dx, u.uy + u.dy)
|| !(mtmp = m_at(u.ux + u.dx, u.uy + u.dy)) || !canspotmon(mtmp)) {
pline("I see nobody there.");
- return 1;
+ return ECMD_TIME;
}
/* Is this a valid monster? */
if ((mtmp->misc_worn_check & W_SADDLE) != 0L
|| which_armor(mtmp, W_SADDLE)) {
pline("%s doesn't need another one.", Monnam(mtmp));
- return 1;
+ return ECMD_TIME;
}
ptr = mtmp->data;
if (touch_petrifies(ptr) && !uarmg && !Stone_resistance) {
if (ptr == &mons[PM_AMOROUS_DEMON]) {
pline("Shame on you!");
exercise(A_WIS, FALSE);
- return 1;
+ return ECMD_TIME;
}
if (mtmp->isminion || mtmp->isshk || mtmp->ispriest || mtmp->isgd
|| mtmp->iswiz) {
pline("I think %s would mind.", mon_nam(mtmp));
- return 1;
+ return ECMD_TIME;
}
if (!can_saddle(mtmp)) {
You_cant("saddle such a creature.");
- return 1;
+ return ECMD_TIME;
}
/* Calculate your chance */
put_saddle_on_mon(otmp, mtmp);
} else
pline("%s resists!", Monnam(mtmp));
- return 1;
+ return ECMD_TIME;
}
void
&& (!Underwater || is_swimmer(mtmp->data)));
}
+/* the #ride command */
int
doride(void)
{
} else if (getdir((char *) 0) && isok(u.ux + u.dx, u.uy + u.dy)) {
if (wizard && yn("Force the mount to succeed?") == 'y')
forcemount = TRUE;
- return (mount_steed(m_at(u.ux + u.dx, u.uy + u.dy), forcemount));
+ return (mount_steed(m_at(u.ux + u.dx, u.uy + u.dy), forcemount)
+ ? ECMD_TIME : ECMD_OK);
} else {
- return 0;
+ return ECMD_OK;
}
- return 1;
+ return ECMD_TIME;
}
/* Start riding, with the given monster */
(void) safe_teleds(TELEDS_TELEPORT);
}
-/* ^T command; 'm ^T' == choose among several teleport modes */
+/* the #teleport command; 'm ^T' == choose among several teleport modes */
int
dotelecmd(void)
{
/* normal mode; ignore 'm' prefix if it was given */
if (!wizard)
- return dotele(FALSE);
+ return dotele(FALSE) ? ECMD_TIME : ECMD_OK;
added = hidden = NOOP_SPELL;
save_HTele = HTeleportation, save_ETele = ETeleportation;
/* preselected one was explicitly chosen and got toggled off */
tmode = 'w';
} else { /* ESC */
- return 0;
+ return ECMD_OK;
}
switch (tmode) {
case 'n':
/* can't both be non-NOOP so addition will yield the non-NOOP one */
(void) tport_spell(added + hidden - NOOP_SPELL);
- return res;
+ return res ? ECMD_TIME : ECMD_OK;
}
int
if (castit) {
/* energy cost is deducted in spelleffects() */
exercise(A_WIS, TRUE);
- if (spelleffects(sp_no, TRUE))
+ if ((spelleffects(sp_no, TRUE) & ECMD_TIME))
return 1;
else if (!break_the_rules)
return 0;
}
}
+/* the #timeout command */
int
wiz_timeout_queue(void)
{
win = create_nhwindow(NHW_MENU); /* corner text window */
if (win == WIN_ERR)
- return 0;
+ return ECMD_OK;
Sprintf(buf, "Current time = %ld.", g.moves);
putstr(win, 0, buf);
display_nhwindow(win, FALSE);
destroy_nhwindow(win);
- return 0;
+ return ECMD_OK;
}
void
}
}
-/* disarm a trap */
+/* the #untrap command - disarm a trap */
int
dountrap(void)
{
if (near_capacity() >= HVY_ENCUMBER) {
pline("You're too strained to do that.");
- return 0;
+ return ECMD_OK;
}
if ((nohands(g.youmonst.data) && !webmaker(g.youmonst.data))
|| !g.youmonst.data->mmove) {
pline("And just how do you expect to do that?");
- return 0;
+ return ECMD_OK;
} else if (u.ustuck && sticks(g.youmonst.data)) {
pline("You'll have to let go of %s first.", mon_nam(u.ustuck));
- return 0;
+ return ECMD_OK;
}
if (u.ustuck || (welded(uwep) && bimanual(uwep))) {
Your("%s seem to be too busy for that.", makeplural(body_part(HAND)));
- return 0;
+ return ECMD_OK;
}
- return untrap(FALSE);
+ return untrap(FALSE) ? ECMD_TIME : ECMD_OK;
}
/* Probability of disabling a trap. Helge Hafting */
return buf;
}
-/* the 'v' command */
+/* the #versionshort command */
int
doversion(void)
{
char buf[BUFSZ];
pline("%s", getversionstring(buf));
- return 0;
+ return ECMD_OK;
}
/* the '#version' command; also a choice for '?' */
(void) dlb_fclose(f);
display_nhwindow(win, FALSE);
destroy_nhwindow(win);
- return 0;
+ return ECMD_OK;
}
void
}
}
} while (speedy && n > 0);
- return 0;
+ return ECMD_OK;
}
/*
return GETOBJ_DOWNPLAY;
}
+/* the #wield command - wield a weapon */
int
dowield(void)
{
if (cantwield(g.youmonst.data)) {
pline("Don't be ridiculous!");
cmdq_clear();
- return 0;
+ return ECMD_OK;
}
/* Prompt for a new weapon */
if (!(wep = getobj("wield", wield_ok, GETOBJ_PROMPT | GETOBJ_ALLOWCNT))) {
/* Cancelled */
cmdq_clear();
- return 0;
+ return ECMD_OK;
} else if (wep == uwep) {
already_wielded:
You("are already wielding that!");
if (is_weptool(wep) || is_wet_towel(wep))
g.unweapon = FALSE; /* [see setuwep()] */
cmdq_clear();
- return 0;
+ return ECMD_OK;
} else if (welded(uwep)) {
weldmsg(uwep);
/* previously interrupted armor removal mustn't be resumed */
if (wep->o_id && wep->o_id == g.context.objsplit.child_oid)
unsplitobj(wep);
cmdq_clear();
- return 0;
+ return ECMD_OK;
} else if (wep->o_id && wep->o_id == g.context.objsplit.child_oid) {
/* if wep is the result of supplying a count to getobj()
we don't want to split something already wielded; for
uquiver->quan, simpleonames(uquiver));
switch (ynq(qbuf)) {
case 'q':
- return 0;
+ return ECMD_OK;
case 'y':
/* leave N-1 quivered, split off 1 to wield */
wep = splitobj(uquiver, 1L);
(void) Shk_Your(qbuf, uquiver); /* replace qbuf[] contents */
pline("%s%s %s readied.", qbuf,
simpleonames(uquiver), otense(uquiver, "remain"));
- return 0;
+ return ECMD_OK;
}
/* wielding whole readied stack, so no longer quivered */
setuqwep((struct obj *) 0);
} else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
You("cannot wield that!");
cmdq_clear();
- return 0;
+ return ECMD_OK;
}
wielding:
setuswapwep(oldwep);
untwoweapon();
- return result;
+ return result ? ECMD_TIME : ECMD_OK;
}
+/* the #swap command - swap wielded and secondary weapons */
int
doswapweapon(void)
{
if (cantwield(g.youmonst.data)) {
pline("Don't be ridiculous!");
cmdq_clear();
- return 0;
+ return ECMD_OK;
}
if (welded(uwep)) {
weldmsg(uwep);
cmdq_clear();
- return 0;
+ return ECMD_OK;
}
/* Unwield your current secondary weapon */
if (u.twoweap && !can_twoweapon())
untwoweapon();
- return result;
+ return result ? ECMD_TIME : ECMD_OK;
}
+/* the #quiver command */
int
dowieldquiver(void)
{
if (!newquiver) {
/* Cancelled */
- return 0;
+ return ECMD_OK;
} else if (newquiver == &cg.zeroobj) { /* no object */
/* Explicitly nothing */
if (uquiver) {
} else {
You("already have no ammunition readied!");
}
- return 0;
+ return ECMD_OK;
} else if (newquiver->o_id == g.context.objsplit.child_oid) {
/* if newquiver is the result of supplying a count to getobj()
we don't want to split something already in the quiver;
/* don't allow splitting a stack of coins into quiver */
You("can't ready only part of your gold.");
unsplitobj(newquiver);
- return 0;
+ return ECMD_OK;
}
finish_splitting = TRUE;
} else if (newquiver == uquiver) {
already_quivered:
pline("That ammunition is already readied!");
- return 0;
+ return ECMD_OK;
} else if (newquiver->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
You("cannot ready that!");
- return 0;
+ return ECMD_OK;
} else if (newquiver == uwep) {
int weld_res = !uwep->bknown;
if (welded(uwep)) {
weldmsg(uwep);
reset_remarm(); /* same as dowield() */
- return weld_res;
+ return weld_res ? ECMD_TIME : ECMD_OK;
}
/* offer to split stack if wielding more than 1 */
if (uwep->quan > 1L && inv_cnt(FALSE) < 52 && splittable(uwep)) {
uwep->quan, simpleonames(uwep), uwep->quan - 1L);
switch (ynq(qbuf)) {
case 'q':
- return 0;
+ return ECMD_OK;
case 'y':
/* leave 1 wielded, split rest off and put into quiver */
newquiver = splitobj(uwep, uwep->quan - 1L);
(void) Shk_Your(qbuf, uwep); /* replace qbuf[] contents */
pline("%s%s %s wielded.", qbuf,
simpleonames(uwep), otense(uwep, "remain"));
- return 0;
+ return ECMD_OK;
}
/* quivering main weapon, so no longer wielding it */
setuwep((struct obj *) 0);
uswapwep->quan - 1L);
switch (ynq(qbuf)) {
case 'q':
- return 0;
+ return ECMD_OK;
case 'y':
/* leave 1 alt-wielded, split rest off and put into quiver */
newquiver = splitobj(uswapwep, uswapwep->quan - 1L);
pline("%s%s %s %s.", qbuf,
simpleonames(uswapwep), otense(uswapwep, "remain"),
u.twoweap ? "wielded" : "as secondary weapon");
- return 0;
+ return ECMD_OK;
}
/* quivering alternate weapon, so no more uswapwep */
setuswapwep((struct obj *) 0);
You("%s.", are_no_longer_twoweap);
res = 1;
}
- return res;
+ return res ? ECMD_TIME : ECMD_OK;
}
/* used for #rub and for applying pick-axe, whip, grappling hook or polearm */
u.twoweap = on_off;
}
+/* the #twoweapon command */
int
dotwoweapon(void)
{
You("switch to your primary weapon.");
set_twoweap(FALSE); /* u.twoweap = FALSE */
update_inventory();
- return 0;
+ return ECMD_OK;
}
/* May we use two weapons? */
You("begin two-weapon combat.");
set_twoweap(TRUE); /* u.twoweap = TRUE */
update_inventory();
- return (rnd(20) > ACURR(A_DEX));
+ return (rnd(20) > ACURR(A_DEX)) ? ECMD_TIME : ECMD_OK;
}
- return 0;
+ return ECMD_OK;
}
/*** Functions to empty a given slot ***/
if (nohands(g.youmonst.data)) {
You("need hands to be able to write!");
- return 0;
+ return ECMD_OK;
} else if (Glib) {
pline("%s from your %s.", Tobjnam(pen, "slip"),
fingers_or_gloves(FALSE));
dropx(pen);
- return 1;
+ return ECMD_TIME;
}
/* get paper to write on */
paper = getobj("write on", write_ok, GETOBJ_NOFLAGS);
if (!paper)
- return 0;
+ return ECMD_OK;
/* can't write on a novel (unless/until it's been converted into a blank
spellbook), but we want messages saying so to avoid "spellbook" */
typeword = (paper->otyp == SPE_NOVEL)
if (Blind) {
if (!paper->dknown) {
You("don't know if that %s is blank or not.", typeword);
- return 0;
+ return ECMD_OK;
} else if (paper->oclass == SPBOOK_CLASS) {
/* can't write a magic book while blind */
pline("%s can't create braille text.",
upstart(ysimple_name(pen)));
- return 0;
+ return ECMD_OK;
}
}
paper->dknown = 1;
if (paper->otyp != SCR_BLANK_PAPER && paper->otyp != SPE_BLANK_PAPER) {
pline("That %s is not blank!", typeword);
exercise(A_WIS, FALSE);
- return 1;
+ return ECMD_TIME;
}
/* what to write */
getlin(qbuf, namebuf);
(void) mungspaces(namebuf); /* remove any excess whitespace */
if (namebuf[0] == '\033' || !namebuf[0])
- return 1;
+ return ECMD_TIME;
nm = namebuf;
if (!strncmpi(nm, "scroll ", 7))
nm += 7;
}
There("is no such %s!", typeword);
- return 1;
+ return ECMD_TIME;
found:
if (i == SCR_BLANK_PAPER || i == SPE_BLANK_PAPER) {
You_cant("write that!");
pline("It's obscene!");
- return 1;
+ return ECMD_TIME;
} else if (i == SPE_BOOK_OF_THE_DEAD) {
pline("No mere dungeon adventurer could write that.");
- return 1;
+ return ECMD_TIME;
} else if (by_descr && paper->oclass == SPBOOK_CLASS
&& !objects[i].oc_name_known) {
/* can't write unknown spellbooks by description */
pline("Unfortunately you don't have enough information to go on.");
- return 1;
+ return ECMD_TIME;
}
/* KMH, conduct */
if (pen->spe < basecost / 2) {
Your("marker is too dry to write that!");
obfree(new_obj, (struct obj *) 0);
- return 1;
+ return ECMD_TIME;
}
/* we're really going to write now, so calculate cost
useup(paper);
}
obfree(new_obj, (struct obj *) 0);
- return 1;
+ return ECMD_TIME;
}
pen->spe -= actualcost;
useup(paper);
}
obfree(new_obj, (struct obj *) 0);
- return 1;
+ return ECMD_TIME;
}
/* can write scrolls when blind, but requires luck too;
attempts to write books when blind are caught above */
You("fail to write the scroll correctly and it disappears.");
useup(paper);
obfree(new_obj, (struct obj *) 0);
- return 1;
+ return ECMD_TIME;
}
/* useup old scroll / spellbook */
The(aobjnam(new_obj, "slip")),
(const char *) 0);
nhUse(new_obj); /* try to avoid complaint about dead assignment */
- return 1;
+ return ECMD_TIME;
}
/* most book descriptions refer to cover appearance, so we can issue a
return GETOBJ_EXCLUDE;
}
-/* 'z' command (or 'y' if numbed_pad==-1) */
+/* #zap command, 'z' (or 'y' if numbed_pad==-1) */
int
dozap(void)
{
if (nohands(g.youmonst.data)) {
You("aren't able to zap anything in your current form.");
- return 0;
+ return ECMD_OK;
}
if (check_capacity((char *) 0))
- return 0;
+ return ECMD_OK;
obj = getobj("zap", zap_ok, GETOBJ_NOFLAGS);
if (!obj)
- return 0;
+ return ECMD_OK;
check_unpaid(obj);
exercise(A_STR, FALSE);
/* 'obj' is gone; skip update_inventory() because
backfire() -> useupall() -> freeinv() did it */
- return 1;
+ return ECMD_TIME;
} else if (need_dir && !getdir((char *) 0)) {
if (!Blind)
pline("%s glows and fades.", The(xname(obj)));
useupall(obj); /* calls freeinv() -> update_inventory() */
} else
update_inventory(); /* maybe used a charge */
- return 1;
+ return ECMD_TIME;
}
/* Lock or unlock all boxes in inventory */