| 930 | |
| 931 | #ifdef POSITIONBAR |
| 932 | staticfn void |
| 933 | do_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 | |
| 975 | staticfn void |
no test coverage detected