MCPcopy Create free account
hub / github.com/NetHack/NetHack / visible_region_summary

Function visible_region_summary

src/region.c:673–711  ·  view source on GitHub ↗

for the wizard mode #timeout command */

Source from the content-addressed store, hash-verified

671
672/* for the wizard mode #timeout command */
673void
674visible_region_summary(winid win)
675{
676 NhRegion *reg;
677 char buf[BUFSZ], typbuf[QBUFSZ];
678 int i, damg, hdr_done = 0;
679 const char *fldsep = iflags.menu_tab_sep ? "\t" : " ";
680
681 for (i = 0; i < svn.n_regions; i++) {
682 reg = gr.regions[i];
683 if (!reg->visible || reg->ttl == -2L)
684 continue;
685
686 if (!hdr_done++) {
687 putstr(win, 0, "");
688 putstr(win, 0, "Visible regions");
689 }
690 /*
691 * TODO? sort the regions by time-to-live or by bounding box.
692 */
693
694 /* we display relative time (turns left) rather than absolute
695 (the turn when region will go away);
696 since time-to-live has already been decremented, regions
697 which are due to timeout on the next turn have ttl==0;
698 adding 1 is intended to make the display be less confusing */
699 Sprintf(buf, "%5ld", reg->ttl + 1L);
700 damg = reg->arg.a_int;
701 if (damg)
702 Sprintf(typbuf, "poison gas (%d)", damg);
703 else
704 Strcpy(typbuf, "vapor");
705 Sprintf(eos(buf), "%s%-16s", fldsep, typbuf);
706 Sprintf(eos(buf), "%s@[%d,%d..%d,%d]", fldsep,
707 reg->bounding_box.lx, reg->bounding_box.ly,
708 reg->bounding_box.hx, reg->bounding_box.hy);
709 putstr(win, 0, buf);
710 }
711}
712
713/*
714 * Check if a spot is under a visible region (eg: gas cloud).

Callers 1

wiz_timeout_queueFunction · 0.85

Calls 1

eosFunction · 0.85

Tested by

no test coverage detected