change --advance-time to --verbose, w/ better replay behavior
This commit is contained in:
@@ -109,7 +109,8 @@ extern sf::RenderWindow mini_map;
|
||||
extern std::shared_ptr<cScrollbar> text_sbar,item_sbar,shop_sbar;
|
||||
extern short shop_identify_cost, shop_recharge_amount;
|
||||
|
||||
extern bool record_advance_time;
|
||||
extern bool record_verbose;
|
||||
extern bool replay_verbose;
|
||||
|
||||
const char *dir_string[] = {"North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest"};
|
||||
char get_new_terrain();
|
||||
@@ -1628,14 +1629,14 @@ bool handle_action(const sf::Event& event, cFramerateLimiter& fps_limiter) {
|
||||
}
|
||||
|
||||
void advance_time(bool did_something, bool need_redraw, bool need_reprint) {
|
||||
if(recording && record_advance_time){
|
||||
if(recording && record_verbose){
|
||||
std::map<std::string,std::string> info;
|
||||
info["did_something"] = bool_to_str(did_something);
|
||||
info["need_redraw"] = bool_to_str(need_redraw);
|
||||
info["need_reprint"] = bool_to_str(need_reprint);
|
||||
record_action("advance_time", info);
|
||||
}
|
||||
if(replaying && record_advance_time){
|
||||
if(replaying && replay_verbose){
|
||||
if(next_action_type() == "advance_time"){
|
||||
std::string _last_action_type = last_action_type;
|
||||
Element& element = pop_next_action();
|
||||
|
@@ -234,7 +234,8 @@ static void init_ui() {
|
||||
init_buttons();
|
||||
}
|
||||
|
||||
bool record_advance_time = false;
|
||||
extern bool record_verbose;
|
||||
extern bool replay_verbose;
|
||||
|
||||
static void process_args(int argc, char* argv[]) {
|
||||
preprocess_args(argc, argv);
|
||||
@@ -245,7 +246,7 @@ static void process_args(int argc, char* argv[]) {
|
||||
boost::optional<double> replay_speed;
|
||||
cli |= clara::Opt(record_to, "record")["--record"]("Records a replay of your session to the specified XML file.");
|
||||
cli |= clara::Opt(record_unique)["--unique"]("When recording, automatically insert a timestamp into the filename to guarantee uniqueness.");
|
||||
cli |= clara::Opt(record_advance_time)["--advance-time"]("Record and validate advance_time() calls for internal testing of the replay system.");
|
||||
cli |= clara::Opt(record_verbose)["--verbose"]("Record extra information for internal testing of the replay system.");
|
||||
cli |= clara::Opt(replay, "replay-file")["--replay"]("Replays a previously-recorded session from the specified XML file.");
|
||||
cli |= clara::Opt(replay_speed, "fps")["--replay-speed"]("Specifies how quickly actions are processed while replaying");
|
||||
cli |= clara::Arg(saved_game, "save-file")("Launch and load a saved game file.");
|
||||
@@ -584,11 +585,7 @@ static void replay_next_action() {
|
||||
}else if(t == "cancel_item_target"){
|
||||
cancel_item_target();
|
||||
}else if(t == "advance_time"){
|
||||
if(record_advance_time){
|
||||
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{
|
||||
throw std::string { "The action log you're replaying contains advance_time() recordings. The additional --advance-time flag is required to process it." };
|
||||
}
|
||||
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: " << next_action;
|
||||
|
Reference in New Issue
Block a user