| 1976 | DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after do_supplemental_info() */ |
| 1977 | |
| 1978 | staticfn void |
| 1979 | look_all( |
| 1980 | boolean nearby, /* True => within BOLTLIM, False => entire map */ |
| 1981 | boolean do_mons) /* True => monsters, False => objects */ |
| 1982 | { |
| 1983 | winid win; |
| 1984 | int glyph, count = 0; |
| 1985 | coordxy x, y, lo_x, lo_y, hi_x, hi_y; |
| 1986 | char lookbuf[BUFSZ], outbuf[BUFSZ]; |
| 1987 | |
| 1988 | win = create_nhwindow(NHW_TEXT); |
| 1989 | look_region_nearby(&lo_x, &lo_y, &hi_x, &hi_y, nearby); |
| 1990 | for (y = lo_y; y <= hi_y; y++) { |
| 1991 | for (x = lo_x; x <= hi_x; x++) { |
| 1992 | lookbuf[0] = '\0'; |
| 1993 | glyph = glyph_at(x, y); |
| 1994 | if (do_mons) { |
| 1995 | if (glyph_is_monster(glyph)) { |
| 1996 | struct monst *mtmp; |
| 1997 | |
| 1998 | if (u_at(x, y) && canspotself()) { |
| 1999 | (void) self_lookat(lookbuf); |
| 2000 | ++count; |
| 2001 | } else if ((mtmp = m_at(x, y)) != 0) { |
| 2002 | look_at_monster(lookbuf, (char *) 0, mtmp, x, y); |
| 2003 | ++count; |
| 2004 | } |
| 2005 | } else if (glyph_is_invisible(glyph)) { |
| 2006 | /* remembered, unseen, creature */ |
| 2007 | Strcpy(lookbuf, invisexplain); |
| 2008 | ++count; |
| 2009 | } else if (glyph_is_warning(glyph)) { |
| 2010 | int warnindx = glyph_to_warning(glyph); |
| 2011 | |
| 2012 | Strcpy(lookbuf, def_warnsyms[warnindx].explanation); |
| 2013 | ++count; |
| 2014 | } |
| 2015 | } else { /* !do_mons */ |
| 2016 | if (glyph_is_object(glyph)) { |
| 2017 | look_at_object(lookbuf, x, y, glyph); |
| 2018 | ++count; |
| 2019 | } |
| 2020 | } |
| 2021 | if (*lookbuf) { |
| 2022 | char coordbuf[20], which[12], cmode; |
| 2023 | |
| 2024 | cmode = (iflags.getpos_coords != GPCOORDS_NONE) |
| 2025 | ? iflags.getpos_coords : GPCOORDS_MAP; |
| 2026 | if (count == 1) { |
| 2027 | Strcpy(which, do_mons ? "monsters" : "objects"); |
| 2028 | if (nearby) |
| 2029 | Sprintf(outbuf, "%s currently shown near %s:", |
| 2030 | upstart(which), |
| 2031 | (cmode != GPCOORDS_COMPASS) |
| 2032 | ? coord_desc(u.ux, u.uy, coordbuf, cmode) |
| 2033 | : !canspotself() ? "your position" : "you"); |
| 2034 | else |
| 2035 | Sprintf(outbuf, "All %s currently shown on the map:", |
no test coverage detected