diff --git a/src/dialogxml/dialogs/dialog.cpp b/src/dialogxml/dialogs/dialog.cpp index 63de84ae..d0dc9ead 100644 --- a/src/dialogxml/dialogs/dialog.cpp +++ b/src/dialogxml/dialogs/dialog.cpp @@ -603,7 +603,7 @@ void cDialog::handle_events() { // The error is recorded for debugging only. It should be triggered by replaying the actions. pop_next_action(); }else if(replaying && has_next_action()){ - throw std::string { "Replaying a dialog, have the wrong replay action: " + next_action_type() }; + throw std::string { "Replaying a dialog, have the wrong replay action: " + next_action_type() + " on line " + std::to_string(next_action_line()) }; }else{ while(pollEvent(win, currentEvent)){ handle_one_event(currentEvent, fps_limiter); diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 74352c2a..1192df87 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -984,7 +984,7 @@ static void replay_action(Element& action) { throw std::string { "Replay system internal error! advance_time() was supposed to be called by the last action, but wasn't: " } + _last_action_type; }else{ std::ostringstream sstr; - sstr << "Couldn't replay action: " << action; + sstr << "Couldn't replay action: " << action << " on line " << action.Row(); replaying = false; throw sstr.str(); } diff --git a/src/tools/replay.cpp b/src/tools/replay.cpp index 28508fa2..eafd4e8f 100644 --- a/src/tools/replay.cpp +++ b/src/tools/replay.cpp @@ -202,6 +202,13 @@ std::string next_action_type() { return next_action->Value(); } +int next_action_line() { + if(next_action == nullptr){ + throw std::string { "Replay error! No action left to check row" }; + } + return next_action->Row(); +} + Element& pop_next_action(std::string expected_action_type) { if(next_action == nullptr){ throw std::string { "Replay error! No action left to pop" }; diff --git a/src/tools/replay.hpp b/src/tools/replay.hpp index 5ac6073b..bf8e4915 100644 --- a/src/tools/replay.hpp +++ b/src/tools/replay.hpp @@ -38,6 +38,7 @@ extern void record_action(Element& action); extern void record_field_input(cKey key); extern bool has_next_action(std::string type = ""); extern std::string next_action_type(); +extern int next_action_line(); extern Element& pop_next_action(std::string expected_action_type=""); extern std::map info_from_action(Element& action); extern std::string encode_file(fs::path file);