use extra space when there is no scrollbar in shop window

This commit is contained in:
2025-05-06 17:12:38 -05:00
parent 51e6da15e2
commit b877bcffc5
3 changed files with 6 additions and 0 deletions

View File

@@ -157,6 +157,10 @@ void init_shopping_rects(bool scrollbar) {
shopping_rects[0][SHOPRECT_ITEM_HELP].bottom -= 21;
shopping_rects[0][SHOPRECT_ITEM_HELP].right -= 19;
shopping_rects[0][SHOPRECT_ITEM_HELP].left = shopping_rects[0][SHOPRECT_ITEM_HELP].right - 14;
// Utilize the extra space on the right side if no scrollbar is shown
int offset_right = scrollbar ? -4 : 12;
shopping_rects[0][SHOPRECT_ITEM_COST].offset(offset_right, 0);
shopping_rects[0][SHOPRECT_ITEM_HELP].offset(offset_right, 0);
// Define rectangles for the next 7 rows by copying and offsetting
for(short i = 1; i < 8; i++) {

View File

@@ -476,6 +476,7 @@ void handle_sale(int i) {
// This looks to be redundant, but I'm just preserving the previous behavior of the code.
set_up_shop_array();
init_shopping_rects(shop_sbar->getMaximum() > 0);
draw_shop_graphics(false,false,{});
// When buying from a healer, we want to select the next PC who needs healing

View File

@@ -857,6 +857,7 @@ void draw_shop_graphics(bool item_pressed, bool item_help_pressed, rectangle cli
rectangle cost_rect = shopping_rects[i][SHOPRECT_ITEM_COST];
cost_rect.left = cost_rect.right - string_length(cur_name, style) - 10;
win_draw_string(talk_gworld(),cost_rect,cur_name,eTextMode::WRAP,style);
// Draw the coin
cost_rect.left = cost_rect.right - 7;
cost_rect.top += 3;
cost_rect.height() = 7;