mklev.c tweaks

Fix a compiler complaint about comparing unsigned against signed,
plus a couple of formatting bits.
This commit is contained in:
PatR
2017-11-25 23:35:39 -08:00
parent 1deb8dbcf1
commit 359db05c2b

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -1344,9 +1344,9 @@ coord *tm;
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);
@@ -1387,18 +1387,17 @@ coord *tm;
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);
@@ -1426,7 +1425,8 @@ coord *tm;
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;
@@ -1445,8 +1445,7 @@ coord *tm;
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;