record and replay display_spells

This commit is contained in:
2024-08-24 14:48:20 -05:00
committed by Celtic Minstrel
parent da99b6169e
commit bd53a3bb31
2 changed files with 26 additions and 2 deletions

View File

@@ -113,6 +113,19 @@ static bool display_spells_event_filter(cDialog& me, std::string item_hit, eSkil
} }
//short force_spell; // if 100, ignore //short force_spell; // if 100, ignore
void display_spells(eSkill mode,short force_spell,cDialog* parent) { void display_spells(eSkill mode,short force_spell,cDialog* parent) {
if(recording){
std::map<std::string,std::string> info;
std::ostringstream sstr;
sstr << mode;
info["mode"] = sstr.str();
sstr.str("");
sstr << force_spell;
info["force_spell"] = sstr.str();
record_action("display_spells", info);
}
using namespace std::placeholders; using namespace std::placeholders;
if(force_spell < 100) { if(force_spell < 100) {
if(mode == eSkill::MAGE_SPELLS) if(mode == eSkill::MAGE_SPELLS)

View File

@@ -360,6 +360,19 @@ static void replay_next_action() {
print_party_stats(); print_party_stats();
}else if(t == "display_alchemy"){ }else if(t == "display_alchemy"){
display_alchemy(); display_alchemy();
}else if(t == "display_spells"){
auto info = info_from_action(next_action);
std::istringstream sstr(info["mode"]);
int enum_v;
sstr >> enum_v;
eSkill mode = static_cast<eSkill>(enum_v);
short force_spell;
sstr.str(info["force_spell"]);
sstr >> force_spell;
display_spells(mode, force_spell, 0);
} }
// 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
@@ -738,11 +751,9 @@ void handle_menu_choice(eMenu item_hit) {
dialogToShow = "about-boe"; dialogToShow = "about-boe";
break; break;
case eMenu::LIBRARY_MAGE: case eMenu::LIBRARY_MAGE:
// TODO record and replay
display_spells(eSkill::MAGE_SPELLS,100,0); display_spells(eSkill::MAGE_SPELLS,100,0);
break; break;
case eMenu::LIBRARY_PRIEST: case eMenu::LIBRARY_PRIEST:
// TODO record and replay
display_spells(eSkill::PRIEST_SPELLS,100,0); display_spells(eSkill::PRIEST_SPELLS,100,0);
break; break;
case eMenu::LIBRARY_SKILLS: case eMenu::LIBRARY_SKILLS: