diff --git a/src/end.c b/src/end.c index 5e1fd0b01..111766f44 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1447576343 2015/11/15 08:32:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.103 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1448094339 2015/11/21 08:25:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.105 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -588,14 +588,15 @@ int category; char *defquery; { int idx; - char *dop = index(disclosure_options, category); + char *dop; - if (dop && defquery) { + *defquery = 'n'; + if ((dop = index(disclosure_options, category)) != 0) { idx = (int) (dop - disclosure_options); - if (idx < 0 || idx > (NUM_DISCLOSURE_OPTIONS - 1)) { + if (idx < 0 || idx >= NUM_DISCLOSURE_OPTIONS) { impossible( - "should_query_disclose_option: bad disclosure index %d %c", - idx, category); + "should_query_disclose_option: bad disclosure index %d %c", + idx, category); *defquery = DISCLOSE_PROMPT_DEFAULT_YES; return TRUE; } @@ -613,10 +614,7 @@ char *defquery; return TRUE; } } - if (defquery) - impossible("should_query_disclose_option: bad category %c", category); - else - impossible("should_query_disclose_option: null defquery"); + impossible("should_query_disclose_option: bad category %c", category); return TRUE; } @@ -625,7 +623,7 @@ disclose(how, taken) int how; boolean taken; { - char c = 0, defquery; + char c = '\0', defquery; char qbuf[QBUFSZ]; boolean ask = FALSE; @@ -1432,8 +1430,8 @@ boolean ask; */ if (ntypes != 0) { c = ask ? yn_function( - "Do you want an account of creatures vanquished?", - ynqchars, defquery) + "Do you want an account of creatures vanquished?", + ynqchars, defquery) : defquery; if (c == 'q') done_stopprint++; @@ -1611,7 +1609,6 @@ int id; if (k->id == id) break; } - return k; } diff --git a/src/options.c b/src/options.c index 7772dcf51..91a9700b3 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 options.c $NHDT-Date: 1447234076 2015/11/11 09:27:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.240 $ */ +/* NetHack 3.6 options.c $NHDT-Date: 1448094341 2015/11/21 08:25:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.241 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1015,20 +1015,19 @@ warning_opts(opts, optype) register char *opts; const char *optype; { - uchar translate[MAXPCHARS + 1]; + uchar translate[WARNCOUNT]; int length, i; if (!(opts = string_for_env_opt(optype, opts, FALSE))) return; escapes(opts, opts); - length = strlen(opts); - if (length > WARNCOUNT) - length = WARNCOUNT; + length = (int) strlen(opts); /* match the form obtained from PC configuration files */ - for (i = 0; i < length; i++) - translate[i] = (((i < WARNCOUNT) && opts[i]) ? (uchar) opts[i] - : def_warnsyms[i].sym); + for (i = 0; i < WARNCOUNT; i++) + translate[i] = (i >= length) ? 0 + : opts[i] ? (uchar) opts[i] + : def_warnsyms[i].sym; assign_warnings(translate); } diff --git a/src/shknam.c b/src/shknam.c index ae6d3d68b..728976cba 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shknam.c $NHDT-Date: 1446887533 2015/11/07 09:12:13 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */ +/* NetHack 3.6 shknam.c $NHDT-Date: 1448094342 2015/11/21 08:25:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -186,10 +186,9 @@ static const char *const shkhealthfoods[] = { /* * To add new shop types, all that is necessary is to edit the shtypes[] - * array. - * See mkroom.h for the structure definition. Typically, you'll have to lower - * some or all of the probability fields in old entries to free up some - * percentage for the new type. + * array. See mkroom.h for the structure definition. Typically, you'll + * have to lower some or all of the probability fields in old entries to + * free up some percentage for the new type. * * The placement type field is not yet used but will be in the near future. * @@ -200,7 +199,6 @@ static const char *const shkhealthfoods[] = { * In the latter case, prepend it with a unary minus so the code can know * (by testing the sign) whether to use mkobj() or mksobj(). */ - const struct shclass shtypes[] = { { "general store", RANDOM_CLASS, @@ -407,6 +405,7 @@ shkveg() int ok[NUM_OBJECTS]; j = maxprob = 0; + ok[0] = 0; /* lint suppression */ for (i = bases[(int) oclass]; i < NUM_OBJECTS; ++i) { if (objects[i].oc_class != oclass) break; @@ -735,7 +734,8 @@ register struct mkroom *sroom; for (sx = sroom->lx; sx <= sroom->hx; sx++) for (sy = sroom->ly; sy <= sroom->hy; sy++) { if (sroom->irregular) { - if (levl[sx][sy].edge || (int) levl[sx][sy].roomno != rmno + if (levl[sx][sy].edge + || (int) levl[sx][sy].roomno != rmno || distmin(sx, sy, doors[sh].x, doors[sh].y) <= 1) continue; } else if ((sx == sroom->lx && doors[sh].x == sx - 1) @@ -752,7 +752,8 @@ register struct mkroom *sroom; for (sx = sroom->lx; sx <= sroom->hx; sx++) for (sy = sroom->ly; sy <= sroom->hy; sy++) { if (sroom->irregular) { - if (levl[sx][sy].edge || (int) levl[sx][sy].roomno != rmno + if (levl[sx][sy].edge + || (int) levl[sx][sy].roomno != rmno || distmin(sx, sy, doors[sh].x, doors[sh].y) <= 1) continue; } else if ((sx == sroom->lx && doors[sh].x == sx - 1) diff --git a/src/sp_lev.c b/src/sp_lev.c index 3388c4c5f..659e6a16f 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sp_lev.c $NHDT-Date: 1447836300 2015/11/18 08:45:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.73 $ */ +/* NetHack 3.6 sp_lev.c $NHDT-Date: 1448094343 2015/11/21 08:25:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.75 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -23,8 +23,8 @@ typedef void FDECL((*select_iter_func), (int, int, genericptr_t)); extern void FDECL(mkmap, (lev_init *)); STATIC_DCL void FDECL(get_room_loc, (schar *, schar *, struct mkroom *)); -STATIC_DCL void FDECL(get_free_room_loc, - (schar *, schar *, struct mkroom *, packed_coord)); +STATIC_DCL void FDECL(get_free_room_loc, (schar *, schar *, + struct mkroom *, packed_coord)); STATIC_DCL void FDECL(create_trap, (trap *, struct mkroom *)); STATIC_DCL int FDECL(noncoalignment, (ALIGNTYP_P)); STATIC_DCL boolean FDECL(m_bad_boulder_spot, (int, int)); @@ -976,9 +976,6 @@ packed_coord pos; schar try_x, try_y; register int trycnt = 0; - if (!x || !y) - panic("get_free_room_loc: x or y is null"); - get_location_coord(&try_x, &try_y, DRY, croom, pos); if (levl[try_x][try_y].typ != ROOM) { do { diff --git a/src/trap.c b/src/trap.c index a0ca296ea..495525045 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.c $NHDT-Date: 1448073071 2015/11/21 02:31:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.247 $ */ +/* NetHack 3.6 trap.c $NHDT-Date: 1448094344 2015/11/21 08:25:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.248 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3781,6 +3781,7 @@ struct trap *ttmp; xchar x = ttmp->tx, y = ttmp->ty, bx, by, cx, cy; boolean unused; + bx = by = cx = cy = 0; /* lint suppression */ /* we know there's no monster in the way, and we're not trapped */ if (!Punished || drag_ball(x, y, &bc, &bx, &by, &cx, &cy, &unused, TRUE)) {