24 std::unique_ptr<RPG::Map>
LMU_Reader::Load(
const std::string& filename,
const std::string& encoding) {
25 std::ifstream stream(filename.c_str(), std::ios::binary);
26 if (!stream.is_open()) {
27 fprintf(stderr,
"Failed to open LMU file `%s' for reading : %s\n", filename.c_str(), strerror(errno));
34 std::ofstream stream(filename.c_str(), std::ios::binary);
35 if (!stream.is_open()) {
36 fprintf(stderr,
"Failed to open LMU file `%s' for writing : %s\n", filename.c_str(), strerror(errno));
43 std::ofstream stream(filename.c_str(), std::ios::binary);
44 if (!stream.is_open()) {
45 fprintf(stderr,
"Failed to open LMU XML file `%s' for writing : %s\n", filename.c_str(), strerror(errno));
52 std::ifstream stream(filename.c_str(), std::ios::binary);
53 if (!stream.is_open()) {
54 fprintf(stderr,
"Failed to open LMU XML file `%s' for reading : %s\n", filename.c_str(), strerror(errno));
60 std::unique_ptr<RPG::Map>
LMU_Reader::Load(std::istream& filestream,
const std::string& encoding) {
64 return std::unique_ptr<RPG::Map>();
68 if (header.length() != 10) {
70 return std::unique_ptr<RPG::Map>();
72 if (header !=
"LcfMapUnit") {
73 fprintf(stderr,
"Warning: This header is not LcfMapUnit and might not be a valid RPG2000 map.\n");
76 auto map = std::unique_ptr<RPG::Map>(
new RPG::Map());
77 map->lmu_header = std::move(header);
90 header =
"LcfMapUnit";
103 if (!writer.
IsOk()) {
115 if (!reader.
IsOk()) {
117 return std::unique_ptr<RPG::Map>();
120 auto map = std::unique_ptr<RPG::Map>(
new RPG::Map());