Skip to content

Commit

Permalink
Improve wrapping for monster_item_view_coordinates.
Browse files Browse the repository at this point in the history
Setting monster_item_view_coordinates leads to longer lines in the
"monsters in view" display, but the way the game wrapped lines (other
than with local tiles) did not account for this. It does now.
  • Loading branch information
Aliscans committed Jul 23, 2024
1 parent 1906822 commit 851bf81
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crawl-ref/source/directn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,6 @@ static coord_def _full_describe_menu(vector<monster_info> const &list_mons,
<< (g.ch == '<' ? "<<" : stringize_glyph(g.ch))
<< "</" << col_string << ">) ";
#endif
if (Options.monster_item_view_coordinates)
{
const coord_def relpos = mi.pos - you.pos();
prefix << "(" << relpos.x << ", " << -relpos.y << ") ";
}

string str = get_monster_equipment_desc(mi, DESC_FULL, DESC_A, true);
if (mi.dam != MDAM_OKAY)
str += ", " + mi.damage_desc();
Expand All @@ -661,6 +655,13 @@ static coord_def _full_describe_menu(vector<monster_info> const &list_mons,
if (!consinfo.empty())
str += ", " + consinfo;

if (Options.monster_item_view_coordinates)
{
const coord_def relpos = mi.pos - you.pos();
str = make_stringf("(%d, %d) %s", relpos.x, -relpos.y,
str.c_str());
}

#ifndef USE_TILE_LOCAL
// Wraparound if the description is longer than allowed.
linebreak_string(str, get_number_of_cols() - 9);
Expand Down

0 comments on commit 851bf81

Please sign in to comment.