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
+13 -14
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* 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)) if ((kind == TRAPDOOR || kind == HOLE) && !Can_fall_thru(&u.uz))
kind = ROCKTRAP; kind = ROCKTRAP;
if (tm) if (tm) {
m = *tm; m = *tm;
else { } else {
register int tryct = 0; register int tryct = 0;
boolean avoid_boulder = (kind == PIT || kind == SPIKED_PIT boolean avoid_boulder = (kind == PIT || kind == SPIKED_PIT
|| kind == TRAPDOOR || kind == HOLE); || kind == TRAPDOOR || kind == HOLE);
@@ -1387,18 +1387,17 @@ coord *tm;
lethal, and tend not to generate on shallower levels anyway. lethal, and tend not to generate on shallower levels anyway.
Finally, pits are excluded because it's weird to see an item 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. */ 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 && if (lvl <= (unsigned) rnd(4)
kind != PIT && kind != SPIKED_PIT && kind < HOLE) { && kind != SQKY_BOARD && kind != RUST_TRAP
&& kind != PIT && kind != SPIKED_PIT && kind < HOLE) {
/* Object generated by the trap; initially NULL, stays NULL if /* Object generated by the trap; initially NULL, stays NULL if
we fail to generate an object or if the trap doesn't we fail to generate an object or if the trap doesn't
generate objects */ generate objects. */
struct obj *otmp = NULL; struct obj *otmp = NULL;
/* Race of the victim */ int victim_mnum; /* race of the victim */
int victim_mnum;
/* Not all trap types have special handling here; only the /* Not all trap types have special handling here; only the ones
ones that kill in a specific way that's obvious after the that kill in a specific way that's obvious after the fact. */
fact. */
switch (kind) { switch (kind) {
case ARROW_TRAP: case ARROW_TRAP:
otmp = mksobj(ARROW, TRUE, FALSE); otmp = mksobj(ARROW, TRUE, FALSE);
@@ -1426,7 +1425,8 @@ coord *tm;
food, or gem, i.e. the item classes that are typically food, or gem, i.e. the item classes that are typically
nonmagical and not worthless. */ nonmagical and not worthless. */
do { do {
int poss_class; int poss_class = RANDOM_CLASS; /* init => lint suppression */
switch (rn2(4)) { switch (rn2(4)) {
case 0: case 0:
poss_class = WEAPON_CLASS; poss_class = WEAPON_CLASS;
@@ -1445,8 +1445,7 @@ coord *tm;
otmp = mkobj(poss_class, FALSE); otmp = mkobj(poss_class, FALSE);
/* these items are always cursed, both for flavour (owned /* these items are always cursed, both for flavour (owned
by a dead adventurer, bones-pile-style) and for balance by a dead adventurer, bones-pile-style) and for balance
(less useful to use, and encourage pets to avoid the (less useful to use, and encourage pets to avoid the trap) */
trap) */
if (otmp) { if (otmp) {
otmp->blessed = 0; otmp->blessed = 0;
otmp->cursed = 1; otmp->cursed = 1;