summaryrefslogtreecommitdiff
path: root/tools/tmwcon
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2008-11-22 21:14:54 -0700
committerFate <fate-tmw@googlemail.com>2008-11-22 21:14:54 -0700
commit781f70b09f66f177cd737e8b98c052623a5da65c (patch)
tree1b10b1e04ed1597a7bcbf6e554fc6d742967f579 /tools/tmwcon
parent3363153862fdf48cbcaea823e762750a30e07b6c (diff)
downloadserverdata-781f70b09f66f177cd737e8b98c052623a5da65c.tar.gz
serverdata-781f70b09f66f177cd737e8b98c052623a5da65c.tar.bz2
serverdata-781f70b09f66f177cd737e8b98c052623a5da65c.tar.xz
serverdata-781f70b09f66f177cd737e8b98c052623a5da65c.zip
Sort all _index.txt and _include.txt files before writing them out
Diffstat (limited to 'tools/tmwcon')
-rw-r--r--tools/tmwcon/src/converter/Process.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/tmwcon/src/converter/Process.java b/tools/tmwcon/src/converter/Process.java
index e2f6f243..8f077d5c 100644
--- a/tools/tmwcon/src/converter/Process.java
+++ b/tools/tmwcon/src/converter/Process.java
@@ -10,6 +10,9 @@ import java.io.*;
import java.util.Iterator;
import java.util.Properties;
import java.util.TreeSet;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
import tiled.core.*;
import tiled.plugins.tmw.*;
@@ -116,12 +119,12 @@ public class Process {
}
}
- private static void processFiles(File folder, PrintWriter out) {
+ private static void processFiles(File folder, List<String> out) {
for (File f : folder.listFiles()) {
if (f.isDirectory()) {
processFiles(folder, out);
} else if (!f.getName().equals(importFile)) {
- out.printf("npc: %s\n", f.getPath().substring(_baseFolder.getPath().length() + 1));
+ out.add("npc: " + f.getPath().substring(_baseFolder.getPath().length() + 1));
}
}
}
@@ -181,9 +184,13 @@ public class Process {
mobOut.close();
File _import = new File(folder, importFile);
+ List<String> output_elements = new ArrayList<String>();
+ processFiles(folder, output_elements);
PrintWriter importOut = Main.getWriter(_import);
importOut.printf("map: %s.gat\n", name);
- processFiles(folder, importOut);
+ Collections.sort(output_elements);
+ for (String s : output_elements)
+ importOut.println(s);
importOut.flush();
importOut.close();
@@ -195,11 +202,17 @@ public class Process {
PrintWriter out = Main.getWriter(master);
if (out == null) return;
+ List<String> output_elements = new ArrayList<String>();
+
for (String folder : folders) {
if (folder == null) continue;
- out.printf("import: %s/_import.txt\n", folder);
+ output_elements.add("import: " + folder + "/_import.txt");
}
+ Collections.sort(output_elements);
+ for (String s : output_elements)
+ out.println(s);
+
out.flush();
out.close();
}