diff --git a/src/game.cpp b/src/game.cpp index a3e546ebfc4e6..7cba6864ead4e 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -518,7 +518,7 @@ void game::init_ui( const bool resized ) /** * Doing the same thing as above for the overmap */ - static const int OVERMAP_LEGEND_WIDTH = 28; + OVERMAP_LEGEND_WIDTH = clamp( TERMX / 5, 28, 55 ); OVERMAP_WINDOW_HEIGHT = TERMY; OVERMAP_WINDOW_WIDTH = TERMX - OVERMAP_LEGEND_WIDTH; to_overmap_font_dimension( OVERMAP_WINDOW_WIDTH, OVERMAP_WINDOW_HEIGHT ); diff --git a/src/output.cpp b/src/output.cpp index e36ee01f5f4fc..25dd1ca31546d 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -57,6 +57,8 @@ int FULL_SCREEN_HEIGHT; int OVERMAP_WINDOW_HEIGHT; int OVERMAP_WINDOW_WIDTH; +int OVERMAP_LEGEND_WIDTH; + static std::string rm_prefix( std::string str, char c1 = '<', char c2 = '>' ); scrollingcombattext SCT; diff --git a/src/output.h b/src/output.h index 0003513f2d52b..6a6bba41f012e 100644 --- a/src/output.h +++ b/src/output.h @@ -145,6 +145,7 @@ extern int FULL_SCREEN_WIDTH; // width of "full screen" popups extern int FULL_SCREEN_HEIGHT; // height of "full screen" popups extern int OVERMAP_WINDOW_WIDTH; // width of overmap window extern int OVERMAP_WINDOW_HEIGHT; // height of overmap window +extern int OVERMAP_LEGEND_WIDTH; // width of overmap window legend nc_color msgtype_to_color( game_message_type type, bool bOldMsg = false ); diff --git a/src/overmap_ui.cpp b/src/overmap_ui.cpp index 34f9449f87fd2..808b9aae02940 100644 --- a/src/overmap_ui.cpp +++ b/src/overmap_ui.cpp @@ -876,7 +876,7 @@ void draw( const catacurses::window &w, const catacurses::window &wbar, const tr } // Clear the legend - for( int i = 1; i < 55; i++ ) { + for( int i = 1; i < getmaxx( wbar ); i++ ) { for( int j = 0; j < TERMY; j++ ) { mvwputch( wbar, point( i, j ), c_black, ' ' ); } @@ -909,7 +909,7 @@ void draw( const catacurses::window &w, const catacurses::window &wbar, const tr // NOLINTNEXTLINE(cata-use-named-point-constants) mvwputch( wbar, point( 1, 1 ), ter.get_color(), ter.get_symbol() ); - lines = fold_and_print( wbar, point( 3, 1 ), 25, c_light_gray, + lines = fold_and_print( wbar, point( 3, 1 ), getmaxx( wbar ) - 3, c_light_gray, overmap_buffer.get_description_at( sm_pos ) ); } } else if( viewing_weather ) { @@ -959,7 +959,7 @@ void draw( const catacurses::window &w, const catacurses::window &wbar, const tr int y = 16; const auto print_hint = [&]( const std::string & action, nc_color color = c_magenta ) { - y += fold_and_print( wbar, point( 1, y ), 27, color, string_format( _( "%s - %s" ), + y += fold_and_print( wbar, point( 1, y ), getmaxx( wbar ) - 1, color, string_format( _( "%s - %s" ), inp_ctxt->get_desc( action ), inp_ctxt->get_action_name( action ) ) ); }; @@ -1311,7 +1311,7 @@ static void place_ter_or_special( tripoint &curs, const tripoint &orig, const bo static tripoint display( const tripoint &orig, const draw_data_t &data = draw_data_t() ) { - g->w_omlegend = catacurses::newwin( TERMY, 28, point( TERMX - 28, 0 ) ); + g->w_omlegend = catacurses::newwin( TERMY, OVERMAP_LEGEND_WIDTH, point( OVERMAP_WINDOW_WIDTH, 0 ) ); g->w_overmap = catacurses::newwin( OVERMAP_WINDOW_HEIGHT, OVERMAP_WINDOW_WIDTH, point_zero ); // Draw black padding space to avoid gap between map and legend