From b2c689a3e04335a1e0c9c8a193c9793249cba0f2 Mon Sep 17 00:00:00 2001 From: Loobinex Date: Tue, 30 Jul 2024 20:37:05 +0200 Subject: [PATCH] Fixed handling of query page when clicking '1' (#3374) Fixes #3373 --- src/front_input.c | 11 +++++------ src/frontmenu_ingame_tabs.c | 16 ++-------------- src/frontmenu_ingame_tabs_data.cpp | 4 ++-- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/front_input.c b/src/front_input.c index b791def20e..4537912bd6 100644 --- a/src/front_input.c +++ b/src/front_input.c @@ -874,11 +874,10 @@ short get_status_panel_keyboard_action_inputs(void) if (is_key_pressed(KC_1, KMod_NONE)) { clear_key_pressed(KC_1); - fake_button_click(BID_INFO_TAB); struct GuiButton* gbtn = get_gui_button(BID_QUERY_2); if (gbtn != NULL) { - if ((gbtn->flags & (LbBtnF_Visible | LbBtnF_Enabled)) != 0) + if (flag_is_set(gbtn->flags,(LbBtnF_Visible | LbBtnF_Enabled))) { if (menu_is_active(GMnu_QUERY)) { @@ -890,10 +889,10 @@ short get_status_panel_keyboard_action_inputs(void) fake_button_click(BID_INFO_TAB); } } - else - { - fake_button_click(BID_ROOM_TAB); - } + } + else + { + fake_button_click(BID_INFO_TAB); } } if (is_key_pressed(KC_2, KMod_NONE)) diff --git a/src/frontmenu_ingame_tabs.c b/src/frontmenu_ingame_tabs.c index c400d39ba2..1ba4770b9c 100644 --- a/src/frontmenu_ingame_tabs.c +++ b/src/frontmenu_ingame_tabs.c @@ -2046,24 +2046,12 @@ void maintain_player_page2(struct GuiButton *gbtn) } if(current_players_count > 4) { - - gbtn->pos_x = scale_ui_value(14); - gbtn->pos_y = scale_ui_value(374); - gbtn->scr_pos_x = scale_ui_value(14); - gbtn->scr_pos_y = scale_ui_value(374); - gbtn->width = scale_ui_value(52); - gbtn->height = scale_ui_value(20); + set_flag(gbtn->flags, (LbBtnF_Visible | LbBtnF_Enabled)); } else { - gbtn->pos_x = 0; - gbtn->pos_y = 0; - gbtn->scr_pos_x = 0; - gbtn->scr_pos_y = 0; - gbtn->width = 0; - gbtn->height = 0; + clear_flag(gbtn->flags, (LbBtnF_Visible | LbBtnF_Enabled)); } - } void maintain_query_button(struct GuiButton *gbtn) diff --git a/src/frontmenu_ingame_tabs_data.cpp b/src/frontmenu_ingame_tabs_data.cpp index 09b5e24c26..b4333d4743 100644 --- a/src/frontmenu_ingame_tabs_data.cpp +++ b/src/frontmenu_ingame_tabs_data.cpp @@ -345,8 +345,8 @@ struct GuiButtonInit creature_menu_buttons[] = { }; struct GuiButtonInit query_menu_buttons[] = { - {LbBtnT_NormalBtn, BID_DEFAULT, 0, 0, gui_set_query, NULL, NULL, 0, 14, 374, 14, 374, 52, 20, gui_area_new_normal_button, GPS_rpanel_rpanel_btn_crinfo_act, GUIStr_GoToQueryMode, 0, {0}, 0, maintain_query_button }, - {LbBtnT_NormalBtn, BID_QUERY_2, 0, 0, gui_switch_players_visible, NULL, NULL, 0, 74, 374, 74, 374, 52, 20, gui_area_new_normal_button, GPS_rpanel_rpanel_btn_nxpage_act, GUIStr_MoreInformation, 0, {0}, 0, maintain_player_page2 }, + {LbBtnT_NormalBtn, BID_DEFAULT, 0, 0, gui_set_query, NULL, NULL, 0, 44, 374, 44, 374, 52, 20, gui_area_new_normal_button, GPS_rpanel_rpanel_btn_crinfo_act, GUIStr_GoToQueryMode, 0, {0}, 0, maintain_query_button }, + {LbBtnT_NormalBtn, BID_QUERY_2, 0, 0, gui_switch_players_visible, NULL, NULL, 0, 14, 374, 14, 374, 52, 20, gui_area_new_normal_button, GPS_rpanel_rpanel_btn_nxpage_act, GUIStr_MoreInformation, 0, {0}, 0, maintain_player_page2 }, {LbBtnT_ToggleBtn, BID_QRY_IMPRSN, 0, 0, gui_set_tend_to, NULL, NULL, 1, 36, 190, 36, 190, 32, 26, gui_area_flash_cycle_button, GPS_rpanel_tendency_prisne_act, GUIStr_CreatureImprisonDesc, 0,{(long)&game.creatures_tend_imprison}, 1, maintain_prison_bar }, {LbBtnT_ToggleBtn, BID_QRY_FLEE, 0, 0, gui_set_tend_to, NULL, NULL, 2, 74, 190, 74, 190, 32, 26, gui_area_flash_cycle_button, GPS_rpanel_tendency_fleee_act, GUIStr_CreatureFleeDesc, 0,{(long)&game.creatures_tend_flee}, 1, NULL }, {LbBtnT_NormalBtn, BID_DEFAULT, 0, 0, NULL, NULL, NULL, 0, 4, 216, 4, 222,132, 24, gui_area_payday_button, GPS_rpanel_rpanel_payday_counter, GUIStr_PayTimeDesc, 0, {0}, 0, NULL },