record and replay repeating spellcast

This commit is contained in:
2024-08-26 21:05:50 -05:00
committed by Celtic Minstrel
parent 532a1e3236
commit 34cae14279
2 changed files with 24 additions and 2 deletions

View File

@@ -429,10 +429,24 @@ static void replay_next_action() {
eSpell spell_picked = static_cast<eSpell>(std::stoi(next_action.GetText()));
handle_menu_spell(spell_picked);
}else if(t == "handle_spellcast"){
std::istringstream sstr(next_action.GetText());
auto info = info_from_action(next_action);
std::istringstream sstr(info["which_type"]);
eSkill which_type;
sstr >> which_type;
// Incredibly, this code isn't working despite being used as a pattern elsewhere:
// sstr.str(info["spell_forced"]);
// sstr >> std::boolalpha >> spell_forced;
// But this code is:
if(info["spell_forced"] == "true"){
spell_forced = true;
}else{
spell_forced = false;
}
// If I'm making an obvious error I just can't see it.
handle_spellcast(which_type, did_something, need_redraw, need_reprint);
}else if(t == "handle_target_space"){
location destination = location_from_action(next_action);