From bd80053588a9a38c9f7a1f132d36fb0844b91af4 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 15 Feb 2017 16:57:14 -0500 Subject: reset flag redo --- main.cpp | 12 +++++++++++- src/world.cpp | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 34d3367..e0bb5d2 100644 --- a/main.cpp +++ b/main.cpp @@ -27,7 +27,7 @@ using namespace std::literals::chrono_literals; /** * The currently used folder to look for XML files in. */ -std::string xmlFolder = "xml/"; +std::string xmlFolder = "./xml/"; /** * The current center of the screen, updated in main render. @@ -80,6 +80,16 @@ int main(int argc, char *argv[]) // kill the world if needed if (worldReset) { + for (const auto& s : xmlFiles) { + if (s.find(".dat", s.size() - 4) != std::string::npos) { + std::string re = xmlFolder; + re.append(s); + auto r = re.c_str(); + std::cout << "Removing " << r << "...\n"; + std::remove(r); + } + } + // TODO TODO TODO we do xml/*.dat now... kill that game::briceClear(); } diff --git a/src/world.cpp b/src/world.cpp index 6c58515..f4be288 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -191,7 +191,8 @@ void WorldSystem::load(const std::string& file) return; // save the current world's data - save(); + if (!currentXMLFile.empty()) + save(); // load file data to string auto xmlPath = xmlFolder + file; -- cgit v1.2.3