diff --git a/src/fileio/fileio_party.cpp b/src/fileio/fileio_party.cpp index 6e319c2f0..c85c1a187 100644 --- a/src/fileio/fileio_party.cpp +++ b/src/fileio/fileio_party.cpp @@ -158,7 +158,7 @@ bool load_party(fs::path file_to_load, cUniverse& univ){ } if(recording && result){ - record_action("load_party", encode_file(file_to_load)); + record_action("load_party", encode_file(file_to_load), true); } return result; diff --git a/src/tools/replay.cpp b/src/tools/replay.cpp index ff774de04..d561d9b2f 100644 --- a/src/tools/replay.cpp +++ b/src/tools/replay.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -221,11 +222,18 @@ std::string encode_file(fs::path file) { ifs.seekg(0, std::ios::beg); ifs.read(result.data(), pos); - return base64::encode(result.data(), result.size() * sizeof(char)); + std::string raw_base64 = base64::encode(result.data(), result.size() * sizeof(char)); + std::ostringstream wrapped_base64; + const size_t cols = 76; + for(size_t start = 0; start < raw_base64.size(); start += cols){ + wrapped_base64 << raw_base64.substr(start, cols) << std::endl; + } + return wrapped_base64.str(); } void decode_file(std::string data, fs::path file) { std::ofstream ofs(file.string(), std::ios::binary|std::ios::ate); + data = boost::algorithm::erase_all_copy(data, "\n"); std::vector bytes = base64::decode(data.c_str(), strlen(data.c_str()) * sizeof(char)); char* bytes_as_c_str = reinterpret_cast(bytes.data()); ofs.write(bytes_as_c_str, bytes.size() / sizeof(char));