summaryrefslogtreecommitdiffstats
path: root/converter/source/main.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-04 21:13:10 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-04 21:13:10 +0100
commitc10ba99d155ec0f1b0b735d3651d3b78304c6b82 (patch)
treed697ccc211edf74c7dbc88f5c8bc02551b0290c2 /converter/source/main.cpp
parentUpdated denotch map converter. Compiled with zlib that MCServr uses to remove the lag spike problem caused when reading map files using a different compression. Remade makefile and cleaned up code considerably. (diff)
downloadcuberite-c10ba99d155ec0f1b0b735d3651d3b78304c6b82.tar
cuberite-c10ba99d155ec0f1b0b735d3651d3b78304c6b82.tar.gz
cuberite-c10ba99d155ec0f1b0b735d3651d3b78304c6b82.tar.bz2
cuberite-c10ba99d155ec0f1b0b735d3651d3b78304c6b82.tar.lz
cuberite-c10ba99d155ec0f1b0b735d3651d3b78304c6b82.tar.xz
cuberite-c10ba99d155ec0f1b0b735d3651d3b78304c6b82.tar.zst
cuberite-c10ba99d155ec0f1b0b735d3651d3b78304c6b82.zip
Diffstat (limited to '')
-rw-r--r--converter/source/main.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/converter/source/main.cpp b/converter/source/main.cpp
new file mode 100644
index 000000000..7f415d896
--- /dev/null
+++ b/converter/source/main.cpp
@@ -0,0 +1,52 @@
+#include <iostream>
+#include "cNBTData.h"
+#include "cTimer.h"
+#include "cQuicksort.h"
+#include "cDeNotch.h"
+#include <dirent.h>
+
+int main () {
+
+ cTimer Timer;
+ clock_t progBegin = clock(); //start main program timer
+ std::string dir;
+ DIR* dp;
+ struct dirent *entry;
+ int found;
+ std::string entrys;
+ std::string str2;
+ std::string str3;
+ std::string filexPos;
+ std::string filezPos;
+ std::string pak_name;
+ //string* dir_array;
+ int dir_num_files = 0;
+ int ctr = 0;
+
+ if(dp = opendir("region/")){
+ while(entry = readdir(dp)){
+ entrys = entry->d_name;
+ found = entrys.find(".mcr");
+ if ( (found!=std::string::npos) && (entry->d_type==8) ) {
+ str2 = entrys.substr (2,sizeof(entrys));
+ filexPos = str2.substr (0,(int)str2.find("."));
+ str3 = str2.substr ((int)str2.find(".")+1, sizeof(str2));
+ filezPos = str3.substr (0,(int)str3.find("."));
+ pak_name = "X" + filexPos + "_Z" + filezPos + ".pak";
+
+ clock_t begin=clock(); //start execution timer
+
+ cDeNotch DeNotch;
+ DeNotch.Converter ( entrys, pak_name );
+
+
+ clock_t end=clock();
+ std::cout << "Time to convert chunk: " << double(Timer.diffclock(end,begin)) << " Seconds"<< std::endl;
+ }
+ }
+ closedir(dp);
+ }
+ clock_t progEnd = clock(); //end main program timer
+ std::cout << "Time to complete converter: " << double(Timer.diffclock(progEnd,progBegin)) << " Seconds"<< std::endl;
+ return 0;
+};