-/* NetHack 3.6 muse.c $NHDT-Date: 1445556877 2015/10/22 23:34:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
-/* Copyright (C) 1990 by Ken Arromdee */
+/* NetHack 3.6 muse.c $NHDT-Date: 1447987786 2015/11/20 02:49:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.68 $ */
+/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
/*
STATIC_DCL void FDECL(mreadmsg, (struct monst *, struct obj *));
STATIC_DCL void FDECL(mquaffmsg, (struct monst *, struct obj *));
STATIC_PTR int FDECL(mbhitm, (struct monst *, struct obj *));
-STATIC_DCL void FDECL(mbhit,
- (struct monst *, int, int FDECL((*), (MONST_P, OBJ_P)),
- int FDECL((*), (OBJ_P, OBJ_P)), struct obj *));
+STATIC_DCL void FDECL(mbhit, (struct monst *, int,
+ int FDECL((*), (MONST_P, OBJ_P)),
+ int FDECL((*), (OBJ_P, OBJ_P)), struct obj *));
STATIC_DCL void FDECL(you_aggravate, (struct monst *));
-STATIC_DCL void FDECL(mon_consume_unstone,
- (struct monst *, struct obj *, BOOLEAN_P, BOOLEAN_P));
-STATIC_DCL boolean
-FDECL(cures_stoning, (struct monst *, struct obj *, BOOLEAN_P));
+STATIC_DCL void FDECL(mon_consume_unstone, (struct monst *, struct obj *,
+ BOOLEAN_P, BOOLEAN_P));
+STATIC_DCL boolean FDECL(cures_stoning, (struct monst *, struct obj *,
+ BOOLEAN_P));
STATIC_DCL boolean FDECL(mcould_eat_tin, (struct monst *));
-STATIC_DCL boolean
-FDECL(muse_unslime, (struct monst *, struct obj *, BOOLEAN_P));
+STATIC_DCL boolean FDECL(muse_unslime, (struct monst *, struct obj *,
+ BOOLEAN_P));
STATIC_DCL int FDECL(cures_sliming, (struct monst *, struct obj *));
STATIC_DCL boolean FDECL(green_mon, (struct monst *));
*/
} m;
static int trapx, trapy;
-static boolean zap_oseen;
-/* for wands which use mbhitm and are zapped at players. We usually
- * want an oseen local to the function, but this is impossible since the
- * function mbhitm has to be compatible with the normal zap routines,
- * and those routines don't remember who zapped the wand.
- */
+static boolean zap_oseen; /* for wands which use mbhitm and are zapped at
+ * players. We usually want an oseen local to
+ * the function, but this is impossible since the
+ * function mbhitm has to be compatible with the
+ * normal zap routines, and those routines don't
+ * remember who zapped the wand. */
/* Any preliminary checks which may result in the monster being unable to use
* the item. Returns 0 if nothing happened, 2 if the monster can't do
- * anything
- * (i.e. it teleported) and 1 if it's dead.
+ * anything (i.e. it teleported) and 1 if it's dead.
*/
STATIC_OVL int
precheck(mon, obj)
if (vis) {
pline(
"As %s opens the bottle, an enormous %s emerges!",
- mon_nam(mon),
- Hallucination ? rndmonnam(NULL)
- : (const char *) "ghost");
- pline(
- "%s is frightened to death, and unable to move.",
- Monnam(mon));
+ mon_nam(mon),
+ Hallucination ? rndmonnam(NULL)
+ : (const char *) "ghost");
+ pline("%s is frightened to death, and unable to move.",
+ Monnam(mon));
}
paralyze_monst(mon, 3);
}
if (bhitpos.x == u.ux && bhitpos.y == u.uy) {
(*fhitm)(&youmonst, obj);
range -= 3;
- } else if (MON_AT(bhitpos.x, bhitpos.y)) {
- mtmp = m_at(bhitpos.x, bhitpos.y);
+ } else if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) {
if (cansee(bhitpos.x, bhitpos.y) && !canspotmon(mtmp))
map_invisible(bhitpos.x, bhitpos.y);
(*fhitm)(mtmp, obj);
-/* NetHack 3.6 read.c $NHDT-Date: 1446854233 2015/11/06 23:57:13 $ $NHDT-Branch: master $:$NHDT-Revision: 1.121 $ */
+/* NetHack 3.6 read.c $NHDT-Date: 1447987787 2015/11/20 02:49:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.123 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return;
}
+ indices[0] = 0; /* lint suppression */
for (count = 0, i = 1; i < NUM_OBJECTS; i++)
if (OBJ_DESCR(objects[i])
&& (objects[i].oc_name_known || objects[i].oc_uname))
indices[count++] = i;
- randomize(indices, count);
+ if (count > 0) {
+ randomize(indices, count);
- /* forget first % of randomized indices */
- count = ((count * percent) + rn2(100)) / 100;
- for (i = 0; i < count; i++)
- forget_single_object(indices[i]);
+ /* forget first % of randomized indices */
+ count = ((count * percent) + rn2(100)) / 100;
+ for (i = 0; i < count; i++)
+ forget_single_object(indices[i]);
+ }
}
/* Forget some or all of map (depends on parameters). */
* shift the forgetting elsewhere by fiddling with percent
* instead of forgetting fewer levels.
*/
+ indices[0] = 0; /* lint suppression */
for (count = 0, i = 0; i <= maxl; i++)
if ((level_info[i].flags & VISITED)
&& !(level_info[i].flags & FORGOTTEN) && i != this_lev) {
if (percent > 100)
percent = 100;
- randomize(indices, count);
+ if (count > 0) {
+ randomize(indices, count);
- /* forget first % of randomized indices */
- count = ((count * percent) + 50) / 100;
- for (i = 0; i < count; i++) {
- level_info[indices[i]].flags |= FORGOTTEN;
- forget_mapseen(indices[i]);
+ /* forget first % of randomized indices */
+ count = ((count * percent) + 50) / 100;
+ for (i = 0; i < count; i++) {
+ level_info[indices[i]].flags |= FORGOTTEN;
+ forget_mapseen(indices[i]);
+ }
}
}