fix replay behavior of item stats window buttons

This commit is contained in:
2024-09-24 19:27:18 -05:00
committed by Celtic Minstrel
parent ab2911aa57
commit f5ed2bf48d
3 changed files with 16 additions and 3 deletions

View File

@@ -1298,6 +1298,12 @@ void show_item_info(short item_hit) {
else display_pc_item(stat_window, item_hit,univ.party[stat_window].items[item_hit],0);
}
void update_item_stats_area(bool& need_reprint) {
put_pc_screen();
put_item_screen(stat_window);
need_reprint = true;
}
bool handle_action(const sf::Event& event, cFramerateLimiter& fps_limiter) {
long item_hit;
bool are_done = false;
@@ -1612,9 +1618,7 @@ bool handle_action(const sf::Event& event, cFramerateLimiter& fps_limiter) {
}
}
}
put_pc_screen();
put_item_screen(stat_window);
need_reprint = true;
update_item_stats_area(need_reprint);
}
advance_time(did_something, need_redraw, need_reprint);

View File

@@ -100,5 +100,6 @@ void give_help_and_record(short help1, short help2);
void show_item_info(short item_hit);
void close_map(bool record = false);
void cancel_item_target();
void update_item_stats_area(bool& need_reprint);
#endif

View File

@@ -312,15 +312,19 @@ static void replay_next_action() {
}else if(t == "handle_switch_pc_items"){
short which_pc = short_from_action(next_action);
handle_switch_pc_items(which_pc, need_redraw);
update_item_stats_area(need_reprint);
}else if(t == "handle_equip_item"){
short item_hit = short_from_action(next_action);
handle_equip_item(item_hit, need_redraw);
update_item_stats_area(need_reprint);
}else if(t == "handle_use_item"){
short item_hit = short_from_action(next_action);
handle_use_item(item_hit, did_something, need_redraw);
update_item_stats_area(need_reprint);
}else if(t == "handle_item_shop_action"){
short item_hit = short_from_action(next_action);
handle_item_shop_action(item_hit);
update_item_stats_area(need_reprint);
}else if(t == "handle_alchemy"){
handle_alchemy(need_redraw, need_reprint);
}else if(t == "handle_wait"){
@@ -334,12 +338,14 @@ static void replay_next_action() {
}else if(t == "handle_drop_item_id"){
short item_hit = short_from_action(next_action);
handle_drop_item(item_hit, need_redraw);
update_item_stats_area(need_reprint);
}else if(t == "handle_drop_item_location"){
location destination = location_from_action(next_action);
handle_drop_item(destination, need_redraw);
}else if(t == "handle_give_item"){
short item_hit = short_from_action(next_action);
handle_give_item(item_hit, did_something, need_redraw);
update_item_stats_area(need_reprint);
}else if(t == "close_window"){ // TODO do last
handle_quit_event();
}else if(t == "arrow_button_click"){
@@ -524,8 +530,10 @@ static void replay_next_action() {
sbar->setPosition(newPos);
}else if(t == "use_spec_item"){
use_spec_item(boost::lexical_cast<short>(next_action.GetText()), need_redraw);
update_item_stats_area(need_reprint);
}else if(t == "show_item_info"){
show_item_info(boost::lexical_cast<short>(next_action.GetText()));
update_item_stats_area(need_reprint);
}else if(t == "set_stat_window"){
set_stat_window(static_cast<eItemWinMode>(boost::lexical_cast<int>(next_action.GetText())));
}else if(t == "handle_sale"){