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

Function do_positionbar

src/allmain.c:932–972  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

930
931#ifdef POSITIONBAR
932staticfn void
933do_positionbar(void)
934{
935 /* FIXME: this will break if any coordinate is too big for (char);
936 the sys/msdos/vid*.c code uses (unsigned char) which is less
937 vulnerable but not guaranteed to be able to hold coordxy values;
938 also, there doesn't appear to be any need for this to be static,
939 nor to contain pairs of (> or <) and x; it could just be a full
940 line of spaces and > or < characters with update_positionbar()
941 revised to reconstruct the x values for non-space characters */
942 static char pbar[COLNO];
943 char *p;
944 stairway *stway;
945 coordxy x, y;
946 int glyph, symbol;
947
948 p = pbar;
949 /* TODO: use the same method as getpos() so objects don't cover stairs */
950 /* FIXME: traversing 'stairs' list ignores mimics that pose as stairs */
951 for (stway = gs.stairs; stway; stway = stway->next) {
952 x = stway->sx;
953 y = stway->sy;
954 glyph = levl[x][y].glyph;
955 symbol = glyph_to_cmap(glyph);
956
957 if (is_cmap_stairs(symbol)) {
958 *p++ = (stway->up ? '<' : '>');
959 *p++ = (char) x;
960 }
961 }
962
963 /* hero location */
964 if (u.ux) {
965 *p++ = '@';
966 *p++ = u.ux;
967 }
968 /* fence post */
969 *p = 0;
970
971 update_positionbar(pbar);
972}
973#endif
974
975staticfn void

Callers 1

allmain.cFile · 0.85

Calls 1

glyph_to_cmapFunction · 0.85

Tested by

no test coverage detected