MCPcopy Index your code
hub / github.com/NetHack/NetHack / wiz_light_sources

Function wiz_light_sources

src/light.c:934–975  ·  view source on GitHub ↗

the #lightsources command */

Source from the content-addressed store, hash-verified

932
933/* the #lightsources command */
934int
935wiz_light_sources(void)
936{
937 winid win;
938 char buf[BUFSZ];
939 light_source *ls;
940
941 win = create_nhwindow(NHW_MENU); /* corner text window */
942 if (win == WIN_ERR)
943 return ECMD_OK;
944
945 Sprintf(buf, "Mobile light sources: hero @ (%2d,%2d)", u.ux, u.uy);
946 putstr(win, 0, buf);
947 putstr(win, 0, "");
948
949 if (gl.light_base) {
950 putstr(win, 0, "location range flags type id");
951 putstr(win, 0, "-------- ----- ------ ---- -------");
952 for (ls = gl.light_base; ls; ls = ls->next) {
953 Sprintf(buf, " %2d,%2d %2d 0x%04x %s %s", ls->x, ls->y,
954 ls->range, ls->flags,
955 (ls->type == LS_OBJECT
956 ? "obj"
957 : ls->type == LS_MONSTER
958 ? (mon_is_local(ls->id.a_monst)
959 ? "mon"
960 : (ls->id.a_monst == &gy.youmonst)
961 ? "you"
962 /* migrating monster */
963 : "<m>")
964 : "???"),
965 fmt_ptr(ls->id.a_void));
966 putstr(win, 0, buf);
967 }
968 } else
969 putstr(win, 0, "<none>");
970
971 display_nhwindow(win, FALSE);
972 destroy_nhwindow(win);
973
974 return ECMD_OK;
975}
976#endif /* !SFCTOOL */
977
978/* for 'onefile' processing where end of this file isn't necessarily the

Callers

nothing calls this directly

Calls 2

mon_is_localFunction · 0.85
fmt_ptrFunction · 0.85

Tested by

no test coverage detected