separate handle_bash and handle_pick actions

This commit is contained in:
2024-08-27 13:51:23 -05:00
committed by Celtic Minstrel
parent 3bcfbc9f34
commit aeabb6eade
2 changed files with 18 additions and 27 deletions

View File

@@ -782,9 +782,10 @@ static void handle_use_space(location destination, bool& did_something, bool& ne
void handle_bash_pick_select(bool& need_reprint, bool isBash) {
if(recording){
std::ostringstream sstr;
sstr << std::boolalpha << isBash;
record_action("handle_bash_pick_select", sstr.str());
if(isBash)
record_action("handle_bash_select", "");
else
record_action("handle_pick_select", "");
}
if(overall_mode == MODE_BASH_TOWN || overall_mode == MODE_PICK_TOWN) {
add_string_to_buf(" Cancelled.");
@@ -801,13 +802,11 @@ void handle_bash_pick(location destination, bool& did_something, bool& need_redr
std::map<std::string,std::string> info;
std::ostringstream sstr;
sstr << destination;
info["destination"] = sstr.str();
sstr.str("");
sstr << std::boolalpha << isBash;
info["isBash"] = sstr.str();
record_action("handle_bash_pick", info);
if(isBash)
record_action("handle_bash", sstr.str());
else
record_action("handle_pick", sstr.str());
}
if(!adjacent(destination,univ.party.town_loc))
add_string_to_buf(" Must be adjacent.");

View File

@@ -457,24 +457,16 @@ static void replay_next_action() {
spell_cast_hit_return();
}else if(t == "handle_pause"){
handle_pause(did_something, need_redraw);
}else if(t == "handle_bash_pick_select"){
std::istringstream sstr(next_action.GetText());
bool isBash;
sstr >> std::boolalpha >> isBash;
handle_bash_pick_select(need_reprint, isBash);
}else if(t == "handle_bash_pick"){
auto info = info_from_action(next_action);
std::istringstream sstr(info["destination"]);
location destination;
sstr >> destination;
sstr.str(info["isBash"]);
sstr.seekg(0);
bool isBash;
sstr >> std::boolalpha >> isBash;
handle_bash_pick(destination, did_something, need_redraw, isBash);
}else if(t == "handle_bash_select"){
handle_bash_pick_select(need_reprint, true);
}else if(t == "handle_pick_select"){
handle_bash_pick_select(need_reprint, false);
}else if(t == "handle_bash"){
location destination = location_from_action(next_action);
handle_bash_pick(destination, did_something, need_redraw, true);
}else if(t == "handle_pick"){
location destination = location_from_action(next_action);
handle_bash_pick(destination, did_something, need_redraw, false);
}
// TODO some of these actions shouldn't call advance_time(). They should return