]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
reset flag redo
authorClyne Sullivan <tullivan99@gmail.com>
Wed, 15 Feb 2017 21:57:14 +0000 (16:57 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Wed, 15 Feb 2017 21:57:14 +0000 (16:57 -0500)
main.cpp
src/world.cpp

index 34d3367dcee2b3f67ce3d9273c972170f8cc6bae..e0bb5d2ac2fede8f89530490ee01d76d0c25aeb1 100644 (file)
--- 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();
        }
index 6c5851547e7e2c68d8c46b21a0d8dea06822fa6d..f4be288e2f31db2aa5d80b82a6cc2fd09301f185 100644 (file)
@@ -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;