Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix overlapping text in look-around. #4156

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5863,7 +5863,7 @@ void game::print_visibility_info( const catacurses::window &w_look, int column,
break;
}

mvwprintw( w_look, point( line, column ), visibility_message );
mvwprintw( w_look, point( column, line ), visibility_message );
line += 2;
}

Expand All @@ -5872,7 +5872,6 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l
int &line )
{
const int max_width = getmaxx( w_look ) - column - 1;
int lines;

const auto fmt_tile_info = []( const tripoint & lp ) {
map &here = get_map();
Expand All @@ -5897,23 +5896,23 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l
std::string tile = string_format( "(%s) %s", area_name, fmt_tile_info( lp ) );

if( m.impassable( lp ) ) {
lines = fold_and_print( w_look, point( column, line ), max_width, c_light_gray,
line += fold_and_print( w_look, point( column, line ), max_width, c_light_gray,
_( "%s; Impassable" ),
tile );
} else {
lines = fold_and_print( w_look, point( column, line ), max_width, c_light_gray,
line += fold_and_print( w_look, point( column, line ), max_width, c_light_gray,
_( "%s; Movement cost %d" ),
tile, m.move_cost( lp ) * 50 );

const auto ll = get_light_level( std::max( 1.0,
LIGHT_AMBIENT_LIT - m.ambient_light_at( lp ) + 1.0 ) );
mvwprintw( w_look, point( column, ++lines ), _( "Lighting: " ) );
mvwprintw( w_look, point( column, line++ ), _( "Lighting: " ) );
wprintz( w_look, ll.second, ll.first );
}

std::string signage = m.get_signage( lp );
if( !signage.empty() ) {
trim_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray,
trim_and_print( w_look, point( column, line++ ), max_width, c_dark_gray,
// NOLINTNEXTLINE(cata-text-style): the question mark does not end a sentence
u.has_trait( trait_ILLITERATE ) ? _( "Sign: ???" ) : _( "Sign: %s" ), signage );
}
Expand All @@ -5924,23 +5923,21 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l
std::string tile_below = fmt_tile_info( below );

if( !m.has_floor_or_support( lp ) ) {
fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray,
_( "Below: %s; No support" ),
tile_below );
line += fold_and_print( w_look, point( column, line ), max_width, c_dark_gray,
_( "Below: %s; No support" ),
tile_below );
} else {
fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray,
_( "Below: %s; Walkable" ),
tile_below );
line += fold_and_print( w_look, point( column, line ), max_width, c_dark_gray,
_( "Below: %s; Walkable" ),
tile_below );
}
}

int map_features = fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray,
m.features( lp ) );
fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, _( "Coverage: %d%%" ),
m.coverage( lp ) );
if( line < lines ) {
line = lines + map_features - 1;
}
line += fold_and_print( w_look, point( column, line ), max_width, c_dark_gray,
m.features( lp ) );
line += fold_and_print( w_look, point( column, line ), max_width, c_light_gray,
_( "Coverage: %d%%" ),
m.coverage( lp ) );
}

void game::print_fields_info( const tripoint &lp, const catacurses::window &w_look, int column,
Expand Down
Loading