Improve replay system CLI handling

This commit is contained in:
2024-12-01 11:55:06 -06:00
committed by Celtic Minstrel
parent 6ea26ca423
commit a665ec9033
2 changed files with 19 additions and 2 deletions

View File

@@ -262,14 +262,30 @@ static void process_args(int argc, char* argv[]) {
cli.writeToStream(std::cout);
exit(0);
}
if(record_to && init_action_log(record_unique || record_to->empty() ? "record-unique" : "record", *record_to)) return;
if(replay && init_action_log("replay", *replay)) {
if(replay){
if(record_to){
std::cout << "Warning: flag --record conflicts with --replay and will be ignored." << std::endl;
}
if(saved_game){
std::cout << "Warning: save file argument conflicts with --replay and will be ignored." << std::endl;
}
if(!init_action_log("replay", *replay)) {
std::cerr << "Failed to load replay: " << *replay << std::endl;
exit(1);
}
if(replay_speed) {
extern boost::optional<cFramerateLimiter> replay_fps_limit;
replay_fps_limit.emplace(*replay_speed);
}
return;
}
if(record_to){
if(!init_action_log(record_unique || record_to->empty() ? "record-unique" : "record", *record_to)){
std::cerr << "Failed to start recording: " << *record_to << std::endl;
exit(1);
}
return;
}
if(saved_game) {
if(!load_party(*saved_game, univ)) {
std::cout << "Failed to load save file: " << *saved_game << std::endl;

View File

@@ -110,6 +110,7 @@ bool init_action_log(std::string command, std::string file) {
replaying = true;
} catch(...) {
std::cout << "Failed to load file " << file << std::endl;
return false;
}
return true;
}