Skip to content

Commit

Permalink
Adds an interface option to position the item pickup panel. (#32631)
Browse files Browse the repository at this point in the history
* Adds an interface option to position the item pickup panel.
Closes #29415.

* Initialize variables, and fix style.
  • Loading branch information
Petethegoat authored and ZhilkinSerg committed Jul 28, 2019
1 parent 0a459aa commit 666b2ec
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,12 @@ void options_manager::add_options_interface()
false
);

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" ) } },
"left"
);

add( "ACCURACY_DISPLAY", "interface", translate_marker( "Aim window display style" ),
translate_marker( "How should confidence and steadiness be communicated to the player." ),
//~ aim bar style - bars or numbers
Expand All @@ -1458,7 +1464,6 @@ void options_manager::add_options_interface()

add( "MORALE_STYLE", "interface", translate_marker( "Morale style" ),
translate_marker( "Morale display style in sidebar." ),
//~ aim bar style - bars or numbers
{ { "vertical", translate_marker( "Vertical" ) }, { "horizontal", translate_marker( "Horizontal" ) } },
"Vertical"
);
Expand Down
18 changes: 15 additions & 3 deletions src/pickup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "messages.h"
#include "options.h"
#include "output.h"
#include "panels.h"
#include "player.h"
#include "string_formatter.h"
#include "string_input_popup.h"
Expand Down Expand Up @@ -509,9 +510,20 @@ void Pickup::pick_up( const tripoint &p, int min, from_where get_items_from )

int itemsW = pickupW;

catacurses::window w_pickup = catacurses::newwin( pickupH, pickupW, 0, 0 );
catacurses::window w_item_info = catacurses::newwin( TERMY - pickupH,
pickupW, pickupH, 0 );
int pickupX = 0;
std::string position = get_option<std::string>( "PICKUP_POSITION" );
if( position == "left" ) {
pickupX = panel_manager::get_manager().get_width_left();
} else if( position == "right" ) {
pickupX = TERMX - panel_manager::get_manager().get_width_right() - pickupW;
} else if( position == "overlapping" ) {
if( get_option<std::string>( "SIDEBAR_POSITION" ) == "right" ) {
pickupX = TERMX - pickupW;
}
}

catacurses::window w_pickup = catacurses::newwin( pickupH, pickupW, 0, pickupX );
catacurses::window w_item_info = catacurses::newwin( TERMY - pickupH, pickupW, pickupH, pickupX );

std::string action;
int raw_input_char = ' ';
Expand Down

0 comments on commit 666b2ec

Please sign in to comment.