|
@@ -295,13 +295,18 @@ void Galaxy::load(void) {
|
|
|
ports.clear();
|
|
|
warps.clear();
|
|
|
if (file_exists(filename)) {
|
|
|
+ BUGZ_LOG(fatal) << "Galaxy::load( " << filename << " )";
|
|
|
+
|
|
|
YAML::Node data = YAML::LoadFile(filename);
|
|
|
- if (config["meta"]) meta = config["meta"];
|
|
|
+
|
|
|
+ if (data["meta"]) {
|
|
|
+ meta = data["meta"];
|
|
|
+ } else {
|
|
|
+ BUGZ_LOG(fatal) << "Missing meta data.";
|
|
|
+ }
|
|
|
meta["load_from"] = filename;
|
|
|
- std::chrono::_V2::system_clock::time_point now =
|
|
|
- std::chrono::system_clock::now();
|
|
|
+ meta["load_time"] = time_t_now(); // time_t
|
|
|
|
|
|
- meta["load_time"] = std::chrono::system_clock::to_time_t(now); // time_t
|
|
|
if (data["config"]) {
|
|
|
config = data["config"];
|
|
|
} else {
|
|
@@ -354,9 +359,10 @@ void Galaxy::load(void) {
|
|
|
BUGZ_LOG(fatal) << "YAML Missing warps section.";
|
|
|
}
|
|
|
|
|
|
- BUGZ_LOG(fatal) << "YAML: config keys: " << config.size();
|
|
|
- BUGZ_LOG(fatal) << "YAML: warp keys: " << warps.size();
|
|
|
- BUGZ_LOG(fatal) << "YAML: port keys: " << ports.size();
|
|
|
+ BUGZ_LOG(trace) << "YAML: meta keys: " << meta.size();
|
|
|
+ BUGZ_LOG(trace) << "YAML: config keys: " << config.size();
|
|
|
+ BUGZ_LOG(trace) << "YAML: warp keys: " << warps.size();
|
|
|
+ BUGZ_LOG(trace) << "YAML: port keys: " << ports.size();
|
|
|
|
|
|
} else {
|
|
|
BUGZ_LOG(fatal) << "Missing YAML: " << filename;
|
|
@@ -373,16 +379,15 @@ void Galaxy::save(void) {
|
|
|
str(boost::format("%1%-%2%-%3%.yaml") % basename % game % username);
|
|
|
|
|
|
std::ofstream fout(filename);
|
|
|
- fout << "%YAML 1.2" << std::endl << "---" << std::endl;
|
|
|
+ // fout << "%YAML 1.2" << std::endl << "---" << std::endl;
|
|
|
+ fout << "---" << std::endl;
|
|
|
|
|
|
BUGZ_LOG(fatal) << "YAML: " << filename;
|
|
|
int depth = 0;
|
|
|
std::string depth_spacer;
|
|
|
|
|
|
meta["save_to"] = filename;
|
|
|
- std::chrono::_V2::system_clock::time_point now =
|
|
|
- std::chrono::system_clock::now();
|
|
|
- meta["save_time"] = std::chrono::system_clock::to_time_t(now); // time_t
|
|
|
+ meta["save_time"] = time_t_now(); // time_t
|
|
|
|
|
|
/* // testing sequence code
|
|
|
meta["sequence"]["part"].push_back(1);
|
|
@@ -428,17 +433,17 @@ void Galaxy::save(void) {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+ BUGZ_LOG(trace) << "YAML meta: " << meta.size();
|
|
|
yaml_out(fout, depth, meta);
|
|
|
|
|
|
- BUGZ_LOG(fatal) << "YAML config: " << config.size();
|
|
|
+ BUGZ_LOG(trace) << "YAML config: " << config.size();
|
|
|
fout << "config:" << std::endl;
|
|
|
|
|
|
// in config, I usually switch to doing flow instead. I'll keep this like
|
|
|
// this for now.
|
|
|
yaml_out(fout, depth, config);
|
|
|
|
|
|
- BUGZ_LOG(fatal) << "YAML warps: " << warps.size();
|
|
|
+ BUGZ_LOG(trace) << "YAML warps: " << warps.size();
|
|
|
fout << "warps:" << std::endl;
|
|
|
|
|
|
for (auto const &warp : warps) {
|
|
@@ -454,7 +459,7 @@ void Galaxy::save(void) {
|
|
|
fout << "]" << std::endl;
|
|
|
}
|
|
|
|
|
|
- BUGZ_LOG(fatal) << "YAML ports: " << ports.size();
|
|
|
+ BUGZ_LOG(trace) << "YAML ports: " << ports.size();
|
|
|
fout << "ports:" << std::endl;
|
|
|
|
|
|
/*
|