From da197f063fad9e7a1f8298f3700d845973568d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Fri, 5 Dec 2014 16:18:48 +0100 Subject: [PATCH] Fixed the filesytem for the converter. --- Levels/ObjectSetups/BackupLevel0.png | Bin 0 -> 158 bytes Levels/ObjectSetups/Level0.xml | 116 ++++++++++++++++++ ...{ColumnTexture2.png => columnTexture2.png} | Bin converter/converter.cc | 15 ++- 4 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 Levels/ObjectSetups/BackupLevel0.png create mode 100644 Levels/ObjectSetups/Level0.xml rename Levels/Textures/{ColumnTexture2.png => columnTexture2.png} (100%) diff --git a/Levels/ObjectSetups/BackupLevel0.png b/Levels/ObjectSetups/BackupLevel0.png new file mode 100644 index 0000000000000000000000000000000000000000..aa341c0f91aa040e96ceeb2aa59db7fd3c230c49 GIT binary patch literal 158 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V6Od#Ih`sfJswtmF5N|oEct*!ww^AIArhB+`%VfnDDW_uZ(H?udjtRR+bj0W*x;kkRHOLP z>B|F-nJP7{&nDeWYIy%GuGQ+ew0*4miXX?{^GGuE{}&3K=>jx}!PC{xWt~$(698_D BFXI3J literal 0 HcmV?d00001 diff --git a/Levels/ObjectSetups/Level0.xml b/Levels/ObjectSetups/Level0.xml new file mode 100644 index 0000000..6fcee82 --- /dev/null +++ b/Levels/ObjectSetups/Level0.xml @@ -0,0 +1,116 @@ + + 1.0 + 0.0 + 0.0 + 0.0 + 3.500000 + 0.0 + 3.500000 + 1 + 9 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + 3.500000 + 0.0 + -0.500000 + 1 + 8 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + 2.500000 + 0.0 + -2.500000 + 1 + 7 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + 1.500000 + 0.0 + 0.500000 + 1 + 6 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -0.500000 + 0.0 + 1.500000 + 1 + 5 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -0.500000 + 0.0 + -1.500000 + 1 + 4 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -2.500000 + 0.0 + -1.500000 + 1 + 3 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -3.500000 + 0.0 + -3.500000 + 1 + 2 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -4.500000 + 0.0 + -4.500000 + 1 + 1 + 99 + diff --git a/Levels/Textures/ColumnTexture2.png b/Levels/Textures/columnTexture2.png similarity index 100% rename from Levels/Textures/ColumnTexture2.png rename to Levels/Textures/columnTexture2.png diff --git a/converter/converter.cc b/converter/converter.cc index 0dec1dc..8a62dd2 100644 --- a/converter/converter.cc +++ b/converter/converter.cc @@ -1,6 +1,7 @@ #include "converter.hh" #include #include +#include using namespace tinyxml2; @@ -14,10 +15,20 @@ Converter::Converter(std::string level){ printf("Could not open Compositions!!!\n"); } + //Create a backup of the current Level png file, if no backup exists + std::string pngFile = "../Levels/ObjectSetups/Level" + level + ".png"; + std::string backupPNG = "../Levels/ObjectSetups/BackupLevel" + level + ".png"; + struct stat buf; + if(stat(backupPNG.c_str(), &buf) != 0){ + std::ifstream src(pngFile, std::ios::binary); + std::ofstream dst(backupPNG, std::ios::binary); + dst << src.rdbuf(); + } + //Create a backup of the current Level xml file - std::string backup = "../Levels/ObjectSetups/BackupLevel" + level + ".xml"; + std::string backupXML = "../Levels/ObjectSetups/BackupLevel" + level + ".xml"; std::ifstream src(xmlFile, std::ios::binary); - std::ofstream dst(backup, std::ios::binary); + std::ofstream dst(backupXML, std::ios::binary); dst << src.rdbuf(); //Load the Level xml file