record and replay 2 more ? key help messages

This commit is contained in:
2024-08-27 15:09:32 -05:00
committed by Celtic Minstrel
parent f82cd550aa
commit 482b35d121
2 changed files with 24 additions and 2 deletions

View File

@@ -1744,6 +1744,23 @@ void show_inventory() {
put_item_screen(stat_window); put_item_screen(stat_window);
} }
// Most give_help() calls don't need to be recorded, because
// they are triggered incidentally by other recorded actions.
static void give_help_and_record(short help1, short help2) {
if(recording){
std::map<std::string,std::string> info;
std::ostringstream sstr;
sstr << help1;
info["help1"] = sstr.str();
sstr.str("");
sstr << help2;
info["help2"] = sstr.str();
record_action("give_help", info);
}
give_help(help1, help2);
}
bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
bool are_done = false; bool are_done = false;
location pass_point; // TODO: This isn't needed location pass_point; // TODO: This isn't needed
@@ -1871,11 +1888,11 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
case '?': case '?':
if(overall_mode == MODE_SHOPPING) { if(overall_mode == MODE_SHOPPING) {
give_help(226,27); give_help_and_record(226,27);
break; break;
} }
if(overall_mode == MODE_TALKING) { if(overall_mode == MODE_TALKING) {
give_help(205,6); give_help_and_record(205,6);
break; break;
} }
if(is_out()) show_dialog_action("help-outdoor"); if(is_out()) show_dialog_action("help-outdoor");

View File

@@ -474,6 +474,11 @@ static void replay_next_action() {
handle_use_space(destination, did_something, need_redraw); handle_use_space(destination, did_something, need_redraw);
}else if(t == "show_inventory"){ }else if(t == "show_inventory"){
show_inventory(); show_inventory();
}else if(t == "give_help"){
auto info = info_from_action(next_action);
short help1 = boost::lexical_cast<short>(info["help1"]);
short help2 = boost::lexical_cast<short>(info["help2"]);
give_help(help1, help2);
} }
// TODO some of these actions shouldn't call advance_time(). They should return // TODO some of these actions shouldn't call advance_time(). They should return