diff --git a/src/game.cpp b/src/game.cpp index 9d68459be86b..a559d000df38 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -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(); @@ -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 ); } @@ -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,