From 74096b6e62dcfcd0d45e50ff5040d60ae2843ff0 Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Tue, 7 Jan 2020 20:10:41 -0600 Subject: [PATCH 1/4] Add option to change position of look around windows Adds UI function in options to change look around window between left and right --- src/game.cpp | 12 +++++++++++- src/options.cpp | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index 93361bff9b1cb..17ea922ce46a1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -6618,7 +6618,17 @@ look_around_result game::look_around( catacurses::window w_info, tripoint ¢e } int la_y = 0; - int la_x = TERMX - panel_width; + int la_x = 0; + std::string position = get_option( "LOOKAROUND_POSITION" ); + if( position == "left" ) { + if( get_option( "SIDEBAR_POSITION" ) == "right" ) { + la_x = panel_manager::get_manager().get_width_left(); + } else{ + la_x = panel_manager::get_manager().get_width_left() - panel_width; + } + } else if( position == "right" ) { + la_x = TERMX - panel_width; + } int la_h = height; int la_w = panel_width; w_info = catacurses::newwin( la_h, la_w, point( la_x, la_y ) ); diff --git a/src/options.cpp b/src/options.cpp index edc3a28300796..90f5cae1fab5c 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1481,6 +1481,12 @@ void options_manager::add_options_interface() false ); + add( "LOOKAROUND_POSITION", "interface", translate_marker( "Look around position" ), + translate_marker( "Switch between look around panel being left or right." ), + { { "left", translate_marker( "Left" ) }, { "right", translate_marker( "Right" ) } }, + "right" + ); + add( "PICKUP_POSITION", "interface", translate_marker( "Pickup position" ), translate_marker( "Switch between pickup panel being left, right, or overlapping the sidebar." ), { { "left", translate_marker( "Left" ) }, { "right", translate_marker( "Right" ) }, { "overlapping", translate_marker( "Overlapping" ) } }, From 1f177771147a4f5ac37195a4550f6e9de893f40e Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Wed, 8 Jan 2020 01:11:33 -0600 Subject: [PATCH 2/4] astyle astyle attempt --- src/game.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 17ea922ce46a1..6353d93ee1a13 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -6619,16 +6619,16 @@ look_around_result game::look_around( catacurses::window w_info, tripoint ¢e int la_y = 0; int la_x = 0; - std::string position = get_option( "LOOKAROUND_POSITION" ); - if( position == "left" ) { - if( get_option( "SIDEBAR_POSITION" ) == "right" ) { + std::string position = get_option( "LOOKAROUND_POSITION" ); + if( position == "left" ) { + if( get_option( "SIDEBAR_POSITION" ) == "right" ) { la_x = panel_manager::get_manager().get_width_left(); - } else{ - la_x = panel_manager::get_manager().get_width_left() - panel_width; - } - } else if( position == "right" ) { - la_x = TERMX - panel_width; - } + } else { + la_x = panel_manager::get_manager().get_width_left() - panel_width; + } + } else if( position == "right" ) { + la_x = TERMX - panel_width; + } int la_h = height; int la_w = panel_width; w_info = catacurses::newwin( la_h, la_w, point( la_x, la_y ) ); From beb33315a2bf1388dd820c8be6ff626134632b2f Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Thu, 9 Jan 2020 05:27:13 -0600 Subject: [PATCH 3/4] lookaround default to right la window is defined on right-hand side, and cleanup conditional --- src/game.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 6353d93ee1a13..3c73dccbc1995 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -6618,7 +6618,7 @@ look_around_result game::look_around( catacurses::window w_info, tripoint ¢e } int la_y = 0; - int la_x = 0; + int la_x = TERMX - panel_width; std::string position = get_option( "LOOKAROUND_POSITION" ); if( position == "left" ) { if( get_option( "SIDEBAR_POSITION" ) == "right" ) { @@ -6626,8 +6626,6 @@ look_around_result game::look_around( catacurses::window w_info, tripoint ¢e } else { la_x = panel_manager::get_manager().get_width_left() - panel_width; } - } else if( position == "right" ) { - la_x = TERMX - panel_width; } int la_h = height; int la_w = panel_width; From 50d952d616f45b73c3989573d2a16ff81554ffdd Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Sun, 12 Jan 2020 14:29:19 -0600 Subject: [PATCH 4/4] Fix bug with toggle minimap Fix la window always redisplaying on right side when toggling minimap --- src/game.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index 3c73dccbc1995..889d6c474f820 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -6765,7 +6765,16 @@ look_around_result game::look_around( catacurses::window w_info, tripoint ¢e int panel_width = panel_manager::get_manager().get_current_layout().begin()->get_width(); int height = pixel_minimap_option ? TERMY - getmaxy( w_pixel_minimap ) : TERMY; - w_info = catacurses::newwin( height, panel_width, point( TERMX - panel_width, 0 ) ); + int la_x = TERMX - panel_width; + std::string position = get_option( "LOOKAROUND_POSITION" ); + if( position == "left" ) { + if( get_option( "SIDEBAR_POSITION" ) == "right" ) { + la_x = panel_manager::get_manager().get_width_left(); + } else { + la_x = panel_manager::get_manager().get_width_left() - panel_width; + } + } + w_info = catacurses::newwin( height, panel_width, point( la_x, 0 ) ); } else if( action == "LEVEL_UP" || action == "LEVEL_DOWN" ) { if( !allow_zlev_move ) { continue;