diff --git a/src/botl.c b/src/botl.c index 2a0d2efa0..f24292a2b 100644 --- a/src/botl.c +++ b/src/botl.c @@ -575,7 +575,8 @@ const struct condmap condition_aliases[] = { { "opt_in", BL_MASK_BAREH | BL_MASK_BUSY | BL_MASK_GLOWHANDS | BL_MASK_HELD | BL_MASK_ICY | BL_MASK_PARLYZ | BL_MASK_SLEEPING | BL_MASK_SLIPPERY - | BL_MASK_SUBMERGED | BL_MASK_TETHERED | BL_MASK_TRAPPED + | BL_MASK_SUBMERGED | BL_MASK_TETHERED + | BL_MASK_TRAPPED | BL_MASK_UNCONSC | BL_MASK_WOUNDEDL | BL_MASK_HOLDING }, }; @@ -1298,7 +1299,9 @@ evaluate_and_notify_windowport(boolean *valsetlist, int idx) } void -status_initialize(boolean reassessment) /* TRUE: just recheck fields w/o other initialization */ +status_initialize( + boolean reassessment) /* TRUE: just recheck fields without other + * initialization */ { enum statusfields fld; boolean fldenabl; @@ -1633,7 +1636,8 @@ percentage(struct istat_s *bl, struct istat_s *maxbl) from a non-zero input; note: if we ever change to something like ((((1000 * val) / max) + 5) / 10) for a rounded result, we'll also need to check for and convert false 100 to 99 */ - if (result == 0 && (ival != 0 || lval != 0L || uval != 0U || ulval != 0UL)) + if (result == 0 + && (ival != 0 || lval != 0L || uval != 0U || ulval != 0UL)) result = 1; return result; @@ -1863,12 +1867,13 @@ status_eval_next_unhilite(void) struct istat_s *curr; long next_unhilite, this_unhilite; - g.bl_hilite_moves = g.moves; /* simpllfied; used to try to encode fractional - * amounts for multiple moves within same turn */ + g.bl_hilite_moves = g.moves; /* simpllfied; at one point we used to try + * to encode fractional amounts for multiple + * moves within same turn */ /* figure out whether an unhilight needs to be performed now */ next_unhilite = 0L; for (i = 0; i < MAXBLSTATS; ++i) { - curr = &g.blstats[0][i]; /* g.blstats[0][*].time == g.blstats[1][*].time */ + curr = &g.blstats[0][i]; /* blstats[0][*].time == blstats[1][*].time */ if (curr->chg) { struct istat_s *prev = &g.blstats[1][i]; @@ -2282,8 +2287,11 @@ splitsubfields(char *str, char ***sfarr, int maxsf) #undef MAX_SUBFIELDS static boolean -is_fld_arrayvalues(const char *str, const char *const *arr, - int arrmin, int arrmax, int *retidx) +is_fld_arrayvalues( + const char *str, + const char *const *arr, + int arrmin, int arrmax, + int *retidx) { int i; @@ -2296,7 +2304,10 @@ is_fld_arrayvalues(const char *str, const char *const *arr, } static int -query_arrayvalue(const char *querystr, const char *const *arr, int arrmin, int arrmax) +query_arrayvalue( + const char *querystr, + const char *const *arr, + int arrmin, int arrmax) { int i, res, ret = arrmin - 1; winid tmpwin; @@ -3296,7 +3307,8 @@ status_hilite_menu_choose_behavior(int fld) nopts++; } - Sprintf(buf, "Select %s field hilite behavior:", initblstats[fld].fldname); + Sprintf(buf, "Select %s field hilite behavior:", + initblstats[fld].fldname); end_menu(tmpwin, buf); if (nopts > 1) { @@ -3403,7 +3415,7 @@ status_hilite_menu_add(int origfld) char colorqry[BUFSZ]; char attrqry[BUFSZ]; -choose_field: + choose_field: fld = origfld; if (fld == BL_FLUSH) { fld = status_hilite_menu_choose_field(); @@ -3423,7 +3435,7 @@ choose_field: hilite.set = FALSE; /* mark it "unset" */ hilite.fld = fld; -choose_behavior: + choose_behavior: behavior = status_hilite_menu_choose_behavior(fld); if (behavior == (BL_TH_NONE - 1)) { @@ -3436,7 +3448,7 @@ choose_behavior: hilite.behavior = behavior; -choose_value: + choose_value: if (behavior == BL_TH_VAL_PERCENTAGE || behavior == BL_TH_VAL_ABSOLUTE) { char inbuf[BUFSZ], buf[BUFSZ]; @@ -3642,7 +3654,9 @@ choose_value: hilite.rel = TXT_VALUE; Strcpy(hilite.textmatch, enc_stat[rv]); } else if (fld == BL_ALIGN) { - static const char *aligntxt[] = { "chaotic", "neutral", "lawful" }; + static const char *aligntxt[] = { + "chaotic", "neutral", "lawful" + }; int rv = query_arrayvalue(qry_buf, aligntxt, 0, 2 + 1); @@ -3729,7 +3743,7 @@ choose_value: initblstats[fld].fldname); } -choose_color: + choose_color: clr = query_color(colorqry); if (clr == -1) { if (behavior != BL_TH_ALWAYS_HILITE) @@ -3830,11 +3844,13 @@ status_hilite_remove(int id) hlprev->next = hl->next; } else { g.blstats[0][fld].thresholds = hl->next; - g.blstats[1][fld].thresholds = g.blstats[0][fld].thresholds; + g.blstats[1][fld].thresholds + = g.blstats[0][fld].thresholds; } if (g.blstats[0][fld].hilite_rule == hl) { g.blstats[0][fld].hilite_rule - = g.blstats[1][fld].hilite_rule = (struct hilite_s *) 0; + = g.blstats[1][fld].hilite_rule + = (struct hilite_s *) 0; g.blstats[0][fld].time = g.blstats[1][fld].time = 0L; } free((genericptr_t) hl); @@ -3960,7 +3976,7 @@ status_hilite_menu_fld(int fld) free((genericptr_t) picks); } -shlmenu_free: + shlmenu_free: picks = (menu_item *) 0; destroy_nhwindow(tmpwin); @@ -3998,7 +4014,7 @@ status_hilite_menu(void) boolean redo; int countall; -shlmenu_redo: + shlmenu_redo: redo = FALSE; tmpwin = create_nhwindow(NHW_MENU); diff --git a/src/cmd.c b/src/cmd.c index 5d3397faf..07fb22444 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2074,7 +2074,8 @@ struct ext_func_tab extcmdlist[] = { doborn, IFBURIED | WIZMODECMD, NULL }, #ifdef DEBUG { '\0', "wizbury", "bury objs under and around you", - wiz_debug_cmd_bury, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, + wiz_debug_cmd_bury, IFBURIED | AUTOCOMPLETE | WIZMODECMD, + NULL }, #endif { C('e'), "wizdetect", "reveal hidden things within a small radius", wiz_detect, IFBURIED | WIZMODECMD, NULL }, @@ -3587,7 +3588,7 @@ rhack(char *cmd) register const struct ext_func_tab *tlist; int res, (*func)(void); -do_cmdq_extcmd: + do_cmdq_extcmd: if (cmdq_ec) tlist = cmdq_ec; else diff --git a/src/dig.c b/src/dig.c index 357c4d913..3d4de6988 100644 --- a/src/dig.c +++ b/src/dig.c @@ -230,9 +230,9 @@ dig_check(struct monst *madeby, boolean verbose, int x, int y) static int dig(void) { - register struct rm *lev; - register xchar dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y; - register boolean ispick = uwep && is_pick(uwep); + struct rm *lev; + xchar dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y; + boolean ispick = uwep && is_pick(uwep); const char *verb = (!uwep || is_pick(uwep)) ? "dig into" : "chop through"; lev = &levl[dpx][dpy]; @@ -451,7 +451,7 @@ dig(void) b_trapped("door", 0); newsym(dpx, dpy); } - cleanup: + cleanup: g.context.digging.lastdigtime = g.moves; g.context.digging.quiet = FALSE; g.context.digging.level.dnum = 0; @@ -1471,7 +1471,8 @@ zap_dig(void) coord cc; struct trap *adjpit = t_at(zx, zy); - if ((diridx != DIR_ERR) && !conjoined_pits(adjpit, trap_with_u, FALSE)) { + if (diridx != DIR_ERR + && !conjoined_pits(adjpit, trap_with_u, FALSE)) { digdepth = 0; /* limited to the adjacent location only */ if (!(adjpit && is_pit(adjpit->ttyp))) { char buf[BUFSZ]; diff --git a/src/hacklib.c b/src/hacklib.c index fe2233dbc..93e4565f1 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -219,7 +219,7 @@ str_end_is(const char *str, const char *chkstr) return FALSE; } -/* return the max line length from buffer comprising of newline-separated strings */ +/* return max line length from buffer comprising newline-separated strings */ int str_lines_maxlen(const char *str) { @@ -396,9 +396,10 @@ onlyspace(const char *s) /* expand tabs into proper number of spaces (in place) */ char * -tabexpand(char *sbuf) /* assumed to be [BUFSZ] but can be smaller provided that - * expanded string fits; expansion bigger than BUFSZ-1 - * will be truncated */ +tabexpand( + char *sbuf) /* assumed to be [BUFSZ] but can be smaller provided that + * expanded string fits; expansion bigger than BUFSZ-1 + * will be truncated */ { char buf[BUFSZ + 10]; register char *bp, *s = sbuf; @@ -521,10 +522,11 @@ strsubst(char *bp, const char *orig, const char *replacement) if N is 0, substitute all occurrences; returns the number of subsitutions; maximum output length is BUFSZ (BUFSZ-1 chars + terminating '\0') */ int -strNsubst(char *inoutbuf, /* current string, and result buffer */ - const char *orig, /* old substring; if "" then insert in front of Nth char */ - const char *replacement, /* new substring; if "" then delete old substring */ - int n) /* which occurrence to replace; 0 => all */ +strNsubst( + char *inoutbuf, /* current string, and result buffer */ + const char *orig, /* old substring; if "", insert in front of Nth char */ + const char *replacement, /* new substring; if "", delete old substring */ + int n) /* which occurrence to replace; 0 => all */ { char *bp, *op, workbuf[BUFSZ]; const char *rp; @@ -690,7 +692,7 @@ pmatch_internal(const char *patrn, const char *strng, * Simple pattern matcher: '*' matches 0 or more characters, '?' matches * any single character. Returns TRUE if 'strng' matches 'patrn'. */ -pmatch_top: + pmatch_top: if (!sk) { s = *strng++; p = *patrn++; /* get next chars and pre-advance */ @@ -732,7 +734,9 @@ pmatchi(const char *patrn, const char *strng) return pmatch_internal(patrn, strng, TRUE, (const char *) 0); } -/* case-insensitive wildcard fuzzymatch */ +#if 0 +/* case-insensitive wildcard fuzzymatch; + NEVER WORKED AS INTENDED but fortunately isn't needed */ boolean pmatchz(const char *patrn, const char *strng) { @@ -741,6 +745,7 @@ pmatchz(const char *patrn, const char *strng) return pmatch_internal(patrn, strng, TRUE, fuzzychars); } +#endif #ifndef STRNCMPI /* case insensitive counted string comparison */ @@ -884,14 +889,15 @@ static void set_random(unsigned long seed, int (*fn)(int) UNUSED) { - /* the types are different enough here that sweeping the different - * routine names into one via #defines is even more confusing + /* + * The types are different enough here that sweeping the different + * routine names into one via #defines is even more confusing. */ # ifdef RANDOM /* srandom() from sys/share/random.c */ srandom((unsigned int) seed); # else -# if defined(__APPLE__) || defined(BSD) || defined(LINUX) || defined(ULTRIX) \ - || defined(CYGWIN32) /* system srandom() */ +# if defined(__APPLE__) || defined(BSD) || defined(LINUX) \ + || defined(ULTRIX) || defined(CYGWIN32) /* system srandom() */ # if defined(BSD) && !defined(POSIX_TYPES) && defined(SUNOS4) (void) # endif @@ -1227,7 +1233,7 @@ nonconst(const char *str, char *buf, size_t bufsz) if (str && buf) if (strlen(str) <= (bufsz - 1)) { - Strcpy(buf, str); + Strcpy(buf, str); retval = buf; } return retval; @@ -1265,15 +1271,17 @@ DISABLE_WARNING_FORMAT_NONLITERAL * Wrap reasons: * 1. If there are any platform issues, we have one spot to fix them - * snprintf is a routine with a troubling history of bad implementations. - * 2. Add combersome error checking in one spot. Problems with text wrangling - * do not have to be fatal. + * 2. Add combersome error checking in one spot. Problems with text + * wrangling do not have to be fatal. * 3. Gcc 9+ will issue a warning unless the return value is used. * Annoyingly, explicitly casting to void does not remove the error. * So, use the result - see reason #2. */ void -nh_snprintf(const char *func, int line, char *str, size_t size, - const char *fmt, ...) +nh_snprintf( + const char *func, int line, + char *str, size_t size, + const char *fmt, ...) { va_list ap; int n; @@ -1285,12 +1293,11 @@ nh_snprintf(const char *func, int line, char *str, size_t size, n = vsnprintf(str, size, fmt, ap); #endif va_end(ap); - if (n < 0 || (size_t)n >= size) { /* is there a problem? */ + if (n < 0 || (size_t) n >= size) { /* is there a problem? */ impossible("snprintf %s: func %s, file line %d", - n < 0 ? "format error" - : "overflow", + (n < 0) ? "format error" : "overflow", func, line); - str[size-1] = 0; /* make sure it is nul terminated */ + str[size - 1] = '\0'; /* make sure it is nul terminated */ } } diff --git a/src/mkmap.c b/src/mkmap.c index 78cd7b36d..4096a9be2 100644 --- a/src/mkmap.c +++ b/src/mkmap.c @@ -57,8 +57,10 @@ get_map(int col, int row, schar bg_typ) return levl[col][row].typ; } -static const int dirs[16] = { -1, -1 /**/, -1, 0 /**/, -1, 1 /**/, 0, -1 /**/, - 0, 1 /**/, 1, -1 /**/, 1, 0 /**/, 1, 1 }; +static const int dirs[16] = { + -1, -1 /**/, -1, 0 /**/, -1, 1 /**/, 0, -1 /**/, + 0, 1 /**/, 1, -1 /**/, 1, 0 /**/, 1, 1 +}; static void pass_one(schar bg_typ, schar fg_typ) @@ -257,8 +259,8 @@ join_map(schar bg_typ, schar fg_typ) g.n_loc_filled = 0; flood_fill_rm(i, j, g.nroom + ROOMOFFSET, FALSE, FALSE); if (g.n_loc_filled > 3) { - add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, OROOM, - TRUE); + add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, + FALSE, OROOM, TRUE); g.rooms[g.nroom - 1].irregular = TRUE; if (g.nroom >= (MAXNROFROOMS * 2)) goto joinm; @@ -278,14 +280,15 @@ join_map(schar bg_typ, schar fg_typ) } } -joinm: + joinm: /* * Ok, now we can actually join the regions with fg_typ's. * The rooms are already sorted due to the previous loop, * so don't call sort_rooms(), which can screw up the roomno's * validity in the levl structure. */ - for (croom = &g.rooms[0], croom2 = croom + 1; croom2 < &g.rooms[g.nroom];) { + for (croom = &g.rooms[0], croom2 = croom + 1; + croom2 < &g.rooms[g.nroom]; ) { /* pick random starting and end locations for "corridor" */ if (!somexy(croom, &sm) || !somexy(croom2, &em)) { /* ack! -- the level is going to be busted */ diff --git a/src/mkroom.c b/src/mkroom.c index 1e9de22c5..c1fc92a92 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -284,7 +284,7 @@ fill_zoo(struct mkroom* sroom) tx = mm.x; ty = mm.y; } while (occupied((xchar) tx, (xchar) ty) && --i > 0); - throne_placed: + throne_placed: mk_zoo_thronemon(tx, ty); break; case BEEHIVE: @@ -526,7 +526,8 @@ mkswamp(void) /* Michiel Huisjes & Fred de Wilde */ sroom->rtype = SWAMP; for (sx = sroom->lx; sx <= sroom->hx; sx++) for (sy = sroom->ly; sy <= sroom->hy; sy++) { - if (!IS_ROOM(levl[sx][sy].typ) || (int) levl[sx][sy].roomno != rmno) + if (!IS_ROOM(levl[sx][sy].typ) + || (int) levl[sx][sy].roomno != rmno) continue; if (!OBJ_AT(sx, sy) && !MON_AT(sx, sy) && !t_at(sx, sy) && !nexttodoor(sx, sy)) { @@ -705,7 +706,7 @@ somexy(struct mkroom* croom,coord * c) if (inside_room(croom->sbrooms[i], c->x, c->y)) goto you_lose; break; - you_lose: + you_lose: ; } if (try_cnt >= 100) @@ -802,7 +803,7 @@ squadmon(void) } } mndx = squadprob[rn2(SIZE(squadprob))].pm; -gotone: + gotone: if (!(g.mvitals[mndx].mvflags & G_GONE)) return &mons[mndx]; else diff --git a/src/pline.c b/src/pline.c index a8ff17f50..300f44fd2 100644 --- a/src/pline.c +++ b/src/pline.c @@ -197,7 +197,7 @@ vpline(const char *line, va_list the_args) if (msgtyp == MSGTYP_STOP) display_nhwindow(WIN_MESSAGE, TRUE); /* --more-- */ -pline_done: + pline_done: --in_pline; } diff --git a/src/priest.c b/src/priest.c index 36a8cb984..63692de00 100644 --- a/src/priest.c +++ b/src/priest.c @@ -73,7 +73,7 @@ move_special(struct monst *mtmp, boolean in_his_shop, schar appr, } #define GDIST(x, y) (dist2(x, y, gx, gy)) -pick_move: + pick_move: chcnt = 0; for (i = 0; i < cnt; i++) { nx = poss[i].x; @@ -213,14 +213,18 @@ pri_move(struct monst *priest) /* exclusively for mktemple() */ void -priestini(d_level *lvl, struct mkroom *sroom, int sx, int sy, - boolean sanctum) /* is it the seat of the high priest? */ +priestini( + d_level *lvl, + struct mkroom *sroom, + int sx, int sy, + boolean sanctum) /* is it the seat of the high priest? */ { struct monst *priest; struct obj *otmp; int cnt; int px = 0, py = 0, i, si = rn2(N_DIRS); - struct permonst *prim = &mons[sanctum ? PM_HIGH_CLERIC : PM_ALIGNED_CLERIC]; + struct permonst *prim = &mons[sanctum ? PM_HIGH_CLERIC + : PM_ALIGNED_CLERIC]; for (i = 0; i < N_DIRS; i++) { px = sx + xdir[DIR_CLAMP(i+si)]; @@ -707,8 +711,9 @@ reset_hostility(struct monst *roamer) } boolean -in_your_sanctuary(struct monst *mon, /* if non-null, overrides */ - xchar x, xchar y) +in_your_sanctuary( + struct monst *mon, /* if non-null, overrides */ + xchar x, xchar y) { register char roomno; register struct monst *priest; diff --git a/src/region.c b/src/region.c index 4f3390935..b7c5e7379 100644 --- a/src/region.c +++ b/src/region.c @@ -617,27 +617,32 @@ save_regions(NHFILE* nhfp) if (!perform_bwrite(nhfp)) goto skip_lots; if (nhfp->structlevel) { - bwrite(nhfp->fd, (genericptr_t) &g.moves, sizeof (g.moves)); /* timestamp */ + /* timestamp */ + bwrite(nhfp->fd, (genericptr_t) &g.moves, sizeof (g.moves)); bwrite(nhfp->fd, (genericptr_t) &g.n_regions, sizeof (g.n_regions)); } for (i = 0; i < g.n_regions; i++) { if (nhfp->structlevel) { - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->bounding_box, sizeof (NhRect)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->nrects, sizeof (short)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->bounding_box, + sizeof (NhRect)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->nrects, + sizeof (short)); } for (j = 0; j < g.regions[i]->nrects; j++) { if (nhfp->structlevel) - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->rects[j], sizeof (NhRect)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->rects[j], + sizeof (NhRect)); } if (nhfp->structlevel) - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_u, sizeof (boolean)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_u, + sizeof (boolean)); n = 0; if (nhfp->structlevel) - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_m, sizeof (unsigned)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_m, + sizeof (unsigned)); - n = g.regions[i]->enter_msg != (const char *)0 ? - strlen(g.regions[i]->enter_msg) : 0; + n = !g.regions[i]->enter_msg ? 0 : strlen(g.regions[i]->enter_msg); if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &n, sizeof n); @@ -645,8 +650,7 @@ save_regions(NHFILE* nhfp) if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) g.regions[i]->enter_msg, n); } - n = g.regions[i]->leave_msg != (const char *)0 ? - strlen(g.regions[i]->leave_msg) : 0; + n = !g.regions[i]->leave_msg ? 0 : strlen(g.regions[i]->leave_msg); if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &n, sizeof n); @@ -656,29 +660,41 @@ save_regions(NHFILE* nhfp) } } if (nhfp->structlevel) { - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->ttl, sizeof (long)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->expire_f, sizeof (short)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->can_enter_f, sizeof (short)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->enter_f, sizeof (short)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->can_leave_f, sizeof (short)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->leave_f, sizeof (short)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->inside_f, sizeof (short)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->player_flags, sizeof (unsigned int)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->n_monst, sizeof (short)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->ttl, + sizeof (long)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->expire_f, + sizeof (short)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->can_enter_f, + sizeof (short)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->enter_f, + sizeof (short)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->can_leave_f, + sizeof (short)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->leave_f, + sizeof (short)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->inside_f, + sizeof (short)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->player_flags, + sizeof (unsigned int)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->n_monst, + sizeof (short)); } for (j = 0; j < g.regions[i]->n_monst; j++) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->monsters[j], - sizeof (unsigned)); + sizeof (unsigned)); } if (nhfp->structlevel) { - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->visible, sizeof (boolean)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->glyph, sizeof (int)); - bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->arg, sizeof (anything)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->visible, + sizeof (boolean)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->glyph, + sizeof (int)); + bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->arg, + sizeof (anything)); } } - skip_lots: + skip_lots: if (release_data(nhfp)) clear_regions(); } @@ -692,7 +708,7 @@ rest_regions(NHFILE* nhfp) char *msg_buf; boolean ghostly = (nhfp->ftype == NHF_BONESFILE); - clear_regions(); /* Just for security */ + clear_regions(); /* Just for security */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &tmstamp, sizeof (tmstamp)); if (ghostly) @@ -709,19 +725,24 @@ rest_regions(NHFILE* nhfp) for (i = 0; i < g.n_regions; i++) { g.regions[i] = (NhRegion *) alloc(sizeof (NhRegion)); if (nhfp->structlevel) { - mread(nhfp->fd, (genericptr_t) &g.regions[i]->bounding_box, sizeof (NhRect)); - mread(nhfp->fd, (genericptr_t) &g.regions[i]->nrects, sizeof (short)); + mread(nhfp->fd, (genericptr_t) &g.regions[i]->bounding_box, + sizeof (NhRect)); + mread(nhfp->fd, (genericptr_t) &g.regions[i]->nrects, + sizeof (short)); } if (g.regions[i]->nrects > 0) - g.regions[i]->rects = (NhRect *) - alloc(sizeof (NhRect) * g.regions[i]->nrects); + g.regions[i]->rects = (NhRect *) alloc( + sizeof (NhRect) * g.regions[i]->nrects); for (j = 0; j < g.regions[i]->nrects; j++) { if (nhfp->structlevel) - mread(nhfp->fd, (genericptr_t) &g.regions[i]->rects[j], sizeof (NhRect)); + mread(nhfp->fd, (genericptr_t) &g.regions[i]->rects[j], + sizeof (NhRect)); } if (nhfp->structlevel) { - mread(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_u, sizeof (boolean)); - mread(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_m, sizeof (unsigned)); + mread(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_u, + sizeof (boolean)); + mread(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_m, + sizeof (unsigned)); } if (nhfp->structlevel) @@ -744,7 +765,7 @@ rest_regions(NHFILE* nhfp) mread(nhfp->fd, (genericptr_t) msg_buf, n); } msg_buf[n] = '\0'; - g.regions[i]->leave_msg = (const char *) msg_buf; + g.regions[i]->leave_msg = (const char *) msg_buf; } else g.regions[i]->leave_msg = (const char *)0; @@ -752,8 +773,9 @@ rest_regions(NHFILE* nhfp) mread(nhfp->fd, (genericptr_t) &g.regions[i]->ttl, sizeof (long)); /* check for expired region */ if (g.regions[i]->ttl >= 0L) - g.regions[i]->ttl = - (g.regions[i]->ttl > tmstamp) ? g.regions[i]->ttl - tmstamp : 0L; + g.regions[i]->ttl = ((g.regions[i]->ttl > tmstamp) + ? g.regions[i]->ttl - tmstamp + : 0L); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &g.regions[i]->expire_f, sizeof (short)); @@ -770,15 +792,16 @@ rest_regions(NHFILE* nhfp) mread(nhfp->fd, (genericptr_t) &g.regions[i]->player_flags, sizeof (unsigned int)); } - if (ghostly) { /* settings pertained to old player */ + if (ghostly) { /* settings pertained to old player */ clear_hero_inside(g.regions[i]); clear_heros_fault(g.regions[i]); } if (nhfp->structlevel) - mread(nhfp->fd, (genericptr_t) &g.regions[i]->n_monst, sizeof (short)); + mread(nhfp->fd, (genericptr_t) &g.regions[i]->n_monst, + sizeof (short)); if (g.regions[i]->n_monst > 0) - g.regions[i]->monsters = - (unsigned *) alloc(sizeof (unsigned) * g.regions[i]->n_monst); + g.regions[i]->monsters = (unsigned *) alloc( + sizeof (unsigned) * g.regions[i]->n_monst); else g.regions[i]->monsters = (unsigned int *)0; g.regions[i]->max_monst = g.regions[i]->n_monst; @@ -788,9 +811,11 @@ rest_regions(NHFILE* nhfp) sizeof (unsigned)); } if (nhfp->structlevel) { - mread(nhfp->fd, (genericptr_t) &g.regions[i]->visible, sizeof (boolean)); + mread(nhfp->fd, (genericptr_t) &g.regions[i]->visible, + sizeof (boolean)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->glyph, sizeof (int)); - mread(nhfp->fd, (genericptr_t) &g.regions[i]->arg, sizeof (anything)); + mread(nhfp->fd, (genericptr_t) &g.regions[i]->arg, + sizeof (anything)); } } /* remove expired regions, do not trigger the expire_f callback (yet!); @@ -806,14 +831,18 @@ DISABLE_WARNING_FORMAT_NONLITERAL /* to support '#stats' wizard-mode command */ void -region_stats(const char* hdrfmt, char* hdrbuf, long* count, long* size) +region_stats( + const char *hdrfmt, + char *hdrbuf, + long *count, + long *size) { NhRegion *rg; int i; /* other stats formats take one parameter; this takes two */ Sprintf(hdrbuf, hdrfmt, (long) sizeof (NhRegion), (long) sizeof (NhRect)); - *count = (long) g.n_regions; /* might be 0 even though g.max_regions isn't */ + *count = (long) g.n_regions; /* might be 0 even though max_regions isn't */ *size = (long) g.max_regions * (long) sizeof (NhRegion); for (i = 0; i < g.n_regions; ++i) { rg = g.regions[i]; @@ -1110,9 +1139,9 @@ create_gas_cloud(xchar x, xchar y, int cloudsize, int damage) } } } - /* we have now either filled up xcoord and ycoord entirely or run out of - * space. In either case, newidx is the correct total number of coordinates - * inserted. */ + /* We have now either filled up xcoord and ycoord entirely or run out + of space. In either case, newidx is the correct total number of + coordinates inserted. */ cloud = create_region((NhRect *) 0, 0); for (i = 0; i < newidx; ++i) { tmprect.lx = tmprect.hx = xcoords[i]; @@ -1120,8 +1149,7 @@ create_gas_cloud(xchar x, xchar y, int cloudsize, int damage) add_rect_to_reg(cloud, &tmprect); } cloud->ttl = rn1(3, 4); - /* If the cloud was constrained in a small space, give it more time to - * live. */ + /* If cloud was constrained in small space, give it more time to live. */ cloud->ttl = (cloud->ttl * cloudsize) / newidx; if (!g.in_mklev && !g.context.mon_moving) diff --git a/src/shknam.c b/src/shknam.c index 2cdf0bf2f..0a157e74c 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -609,7 +609,7 @@ shkinit(const struct shclass* shp, struct mkroom* sroom) } else if (sy == sroom->hy + 1) { sy--; } else { - shk_failed: + shk_failed: #ifdef DEBUG /* Said to happen sometimes, but I have never seen it. */ /* Supposedly fixed by fdoor change in mklev.c */ diff --git a/src/sit.c b/src/sit.c index 1939334d2..f5813798f 100644 --- a/src/sit.c +++ b/src/sit.c @@ -125,7 +125,7 @@ dosit(void) else You("sit down on the muddy bottom."); } else if (is_pool(u.ux, u.uy) && !eggs_in_water(g.youmonst.data)) { - in_water: + in_water: You("sit in the %s.", hliquid("water")); if (!rn2(10) && uarm) (void) water_damage(uarm, "armor", TRUE); diff --git a/src/vision.c b/src/vision.c index a41072e87..871c4868c 100644 --- a/src/vision.c +++ b/src/vision.c @@ -667,7 +667,7 @@ vision_recalc(int control) do_light_sources(next_array); /* - * Make the g.viz_array the new array so that cansee() will work correctly. + * Make the viz_array the new array so that cansee() will work correctly. */ temp_array = g.viz_array; g.viz_array = next_array; @@ -783,7 +783,7 @@ vision_recalc(int control) * infrared monster there. */ } else { - not_in_sight: + not_in_sight: if ((old_row[col] & IN_SIGHT) || ((next_row[col] & COULD_SEE) ^ (old_row[col] & COULD_SEE))) @@ -794,7 +794,7 @@ vision_recalc(int control) } /* end for row . . */ colbump[u.ux] = colbump[u.ux + 1] = 0; -skip: + skip: /* This newsym() caused a crash delivering msg about failure to open * dungeon file init_dungeons() -> panic() -> done(11) -> * vision_recalc(2) -> newsym() -> crash! u.ux and u.uy are 0 and @@ -1550,7 +1550,7 @@ clear_path(int col1, int row1, int col2, int row2) } } #ifdef MACRO_CPATH -cleardone: + cleardone: #endif return (boolean) result; } @@ -1668,7 +1668,7 @@ right_side(int row, int left, int right_mark, const xchar *limits) } else { q4_path(start_row, start_col, row, left, rside1); } - rside1: /* used if q?_path() is a macro */ + rside1: /* used if q?_path() is a macro */ if (result) break; } @@ -1722,7 +1722,7 @@ right_side(int row, int left, int right_mark, const xchar *limits) } else { q4_path(start_row, start_col, row, right, rside2); } - rside2: /* used if q?_path() is a macro */ + rside2: /* used if q?_path() is a macro */ if (!result) break; } @@ -1833,7 +1833,7 @@ left_side(int row, int left_mark, int right, const xchar *limits) } else { q3_path(start_row, start_col, row, right, lside1); } - lside1: /* used if q?_path() is a macro */ + lside1: /* used if q?_path() is a macro */ if (result) break; } @@ -1865,7 +1865,7 @@ left_side(int row, int left_mark, int right, const xchar *limits) } else { q3_path(start_row, start_col, row, left, lside2); } - lside2: /* used if q?_path() is a macro */ + lside2: /* used if q?_path() is a macro */ if (!result) break; } diff --git a/src/write.c b/src/write.c index 1614735ea..b9ad55c75 100644 --- a/src/write.c +++ b/src/write.c @@ -214,7 +214,7 @@ dowrite(struct obj *pen) There("is no such %s!", typeword); return 1; -found: + found: if (i == SCR_BLANK_PAPER || i == SPE_BLANK_PAPER) { You_cant("write that!");