-/* NetHack 3.6 mklev.c $NHDT-Date: 1446191876 2015/10/30 07:57:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
+/* NetHack 3.6 mklev.c $NHDT-Date: 1511681724 2017/11/26 07:35:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.47 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
if ((kind == TRAPDOOR || kind == HOLE) && !Can_fall_thru(&u.uz))
kind = ROCKTRAP;
- if (tm)
+ if (tm) {
m = *tm;
- else {
+ } else {
register int tryct = 0;
boolean avoid_boulder = (kind == PIT || kind == SPIKED_PIT
|| kind == TRAPDOOR || kind == HOLE);
lethal, and tend not to generate on shallower levels anyway.
Finally, pits are excluded because it's weird to see an item
in a pit and yet not be able to identify that the pit is there. */
- if (lvl <= rnd(4) && kind != SQKY_BOARD && kind != RUST_TRAP &&
- kind != PIT && kind != SPIKED_PIT && kind < HOLE) {
+ if (lvl <= (unsigned) rnd(4)
+ && kind != SQKY_BOARD && kind != RUST_TRAP
+ && kind != PIT && kind != SPIKED_PIT && kind < HOLE) {
/* Object generated by the trap; initially NULL, stays NULL if
we fail to generate an object or if the trap doesn't
- generate objects */
+ generate objects. */
struct obj *otmp = NULL;
- /* Race of the victim */
- int victim_mnum;
+ int victim_mnum; /* race of the victim */
- /* Not all trap types have special handling here; only the
- ones that kill in a specific way that's obvious after the
- fact. */
+ /* Not all trap types have special handling here; only the ones
+ that kill in a specific way that's obvious after the fact. */
switch (kind) {
case ARROW_TRAP:
otmp = mksobj(ARROW, TRUE, FALSE);
food, or gem, i.e. the item classes that are typically
nonmagical and not worthless. */
do {
- int poss_class;
+ int poss_class = RANDOM_CLASS; /* init => lint suppression */
+
switch (rn2(4)) {
case 0:
poss_class = WEAPON_CLASS;
otmp = mkobj(poss_class, FALSE);
/* these items are always cursed, both for flavour (owned
by a dead adventurer, bones-pile-style) and for balance
- (less useful to use, and encourage pets to avoid the
- trap) */
+ (less useful to use, and encourage pets to avoid the trap) */
if (otmp) {
otmp->blessed = 0;
otmp->cursed = 1;