farlook /[mMoO] feedback
When /m or /M or /o or /O shows monsters or objects with locations displayed as map coordinates, make those line up by their commas. Old | <8,9> $ gold pieces | <10,10> * rocks | <9,12> % newt corpse New | <8, 9> $ gold pieces | <10,10> * rocks | <9,12> % newt corpse (The data is gathered by row so implicitly sorted by y.) If someone is crazy enough to set ROWNO to three digits, values will only line up by the comma when all values have row less than 100 or all are 100+. Setting COLNO to three digits isn't an issue unless the total witdh of "<" + xxx + "," + yy ">" is more than 8 (which would push object class letter and object description one or more extra columns to the right, messing up overall alignment but still showing accurate data).
This commit is contained in:
12
src/pager.c
12
src/pager.c
@@ -1719,11 +1719,21 @@ look_all(
|
||||
in a fixed-width font it if finds at least one */
|
||||
putstr(win, 0, " "); /* separator */
|
||||
}
|
||||
(void) coord_desc(x, y, coordbuf, cmode);
|
||||
/* this format wrinkle makes the commas of <x,y> line up;
|
||||
it isn't needed when all the y values have same number
|
||||
of digits but looks better when there is a mixture of 1
|
||||
and 2 digit values; done unconditionally because we
|
||||
would need two passes over the map to determine whether
|
||||
y width is uniform or a mixture; x width is not a factor
|
||||
because the result gets right-justified by %8s */
|
||||
if (cmode == GPCOORDS_MAP && y < 10)
|
||||
(void) strsubst(coordbuf, ",", ", ");
|
||||
/* prefix: "coords C " where 'C' is mon or obj symbol */
|
||||
Sprintf(outbuf, (cmode == GPCOORDS_SCREEN) ? "%s "
|
||||
: (cmode == GPCOORDS_MAP) ? "%8s "
|
||||
: "%12s ",
|
||||
coord_desc(x, y, coordbuf, cmode));
|
||||
coordbuf);
|
||||
Sprintf(eos(outbuf), "%s ", encglyph(glyph));
|
||||
/* guard against potential overflow */
|
||||
lookbuf[sizeof lookbuf - 1 - strlen(outbuf)] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user