Fix menubar alchemy clicking 'Ask About' in talk mode

This commit is contained in:
2025-02-26 12:21:35 -06:00
committed by Celtic Minstrel
parent 9dfc9e7287
commit 91f28d3c9d
2 changed files with 7 additions and 5 deletions

View File

@@ -1087,7 +1087,8 @@ void handle_alchemy(bool& need_redraw, bool& need_reprint) {
need_redraw = true;
if(overall_mode == MODE_TOWN)
do_alchemy();
else add_string_to_buf("Alchemy: Only in town.");
else if(!is_town()) add_string_to_buf("Alchemy: Only in town.");
else add_string_to_buf("Alchemy: " + FINISH_FIRST);
}
static void handle_town_wait(bool& need_redraw, bool& need_reprint) {

View File

@@ -1423,6 +1423,7 @@ void menu_give_help(short help1){
void handle_menu_choice(eMenu item_hit) {
std::string dialogToShow;
sf::Event dummyEvent = {sf::Event::KeyPressed};
bool did_something = false, need_redraw = false, need_reprint = false;
switch(item_hit) {
case eMenu::NONE: break;
@@ -1518,10 +1519,7 @@ void handle_menu_choice(eMenu item_hit) {
showWelcome();
break;
case eMenu::ACTIONS_ALCHEMY:
// This will be recorded when the fake event is processed
dummyEvent.key.code = sf::Keyboard::A;
dummyEvent.key.shift = true;
queue_fake_event(dummyEvent);
handle_alchemy(need_redraw, need_reprint);
break;
case eMenu::ACTIONS_WAIT:
// This will be recorded when the fake event is processed
@@ -1545,6 +1543,9 @@ void handle_menu_choice(eMenu item_hit) {
if(!dialogToShow.empty()) {
show_dialog_action(dialogToShow);
}
if(did_something || need_redraw || need_reprint){
advance_time(did_something, need_redraw, need_reprint);
}
}
// TODO: Let this function take a cMonster* instead of the item_hit