Use an enum to dictate engine version when saving
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -55,6 +55,7 @@ set(LCF_SOURCES
src/reader_util.cpp
src/reader_xml.cpp
src/rpg_setup.cpp
+ src/saveopt.cpp
src/writer_lcf.cpp
src/writer_xml.cpp
src/generated/fwd_struct_impl.h

MODIFY
Makefile.am
Makefile.am
@@ -63,6 +63,7 @@ liblcf_la_SOURCES = \
src/reader_util.cpp \
src/reader_xml.cpp \
src/rpg_setup.cpp \
+ src/saveopt.cpp \
src/writer_lcf.cpp \
src/writer_xml.cpp \
src/generated/fwd_struct_impl.h \

MODIFY
src/lcf/lmt/reader.h
src/lcf/lmt/reader.h
@@ -30,12 +30,12 @@ namespace LMT_Reader {
/**
* Saves Map Tree.
*/
- bool Save(const std::string& filename, const lcf::rpg::TreeMap& tmap, bool is2k3, const std::string &encoding, SaveOpt opt = SaveOpt::eNone);
+ bool Save(const std::string& filename, const lcf::rpg::TreeMap& tmap, EngineVersion engine, const std::string &encoding, SaveOpt opt = SaveOpt::eNone);
/**
* Saves Map Tree as XML.
*/
- bool SaveXml(const std::string& filename, const lcf::rpg::TreeMap& tmap, bool is2k3);
+ bool SaveXml(const std::string& filename, const lcf::rpg::TreeMap& tmap, EngineVersion engine);
/**
* Loads Map Tree as XML.
@@ -50,12 +50,12 @@ namespace LMT_Reader {
/**
* Saves Map Tree.
*/
- bool Save(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, bool is2k3, const std::string &encoding, SaveOpt opt = SaveOpt::eNone);
+ bool Save(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, EngineVersion engine, const std::string &encoding, SaveOpt opt = SaveOpt::eNone);
/**
* Saves Map Tree as XML.
*/
- bool SaveXml(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, bool is2k3);
+ bool SaveXml(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, EngineVersion engine);
/**
* Loads Map Tree as XML.

MODIFY
src/lcf/lmu/reader.h
src/lcf/lmu/reader.h
@@ -35,12 +35,12 @@ namespace LMU_Reader {
/**
* Saves map.
*/
- bool Save(const std::string& filename, const rpg::Map& map, bool is2k3, const std::string& encoding, SaveOpt opt = SaveOpt::eNone);
+ bool Save(const std::string& filename, const rpg::Map& map, EngineVersion engine, const std::string& encoding, SaveOpt opt = SaveOpt::eNone);
/**
* Saves map as XML.
*/
- bool SaveXml(const std::string& filename, const rpg::Map& map, bool is2k3);
+ bool SaveXml(const std::string& filename, const rpg::Map& map, EngineVersion engine);
/**
* Loads map as XML.
@@ -55,12 +55,12 @@ namespace LMU_Reader {
/**
* Saves map.
*/
- bool Save(std::ostream& filestream, const rpg::Map& map, bool is2k3, const std::string& encoding, SaveOpt opt = SaveOpt::eNone);
+ bool Save(std::ostream& filestream, const rpg::Map& map, EngineVersion engine, const std::string& encoding, SaveOpt opt = SaveOpt::eNone);
/**
* Saves map as XML.
*/
- bool SaveXml(std::ostream& filestream, const rpg::Map& map, bool is2k3);
+ bool SaveXml(std::ostream& filestream, const rpg::Map& map, EngineVersion engine);
/**
* Loads map as XML.

MODIFY
src/lcf/lsd/reader.h
src/lcf/lsd/reader.h
#include <ctime>
#include <stdint.h>
#include "lcf/rpg/save.h"
+#include "lcf/saveopt.h"
namespace lcf {
@@ -51,12 +52,12 @@ namespace LSD_Reader {
/**
* Saves Savegame.
*/
- bool Save(const std::string& filename, const rpg::Save& save, bool is2k3, const std::string &encoding);
+ bool Save(const std::string& filename, const rpg::Save& save, EngineVersion engine, const std::string &encoding);
/*
* Saves Savegame as XML.
*/
- bool SaveXml(const std::string& filename, const rpg::Save& save, bool is2k3);
+ bool SaveXml(const std::string& filename, const rpg::Save& save, EngineVersion engine);
/**
* Loads Savegame as XML.
@@ -71,12 +72,12 @@ namespace LSD_Reader {
/**
* Saves Savegame.
*/
- bool Save(std::ostream& filestream, const rpg::Save& save, bool is2k3, const std::string &encoding);
+ bool Save(std::ostream& filestream, const rpg::Save& save, EngineVersion engine, const std::string &encoding);
/*
* Saves Savegame as XML.
*/
- bool SaveXml(std::ostream& filestream, const rpg::Save& save, bool is2k3);
+ bool SaveXml(std::ostream& filestream, const rpg::Save& save, EngineVersion engine);
/**
* Loads Savegame as XML.

MODIFY
src/lcf/saveopt.h
src/lcf/saveopt.h
#define LCF_SAVEOPT_H
namespace lcf {
+namespace rpg {
+class Database;
+};
/**
* Options to configure how LDB file is saved
@@ -25,6 +28,16 @@ constexpr SaveOpt operator&(SaveOpt l, SaveOpt r) { return SaveOpt(int(l) & int(
constexpr SaveOpt operator^(SaveOpt l, SaveOpt r) { return SaveOpt(int(l) ^ int(r)); }
constexpr SaveOpt operator~(SaveOpt l) { return SaveOpt(~int(l)); }
+/**
+ * Which LCF file format to write
+ */
+enum class EngineVersion {
+ e2k = 0,
+ e2k3 = 1
+};
+
+EngineVersion GetEngineVersion(const lcf::rpg::Database& db);
+
} //namespace lcf
#endif

MODIFY
src/lcf/writer_lcf.h
src/lcf/writer_lcf.h
#include <stdint.h>
#include "lcf/reader_util.h"
#include "lcf/encoder.h"
+#include "lcf/saveopt.h"
namespace lcf {
@@ -36,10 +37,10 @@ public:
* Constructs a new File Writer.
*
* @param filestream already opened filestream.
- * @param is2k3 Write in RPG2003 format.
+ * @param engine Which format to write.
* @param encoding name of the encoding.
*/
- LcfWriter(std::ostream& filestream, bool is2k3, std::string encoding = "");
+ LcfWriter(std::ostream& filestream, EngineVersion engine, std::string encoding = "");
/**
* Destructor. Closes the opened file.
@@ -127,7 +128,7 @@ private:
/** Encoder object */
Encoder encoder;
/** Writing 2k3 format */
- bool is2k3;
+ EngineVersion engine;
/**
* Converts a 16bit signed integer to/from little-endian.
@@ -167,7 +168,7 @@ private:
};
inline bool LcfWriter::Is2k3() const {
- return is2k3;
+ return engine == EngineVersion::e2k3;
}
} //namespace lcf

MODIFY
src/lcf/writer_xml.h
src/lcf/writer_xml.h
#include <cstdio>
#include <stdint.h>
#include "lcf/string_view.h"
+#include "lcf/saveopt.h"
#include "lcf/span.h"
namespace lcf {
@@ -30,9 +31,9 @@ public:
* Constructs a new XML File Writer.
*
* @param filestream already opened filestream.
- * @param is2k3 Write in RPG2003 format.
+ * @param engine Which engine format to write.
*/
- XmlWriter(std::ostream& filestream, bool is2k3);
+ XmlWriter(std::ostream& filestream, EngineVersion engine);
/**
* Destructor. Closes the opened file.
@@ -114,8 +115,8 @@ protected:
int indent;
/** Indicates if writer cursor is at the beginning of the line. */
bool at_bol;
- /** Writing 2k3 format */
- bool is2k3;
+ /** Writing which engine format */
+ EngineVersion engine;
/**
* Writes an indentation to the stream.
@@ -134,10 +135,9 @@ protected:
};
inline bool XmlWriter::Is2k3() const {
- return is2k3;
+ return engine == EngineVersion::e2k3;
}
-
} //namespace lcf
#endif

MODIFY
src/ldb_reader.cpp
src/ldb_reader.cpp
@@ -77,17 +77,19 @@ std::unique_ptr<lcf::rpg::Database> LDB_Reader::Load(std::istream& filestream, c
db->ldb_header = header;
TypeReader<rpg::Database>::ReadLcf(*db, reader, 0);
+ const auto engine = GetEngineVersion(*db);
// Delayed initialization of some actor fields because they are engine
// dependent
for (auto& actor: db->actors) {
- actor.Setup(db->system.ldb_id == 2003);
+ actor.Setup(engine == EngineVersion::e2k3);
}
return db;
}
bool LDB_Reader::Save(std::ostream& filestream, const lcf::rpg::Database& db, const std::string& encoding, SaveOpt opt) {
- LcfWriter writer(filestream, db.system.ldb_id == 2003, encoding);
+ const auto engine = GetEngineVersion(db);
+ LcfWriter writer(filestream, engine, encoding);
if (!writer.IsOk()) {
LcfReader::SetError("Couldn't parse database file.\n");
return false;
@@ -105,7 +107,8 @@ bool LDB_Reader::Save(std::ostream& filestream, const lcf::rpg::Database& db, co
}
bool LDB_Reader::SaveXml(std::ostream& filestream, const lcf::rpg::Database& db) {
- XmlWriter writer(filestream, db.system.ldb_id == 2003);
+ const auto engine = GetEngineVersion(db);
+ XmlWriter writer(filestream, engine);
if (!writer.IsOk()) {
LcfReader::SetError("Couldn't parse database file.\n");
return false;
@@ -126,10 +129,11 @@ std::unique_ptr<lcf::rpg::Database> LDB_Reader::LoadXml(std::istream& filestream
reader.SetHandler(new RootXmlHandler<rpg::Database>(*db, "LDB"));
reader.Parse();
+ const auto engine = GetEngineVersion(*db);
// Delayed initialization of some actor fields because they are engine
// dependent
for (auto& actor: db->actors) {
- actor.Setup(db->system.ldb_id == 2003);
+ actor.Setup(engine == EngineVersion::e2k3);
}
return db;

MODIFY
src/lmt_reader.cpp
src/lmt_reader.cpp
@@ -27,22 +27,22 @@ std::unique_ptr<lcf::rpg::TreeMap> LMT_Reader::Load(const std::string& filename,
return LMT_Reader::Load(stream, encoding);
}
-bool LMT_Reader::Save(const std::string& filename, const lcf::rpg::TreeMap& tmap, bool is2k3, const std::string& encoding, SaveOpt opt) {
+bool LMT_Reader::Save(const std::string& filename, const lcf::rpg::TreeMap& tmap, EngineVersion engine, const std::string& encoding, SaveOpt opt) {
std::ofstream stream(filename.c_str(), std::ios::binary);
if (!stream.is_open()) {
fprintf(stderr, "Failed to open LMT file `%s' for writing : %s\n", filename.c_str(), strerror(errno));
return false;
}
- return LMT_Reader::Save(stream, tmap, is2k3, encoding, opt);
+ return LMT_Reader::Save(stream, tmap, engine, encoding, opt);
}
-bool LMT_Reader::SaveXml(const std::string& filename, const lcf::rpg::TreeMap& tmap, bool is2k3) {
+bool LMT_Reader::SaveXml(const std::string& filename, const lcf::rpg::TreeMap& tmap, EngineVersion engine) {
std::ofstream stream(filename.c_str(), std::ios::binary);
if (!stream.is_open()) {
fprintf(stderr, "Failed to open LMT XML file `%s' for writing : %s\n", filename.c_str(), strerror(errno));
return false;
}
- return LMT_Reader::SaveXml(stream, tmap, is2k3);
+ return LMT_Reader::SaveXml(stream, tmap, engine);
}
std::unique_ptr<lcf::rpg::TreeMap> LMT_Reader::LoadXml(const std::string& filename) {
@@ -75,8 +75,8 @@ std::unique_ptr<lcf::rpg::TreeMap> LMT_Reader::Load(std::istream& filestream, co
return tmap;
}
-bool LMT_Reader::Save(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, bool is2k3, const std::string &encoding, SaveOpt opt) {
- LcfWriter writer(filestream, is2k3, encoding);
+bool LMT_Reader::Save(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, EngineVersion engine, const std::string &encoding, SaveOpt opt) {
+ LcfWriter writer(filestream, engine, encoding);
if (!writer.IsOk()) {
LcfReader::SetError("Couldn't parse map tree file.\n");
return false;
@@ -93,8 +93,8 @@ bool LMT_Reader::Save(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, b
return true;
}
-bool LMT_Reader::SaveXml(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, bool is2k3) {
- XmlWriter writer(filestream, is2k3);
+bool LMT_Reader::SaveXml(std::ostream& filestream, const lcf::rpg::TreeMap& tmap, EngineVersion engine) {
+ XmlWriter writer(filestream, engine);
if (!writer.IsOk()) {
LcfReader::SetError("Couldn't parse map tree file.\n");
return false;

MODIFY
src/lmu_reader.cpp
src/lmu_reader.cpp
@@ -32,22 +32,22 @@ std::unique_ptr<rpg::Map> LMU_Reader::Load(const std::string& filename, const st
return LMU_Reader::Load(stream, encoding);
}
-bool LMU_Reader::Save(const std::string& filename, const rpg::Map& save, bool is2k3, const std::string& encoding, SaveOpt opt) {
+bool LMU_Reader::Save(const std::string& filename, const rpg::Map& save, EngineVersion engine, const std::string& encoding, SaveOpt opt) {
std::ofstream stream(filename.c_str(), std::ios::binary);
if (!stream.is_open()) {
fprintf(stderr, "Failed to open LMU file `%s' for writing : %s\n", filename.c_str(), strerror(errno));
return false;
}
- return LMU_Reader::Save(stream, save, is2k3, encoding, opt);
+ return LMU_Reader::Save(stream, save, engine, encoding, opt);
}
-bool LMU_Reader::SaveXml(const std::string& filename, const rpg::Map& save, bool is2k3) {
+bool LMU_Reader::SaveXml(const std::string& filename, const rpg::Map& save, EngineVersion engine) {
std::ofstream stream(filename.c_str(), std::ios::binary);
if (!stream.is_open()) {
fprintf(stderr, "Failed to open LMU XML file `%s' for writing : %s\n", filename.c_str(), strerror(errno));
return false;
}
- return LMU_Reader::SaveXml(stream, save, is2k3);
+ return LMU_Reader::SaveXml(stream, save, engine);
}
std::unique_ptr<rpg::Map> LMU_Reader::LoadXml(const std::string& filename) {
@@ -81,8 +81,8 @@ std::unique_ptr<rpg::Map> LMU_Reader::Load(std::istream& filestream, const std::
return map;
}
-bool LMU_Reader::Save(std::ostream& filestream, const rpg::Map& map, bool is2k3, const std::string& encoding, SaveOpt opt) {
- LcfWriter writer(filestream, is2k3, encoding);
+bool LMU_Reader::Save(std::ostream& filestream, const rpg::Map& map, EngineVersion engine, const std::string& encoding, SaveOpt opt) {
+ LcfWriter writer(filestream, engine, encoding);
if (!writer.IsOk()) {
LcfReader::SetError("Couldn't parse map file.\n");
return false;
@@ -100,8 +100,8 @@ bool LMU_Reader::Save(std::ostream& filestream, const rpg::Map& map, bool is2k3,
return true;
}
-bool LMU_Reader::SaveXml(std::ostream& filestream, const rpg::Map& map, bool is2k3) {
- XmlWriter writer(filestream, is2k3);
+bool LMU_Reader::SaveXml(std::ostream& filestream, const rpg::Map& map, EngineVersion engine) {
+ XmlWriter writer(filestream, engine);
if (!writer.IsOk()) {
LcfReader::SetError("Couldn't parse map file.\n");
return false;

MODIFY
src/lsd_reader.cpp
src/lsd_reader.cpp
@@ -48,22 +48,22 @@ std::unique_ptr<rpg::Save> LSD_Reader::Load(const std::string& filename, const s
return LSD_Reader::Load(stream, encoding);
}
-bool LSD_Reader::Save(const std::string& filename, const rpg::Save& save, bool is2k3, const std::string& encoding) {
+bool LSD_Reader::Save(const std::string& filename, const rpg::Save& save, EngineVersion engine, const std::string& encoding) {
std::ofstream stream(filename.c_str(), std::ios::binary);
if (!stream.is_open()) {
fprintf(stderr, "Failed to open LSD file `%s' for writing : %s\n", filename.c_str(), strerror(errno));
return false;
}
- return LSD_Reader::Save(stream, save, is2k3, encoding);
+ return LSD_Reader::Save(stream, save, engine, encoding);
}
-bool LSD_Reader::SaveXml(const std::string& filename, const rpg::Save& save, bool is2k3) {
+bool LSD_Reader::SaveXml(const std::string& filename, const rpg::Save& save, EngineVersion engine) {
std::ofstream stream(filename.c_str(), std::ios::binary);
if (!stream.is_open()) {
fprintf(stderr, "Failed to open LSD XML file `%s' for writing : %s\n", filename.c_str(), strerror(errno));
return false;
}
- return LSD_Reader::SaveXml(stream, save, is2k3);
+ return LSD_Reader::SaveXml(stream, save, engine);
}
std::unique_ptr<rpg::Save> LSD_Reader::LoadXml(const std::string& filename) {
@@ -95,8 +95,8 @@ std::unique_ptr<rpg::Save> LSD_Reader::Load(std::istream& filestream, const std:
return std::unique_ptr<rpg::Save>(save);
}
-bool LSD_Reader::Save(std::ostream& filestream, const rpg::Save& save, bool is2k3, const std::string &encoding) {
- LcfWriter writer(filestream, is2k3, encoding);
+bool LSD_Reader::Save(std::ostream& filestream, const rpg::Save& save, EngineVersion engine, const std::string &encoding) {
+ LcfWriter writer(filestream, engine, encoding);
if (!writer.IsOk()) {
LcfReader::SetError("Couldn't parse save file.\n");
return false;
@@ -109,8 +109,8 @@ bool LSD_Reader::Save(std::ostream& filestream, const rpg::Save& save, bool is2k
return true;
}
-bool LSD_Reader::SaveXml(std::ostream& filestream, const rpg::Save& save, bool is2k3) {
- XmlWriter writer(filestream, is2k3);
+bool LSD_Reader::SaveXml(std::ostream& filestream, const rpg::Save& save, EngineVersion engine) {
+ XmlWriter writer(filestream, engine);
if (!writer.IsOk()) {
LcfReader::SetError("Couldn't parse save file.\n");
return false;

ADD
src/saveopt.cpp
+#include "lcf/saveopt.h"
+#include "lcf/rpg/database.h"
+
+namespace lcf {
+
+EngineVersion GetEngineVersion(const lcf::rpg::Database& db) {
+ if (db.system.ldb_id == 2003) {
+ return EngineVersion::e2k3;
+ }
+ return EngineVersion::e2k;
+}
+
+} // namespace lcf

MODIFY
src/writer_lcf.cpp
src/writer_lcf.cpp
namespace lcf {
-LcfWriter::LcfWriter(std::ostream& filestream, bool is2k3, std::string encoding)
+LcfWriter::LcfWriter(std::ostream& filestream, EngineVersion engine, std::string encoding)
: stream(filestream)
, encoder(std::move(encoding))
- , is2k3(is2k3)
+ , engine(engine)
{
}

MODIFY
src/writer_xml.cpp
src/writer_xml.cpp
#include <ostream>
#include <vector>
+#include "lcf/saveopt.h"
#include "lcf/writer_xml.h"
#include "lcf/dbstring.h"
#include "lcf/dbarray.h"
namespace lcf {
-XmlWriter::XmlWriter(std::ostream& filestream, bool is2k3) :
+XmlWriter::XmlWriter(std::ostream& filestream, EngineVersion engine) :
stream(filestream),
indent(0),
at_bol(true),
- is2k3(is2k3)
+ engine(engine)
{
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
}

MODIFY
tools/lcf2xml.cpp
tools/lcf2xml.cpp
@@ -50,7 +50,7 @@ std::string GetFilename(const std::string& str);
FileCategories GetFilecategory(const std::string& in_file);
FileTypes GetFiletype(const std::string& in_file, std::string& out_extension);
void PrintReaderError(const std::string data);
-int ReaderWriteToFile(const std::string& in, const std::string& out, FileTypes in_type, bool is2k3);
+int ReaderWriteToFile(const std::string& in, const std::string& out, FileTypes in_type, lcf::EngineVersion engine);
int main(int argc, char** argv)
{
@@ -72,14 +72,14 @@ int main(int argc, char** argv)
std::string extension;
unsigned int errors = 0;
- bool is2k3 = true;
+ lcf::EngineVersion engine = lcf::EngineVersion::e2k3;
for (int i = 1; i < argc; ++i) {
if (!std::strcmp(argv[i], "--2k")) {
- is2k3 = false;
+ engine = lcf::EngineVersion::e2k;
continue;
}
if (!std::strcmp(argv[i], "--2k3")) {
- is2k3 = true;
+ engine = lcf::EngineVersion::e2k3;
continue;
}
if (category == FileCategory_Invalid) {
@@ -100,7 +100,7 @@ int main(int argc, char** argv)
outfile = GetFilename(*it);
type = GetFiletype(*it, extension);
outfile += extension;
- if (ReaderWriteToFile(*it, outfile, type, is2k3) != 0) {
+ if (ReaderWriteToFile(*it, outfile, type, engine) != 0) {
errors++;
}
}
@@ -241,7 +241,7 @@ void PrintReaderError(const std::string data)
}
/** Takes data from in and writes converted data into out using liblcf. */
-int ReaderWriteToFile(const std::string& in, const std::string& out, FileTypes in_type, bool is2k3)
+int ReaderWriteToFile(const std::string& in, const std::string& out, FileTypes in_type, lcf::EngineVersion engine)
{
std::string path = GetPath(in) + "/";
std::string encoding = "";
@@ -280,14 +280,14 @@ int ReaderWriteToFile(const std::string& in, const std::string& out, FileTypes i
{
auto file = lcf::LMU_Reader::Load(in, encoding);
LCFXML_ERROR(file == nullptr, "LMU load");
- LCFXML_ERROR(!lcf::LMU_Reader::SaveXml(out, *file, is2k3), "LMU XML save");
+ LCFXML_ERROR(!lcf::LMU_Reader::SaveXml(out, *file, engine), "LMU XML save");
break;
}
case FileType_LCF_SaveData:
{
auto file = lcf::LSD_Reader::Load(in, encoding);
LCFXML_ERROR(file == nullptr, "LSD load");
- LCFXML_ERROR(!lcf::LSD_Reader::SaveXml(out, *file, is2k3), "LSD XML save");
+ LCFXML_ERROR(!lcf::LSD_Reader::SaveXml(out, *file, engine), "LSD XML save");
break;
}
case FileType_LCF_Database:
@@ -301,21 +301,21 @@ int ReaderWriteToFile(const std::string& in, const std::string& out, FileTypes i
{
auto file = lcf::LMT_Reader::Load(in, encoding);
LCFXML_ERROR(file == nullptr, "LMT load");
- LCFXML_ERROR(!lcf::LMT_Reader::SaveXml(out, *file, is2k3), "LMT XML save");
+ LCFXML_ERROR(!lcf::LMT_Reader::SaveXml(out, *file, engine), "LMT XML save");
break;
}
case FileType_XML_MapUnit:
{
auto file = lcf::LMU_Reader::LoadXml(in);
LCFXML_ERROR(file == nullptr, "LMU XML load");
- LCFXML_ERROR(!lcf::LMU_Reader::Save(out, *file, is2k3, encoding), "LMU save");
+ LCFXML_ERROR(!lcf::LMU_Reader::Save(out, *file, engine, encoding), "LMU save");
break;
}
case FileType_XML_SaveData:
{
auto file = lcf::LSD_Reader::LoadXml(in);
LCFXML_ERROR(file == nullptr, "LSD XML load");
- LCFXML_ERROR(!lcf::LSD_Reader::Save(out, *file, is2k3, encoding), "LSD save");
+ LCFXML_ERROR(!lcf::LSD_Reader::Save(out, *file, engine, encoding), "LSD save");
break;
}
case FileType_XML_Database:
@@ -329,7 +329,7 @@ int ReaderWriteToFile(const std::string& in, const std::string& out, FileTypes i
{
auto file = lcf::LMT_Reader::LoadXml(in);
LCFXML_ERROR(file == nullptr, "LMT XML load");
- LCFXML_ERROR(!lcf::LMT_Reader::Save(out, *file, is2k3, encoding), "LMT save");
+ LCFXML_ERROR(!lcf::LMT_Reader::Save(out, *file, engine, encoding), "LMT save");
break;
}
case FileType_Invalid:

Use an enum to dictate engine version when saving