diff --git a/.gitignore b/.gitignore index 1618189450a..3bb4b517e45 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ #ignore other, specific files and folers data/ -/maps/backup/* -/maps/RandomZLevels/backup/* -/maps/cyberiad.dmm.backup +/_maps/map_files/backup/* +/_maps/map_files/**/backup/* +/_maps/map_files/**/*.dmm.backup /nano/debug.html diff --git a/tools/mapmerge/1prepare_map.bat b/tools/mapmerge/1prepare_map.bat deleted file mode 100644 index 05fddbce240..00000000000 --- a/tools/mapmerge/1prepare_map.bat +++ /dev/null @@ -1,6 +0,0 @@ -set MAPFILE=cyberiad.dmm - -cd ../../maps -copy %MAPFILE% %MAPFILE%.backup - -pause diff --git a/tools/mapmerge/2clean_map.bat b/tools/mapmerge/2clean_map.bat deleted file mode 100644 index 02590eb48f7..00000000000 --- a/tools/mapmerge/2clean_map.bat +++ /dev/null @@ -1,5 +0,0 @@ -set MAPFILE=cyberiad.dmm - -java -jar MapPatcher.jar -clean ../../maps/%MAPFILE%.backup ../../maps/%MAPFILE% ../../maps/%MAPFILE% - -pause \ No newline at end of file diff --git a/tools/mapmerge/HOWTO.txt b/tools/mapmerge/HOWTO.txt deleted file mode 100644 index 848044d405c..00000000000 --- a/tools/mapmerge/HOWTO.txt +++ /dev/null @@ -1,4 +0,0 @@ -1.Click 1prepare_map.bat -2. Do your map edits. -3.Click 2clean_map.bat -4. Delete Cyberiad.dmm.backup in /maps \ No newline at end of file diff --git a/tools/mapmerge/MapPatcher.jar b/tools/mapmerge/MapPatcher.jar index f4351b36037..5cbaad488c1 100644 Binary files a/tools/mapmerge/MapPatcher.jar and b/tools/mapmerge/MapPatcher.jar differ diff --git a/tools/mapmerge/Source/Location.java b/tools/mapmerge/Source/Location.java new file mode 100644 index 00000000000..2a901d54b27 --- /dev/null +++ b/tools/mapmerge/Source/Location.java @@ -0,0 +1,42 @@ +class Location +{ + int x; + int y; + int z; + + public Location() + { + } + + public Location(int paramInt1, int paramInt2, int paramInt3) + { + this.x = paramInt1; + this.y = paramInt2; + this.z = paramInt3; + } + + public void set(int paramInt1, int paramInt2, int paramInt3) + { + this.x = paramInt1; + this.y = paramInt2; + this.z = paramInt3; + } + + public boolean equals(Object paramObject) + { + if (!(paramObject instanceof Location)) return false; + Location localLocation = (Location)paramObject; + if ((this.x != localLocation.x) || (this.y != localLocation.y) || (this.z != localLocation.z)) return false; + return true; + } + + public int hashCode() + { + return (this.z * 256 + this.y) * 256 + this.x; + } + + public String toString() + { + return "(" + this.x + "," + this.y + "," + this.z + ")"; + } +} diff --git a/tools/mapmerge/Source/META-INF/MANIFEST.MF b/tools/mapmerge/Source/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..5aa53c2fa28 --- /dev/null +++ b/tools/mapmerge/Source/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Created-By: 1.6.0_31 (Sun Microsystems Inc.) +Main-Class: MapPatcher + diff --git a/tools/mapmerge/Source/Map.java b/tools/mapmerge/Source/Map.java new file mode 100644 index 00000000000..949db7e6cad --- /dev/null +++ b/tools/mapmerge/Source/Map.java @@ -0,0 +1,314 @@ +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Set; +import java.util.Vector; + +public class Map +{ + boolean sizeunknown; + int minx; + int miny; + int minz; + int maxx; + int maxy; + int maxz; + HashMap tile_types; + HashMap codes_by_value; + HashMap tiles; + + public Map() + { + this.sizeunknown = true; + this.tile_types = new HashMap(); + this.codes_by_value = new HashMap(); + this.tiles = new HashMap(); + } + + public Map(File paramFile) + { + this(paramFile, false); + } + + public Map(File paramFile, boolean paramBoolean) + { + this.sizeunknown = true; + try { + BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(paramFile))); + + this.tile_types = new HashMap(); + this.codes_by_value = new HashMap(); + this.tiles = new HashMap(); + + MapPatcher.Systemoutprintln(new StringBuilder().append("Loading map ").append(paramFile.getName()).toString()); + MapPatcher.Systemoutprint("Loading tiles"); + String str1 = ""; + int i = 0; + while ((str1 = localBufferedReader.readLine()) != null) + { + if (str1.equals("")) break; + if (str1.startsWith("\"")) + { + if (i < 1) + { + int j = str1.indexOf("\"", 1); + i = j - 1; + } + String str2 = str1.substring(1, 1 + i); + String str3 = str1.substring(str1.indexOf("(")); + this.tile_types.put(str2, str3); + this.codes_by_value.put(str3, str2); + } + } + + MapPatcher.Systemoutprintln(new StringBuilder().append(" ").append(this.tile_types.size()).toString()); + if (!paramBoolean) + { + MapPatcher.Systemoutprintln("Loading levels"); + while (true) + { + if ((str1 = localBufferedReader.readLine()) != null) { if (str1.startsWith("(")) break label270; } else { + label270: if (str1 == null) + { + break; + } + int k = str1.indexOf(",", 1); + int m = Integer.parseInt(str1.substring(1, k)); + str1 = str1.substring(k); + k = str1.indexOf(",", 1); + int n = Integer.parseInt(str1.substring(1, k)); + str1 = str1.substring(k); + k = str1.indexOf(")", 1); + int i1 = Integer.parseInt(str1.substring(1, k)); + + MapPatcher.Systemoutprintln(new StringBuilder().append("New map part from (").append(m).append(",").append(n).append(",").append(i1).append(")").toString()); + + int i3 = n; + if (this.sizeunknown) + { + this.minx = m; this.maxx = this.minx; + this.miny = n; this.maxy = this.miny; + this.minz = i1; this.maxz = this.minz; + this.sizeunknown = false; + } + if (this.minz > i1) this.minz = i1; + if (this.maxz < i1) this.maxz = i1; + while (!(str1 = localBufferedReader.readLine()).startsWith("\"}")) + { + int i2 = m; + if (this.miny > i3) this.miny = i3; + if (this.maxy < i3) this.maxy = i3; + while (str1.length() > 0) + { + String str4 = str1.substring(0, i); + Location localLocation = new Location(i2, i3, i1); + if (this.minx > i2) this.minx = i2; + if (this.maxx < i2) this.maxx = i2; + this.tiles.put(localLocation, this.tile_types.get(str4)); + str1 = str1.substring(i); + i2++; + } + i3++; + } + } + } + } + localBufferedReader.close(); + } + catch (Exception localException) + { + localException.printStackTrace(); + } + } + + public void mirrorY() + { + for (int i = this.minz; i <= this.maxz; i++) + for (int j = this.minx; j <= this.maxx; j++) + for (int k = this.miny; k < (this.miny + this.maxy) / 2; k++) + { + int m = this.maxy - (k - this.miny); + String str = contentAt2(j, k, i); + setAt(j, k, i, contentAt2(j, m, i)); + setAt(j, m, i, str); + } + } + + public String contentAt(int paramInt1, int paramInt2, int paramInt3) + { + Location localLocation = new Location(paramInt1, paramInt2, paramInt3); + String str = (String)this.tiles.get(localLocation); + if (str == null) System.err.println(new StringBuilder().append("Null at ").append(paramInt1).append(",").append(paramInt2).append(",").append(paramInt3).append(" Possible loading error").toString()); + return str == null ? "null" : str; + } + + public String contentAt2(int paramInt1, int paramInt2, int paramInt3) + { + Location localLocation = new Location(paramInt1, paramInt2, paramInt3); + return (String)this.tiles.get(localLocation); + } + + public void setAt(int paramInt1, int paramInt2, int paramInt3, String paramString) + { + if (this.sizeunknown) + { + this.minx = (this.maxx = paramInt1); + this.miny = (this.maxy = paramInt2); + this.minz = (this.maxz = paramInt3); + this.sizeunknown = false; + } + else + { + this.minx = Math.min(this.minx, paramInt1); + this.miny = Math.min(this.miny, paramInt2); + this.minz = Math.min(this.minz, paramInt3); + this.maxx = Math.max(this.maxx, paramInt1); + this.maxy = Math.max(this.maxy, paramInt2); + this.maxz = Math.max(this.maxz, paramInt3); + } + Location localLocation = new Location(paramInt1, paramInt2, paramInt3); + localLocation.set(paramInt1, paramInt2, paramInt3); + this.tiles.put(localLocation, paramString); + } + + public void save(File paramFile) throws Exception + { + saveReferencing(paramFile, null); + } + + public void saveReferencing(File paramFile, Map paramMap) throws Exception + { + FileWriter localFileWriter = new FileWriter(paramFile); + + this.tile_types.clear(); + this.codes_by_value.clear(); + Vector localVector1 = new Vector(); + for (Object localObject1 = this.tiles.keySet().iterator(); ((Iterator)localObject1).hasNext(); ) { Location localLocation = (Location)((Iterator)localObject1).next(); + + String str1 = (String)this.tiles.get(localLocation); + if (!localVector1.contains(str1)) + localVector1.add(str1); + } + MapPatcher.Systemoutprintln(new StringBuilder().append("We have ").append(localVector1.size()).append(" different tiles").toString()); + localObject1 = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; + + int i = 1; + int j = localObject1.length; + while (j < localVector1.size()) + { + j *= localObject1.length; + i++; + } + Vector localVector2; + if (paramMap == null) { + localVector2 = localVector1; + } + else { + localVector2 = new Vector(); + for (Iterator localIterator = localVector1.iterator(); localIterator.hasNext(); ) { localObject2 = (String)localIterator.next(); + + if (paramMap.codes_by_value.containsKey(localObject2)) + { + localObject3 = paramMap.getIdFor((String)localObject2); + this.tile_types.put(localObject3, localObject2); + this.codes_by_value.put(localObject2, localObject3); + } + else { + localVector2.add(localObject2); + } } + localVector1.clear(); + } + + int k = 0; + for (Object localObject2 = localVector2.iterator(); ((Iterator)localObject2).hasNext(); ) { localObject3 = (String)((Iterator)localObject2).next(); + do + { + str2 = int2code((String[])localObject1, k, i); + k++; + }while (this.tile_types.containsKey(str2)); + this.tile_types.put(str2, localObject3); + this.codes_by_value.put(localObject3, str2); + } + String str2; + localVector2.clear(); + + k = 0; + for (int m = 0; m < this.tile_types.size(); m++) + { + do + { + localObject3 = int2code((String[])localObject1, k, i); + k++; + }while (!this.tile_types.containsKey(localObject3)); + str2 = (String)this.tile_types.get(localObject3); + localFileWriter.write(new StringBuilder().append("\"").append((String)localObject3).append("\" = ").append(str2).append("\r\n").toString()); + } + localVector2.clear(); + + localFileWriter.write("\n"); + + m = 1 + this.maxz - this.minz; + Object localObject3 = new SavingThread[m]; + int n = (this.maxy - this.miny) * ((this.maxx - this.minx) * i + 2) + 32; + + for (k = 0; k < m; k++) + { + localObject3[k] = new SavingThread(this.minz + k, this, n); + localObject3[k].start(); + } + + int i1 = 0; + String str3 = ""; + while (i1 == 0) { + try { + Thread.sleep(100L); } catch (Exception localException) { + } + i1 = 1; + + str3 = ""; + for (k = 0; k < m; k++) + { + if (!localObject3[k].done) + i1 = 0; + if (str3.length() != 0) str3 = new StringBuilder().append(str3).append(" ").toString(); + str3 = new StringBuilder().append(str3).append(localObject3[k].done ? "Done" : new StringBuilder().append(localObject3[k].progress).append("%").toString()).toString(); + } + MapPatcher.Systemoutprint(new StringBuilder().append(str3).append("\r").toString()); + } + + for (k = 0; k < m; k++) { + localFileWriter.write(localObject3[k].result.toString()); + } + localFileWriter.flush(); + localFileWriter.close(); + } + + public String getIdFor(String paramString) + { + if (this.codes_by_value.containsKey(paramString)) + { + return (String)this.codes_by_value.get(paramString); + } + return "???"; + } + + public String int2code(String[] paramArrayOfString, int paramInt1, int paramInt2) + { + String str = ""; + while (paramInt1 >= paramArrayOfString.length) + { + int i = paramInt1 % paramArrayOfString.length; + str = new StringBuilder().append(paramArrayOfString[i]).append(str).toString(); + paramInt1 -= i; + paramInt1 /= paramArrayOfString.length; + } + str = new StringBuilder().append(paramArrayOfString[paramInt1]).append(str).toString(); + while (str.length() < paramInt2) str = new StringBuilder().append(paramArrayOfString[0]).append(str).toString(); + return str; + } +} diff --git a/tools/mapmerge/Source/MapPatcher.java b/tools/mapmerge/Source/MapPatcher.java new file mode 100644 index 00000000000..c8d50b9b2fe --- /dev/null +++ b/tools/mapmerge/Source/MapPatcher.java @@ -0,0 +1,304 @@ +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.util.Arrays; + +public class MapPatcher +{ + static boolean silent = false; + + public static void main(String[] paramArrayOfString) + { + String str1 = "usage: [me] -diff [old_map] [new_map] [diff_file]"; + String str2 = "usage: [me] -patch [old_map] [diff_file] [new_map]"; + String str3 = "usage: [me] -pack [unpacked] [packed.dmm]"; + String str4 = "usage: [me] -unpack [packed.dmm] [unpacked]"; + String str5 = "usage: [me] -clean [oldmap.dmm] [newmap.dmm] [cleaned.dmm]"; + String str6 = "usage: [me] -merge [original] [local] [remote] [output]"; + + for (int i = 0; i < paramArrayOfString.length; i++) + if (paramArrayOfString[i].equalsIgnoreCase("-silent")) + { + silent = true; + for (; i < paramArrayOfString.length - 1; i++) + paramArrayOfString[i] = paramArrayOfString[(i + 1)]; + paramArrayOfString = (String[])Arrays.copyOf(paramArrayOfString, paramArrayOfString.length - 1); + break; + } + Object localObject; + int i2; + int i3; + int i5; + if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-merge"))) + { + if (paramArrayOfString.length < 5) + { + System.out.println(str6); + try { System.in.read(); } catch (Exception localException1) { + }return; + } + + Map localMap1 = new Map(new File(paramArrayOfString[1])); + localObject = new Map(new File(paramArrayOfString[2])); + Map localMap8 = new Map(new File(paramArrayOfString[3])); + Map localMap9 = new Map(); + + if ((localMap1.minx != ((Map)localObject).minx) || (localMap1.minx != localMap8.minx) || (localMap1.maxx != ((Map)localObject).maxx) || (localMap1.maxx != localMap8.maxx) || (localMap1.miny != ((Map)localObject).miny) || (localMap1.miny != localMap8.miny) || (localMap1.maxy != ((Map)localObject).maxy) || (localMap1.maxy != localMap8.maxy) || (localMap1.minz != ((Map)localObject).minz) || (localMap1.minz != localMap8.minz) || (localMap1.maxz != ((Map)localObject).maxz) || (localMap1.maxz != localMap8.maxz)) + { + Systemoutprintln("Map sizes differ"); + System.exit(1); + } + try + { + for (int n = localMap1.minz; n <= localMap1.maxz; n++) + for (i2 = localMap1.miny; i2 <= localMap1.maxy; i2++) + for (i3 = localMap1.minx; i3 <= localMap1.maxx; i3++) + { + boolean bool1 = localMap1.contentAt(i3, i2, n).equals(((Map)localObject).contentAt(i3, i2, n)); + boolean bool2 = localMap1.contentAt(i3, i2, n).equals(localMap8.contentAt(i3, i2, n)); + i5 = ((Map)localObject).contentAt(i3, i2, n).equals(localMap8.contentAt(i3, i2, n)); + if ((!bool1) && (!bool2)) + { + if (i5 == 0) + { + Systemoutprintln(i3 + "," + i2 + "," + n + " local and remote don't match original and differ"); + System.exit(1); + } + else { + localMap9.setAt(i3, i2, n, ((Map)localObject).contentAt(i3, i2, n)); + } + } else if (!bool1) + localMap9.setAt(i3, i2, n, ((Map)localObject).contentAt(i3, i2, n)); + else if (!bool2) + localMap9.setAt(i3, i2, n, localMap8.contentAt(i3, i2, n)); + else + localMap9.setAt(i3, i2, n, localMap1.contentAt(i3, i2, n)); + } + Systemoutprintln("Saving"); + localMap9.saveReferencing(new File(paramArrayOfString[4]), localMap1); + Systemoutprintln("Done"); + } + catch (Exception localException12) + { + localException12.printStackTrace(); + } + } + else + { + int m; + int i1; + if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-diff"))) + { + if (paramArrayOfString.length < 4) + { + System.out.println(str1); + try { System.in.read(); } catch (Exception localException2) { + }return; + } + + Map localMap2 = new Map(new File(paramArrayOfString[1])); + localObject = new Map(new File(paramArrayOfString[2])); + + int j = Math.max(localMap2.minx, ((Map)localObject).minx); + m = Math.min(localMap2.maxx, ((Map)localObject).maxx); + i1 = Math.max(localMap2.miny, ((Map)localObject).miny); + i2 = Math.min(localMap2.maxy, ((Map)localObject).maxy); + i3 = Math.max(localMap2.minz, ((Map)localObject).minz); + int i4 = Math.min(localMap2.maxz, ((Map)localObject).maxz); + Systemoutprintln("Comparing: x(" + j + "-" + m + ") y(" + i1 + "-" + i2 + ") z(" + i3 + "-" + i4 + ")"); + try + { + FileWriter localFileWriter2 = new FileWriter(paramArrayOfString[3]); + i5 = 0; + for (int i6 = i3; i6 <= i4; i6++) + { + Systemoutprintln("Z-level " + i6); + for (int i7 = i1; i7 <= i2; i7++) + for (int i8 = j; i8 <= m; i8++) + if (!localMap2.contentAt(i8, i7, i6).equals(((Map)localObject).contentAt(i8, i7, i6))) + { + localFileWriter2.write("(" + i8 + "," + (1 + ((Map)localObject).maxy - i7) + "," + i6 + ")=" + ((Map)localObject).contentAt(i8, i7, i6) + "\n"); + i5++; + } + } + localFileWriter2.flush(); + localFileWriter2.close(); + if (i5 == 0) + Systemoutprintln("Files do match"); + else + Systemoutprintln("Writed out " + i5 + " differences"); + } + catch (Exception localException13) + { + localException13.printStackTrace(); + } + + Systemoutprintln("Done"); + } + else + { + String str7; + String str8; + if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-patch"))) + { + if (paramArrayOfString.length < 4) + { + System.out.println(str2); + try { System.in.read(); } catch (Exception localException3) { + }return; + } + + Map localMap3 = new Map(new File(paramArrayOfString[1])); + try + { + localObject = new BufferedReader(new InputStreamReader(new FileInputStream(paramArrayOfString[2]))); + + while ((str7 = ((BufferedReader)localObject).readLine()) != null) + { + str7 = str7.trim(); + if (str7.length() != 0) + { + m = str7.indexOf(",", 1); + i1 = Integer.parseInt(str7.substring(1, m)); + str7 = str7.substring(m); + m = str7.indexOf(",", 1); + i2 = Integer.parseInt(str7.substring(1, m)); + str7 = str7.substring(m); + m = str7.indexOf(")", 1); + i3 = Integer.parseInt(str7.substring(1, m)); + str8 = str7.substring(str7.indexOf("=") + 1); + localMap3.setAt(i1, 1 + localMap3.maxy - i2, i3, str8); + } + } + localMap3.save(new File(paramArrayOfString[3])); + } + catch (Exception localException8) + { + localException8.printStackTrace(); + } + + Systemoutprintln("Done"); + } + else if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-pack"))) + { + if (paramArrayOfString.length < 3) + { + System.out.println(str3); + try { System.in.read(); } catch (Exception localException4) { + }return; + } + + Map localMap4 = new Map(); + try { + BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(paramArrayOfString[1]))); + Systemoutprintln("Loading"); + + while ((str7 = localBufferedReader.readLine()) != null) + { + str7 = str7.trim(); + if (str7.length() != 0) + { + m = str7.indexOf(",", 1); + i1 = Integer.parseInt(str7.substring(1, m)); + str7 = str7.substring(m); + m = str7.indexOf(",", 1); + i2 = Integer.parseInt(str7.substring(1, m)); + str7 = str7.substring(m); + m = str7.indexOf(")", 1); + i3 = Integer.parseInt(str7.substring(1, m)); + str8 = str7.substring(str7.indexOf("=") + 1); + localMap4.setAt(i1, i2, i3, str8); + } + } + Systemoutprintln("Flipping"); + localMap4.mirrorY(); + Systemoutprintln("Saving, bounds: x{" + localMap4.minx + " - " + localMap4.maxx + "}, y{" + localMap4.miny + " - " + localMap4.maxy + "}, z{" + localMap4.minz + " - " + localMap4.maxz + "}"); + localMap4.save(new File(paramArrayOfString[2])); + Systemoutprintln("Done"); + } + catch (Exception localException9) + { + localException9.printStackTrace(); + } + } + else if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-unpack"))) + { + if (paramArrayOfString.length < 3) + { + System.out.println(str4); + try { System.in.read(); } catch (Exception localException5) { + }return; + } + + Systemoutprintln("Loading"); + Map localMap5 = new Map(new File(paramArrayOfString[1])); + try { + FileWriter localFileWriter1 = new FileWriter(paramArrayOfString[2]); + Systemoutprintln("Saving"); + for (int k = localMap5.minz; k <= localMap5.maxz; k++) + { + Systemoutprintln("Z-level " + k); + for (m = localMap5.miny; m <= localMap5.maxy; m++) + for (i1 = localMap5.minx; i1 <= localMap5.maxx; i1++) + localFileWriter1.write("(" + i1 + "," + (1 + localMap5.maxy - m) + "," + k + ")=" + localMap5.contentAt(i1, m, k) + "\n"); + localFileWriter1.write("\n"); + } + localFileWriter1.flush(); + localFileWriter1.close(); + + Systemoutprintln("Done"); + } + catch (Exception localException10) + { + localException10.printStackTrace(); + } + } + else if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-clean"))) + { + if (paramArrayOfString.length < 4) + { + System.out.println(str5); + try { System.in.read(); } catch (Exception localException6) { + }return; + } + + Map localMap6 = new Map(new File(paramArrayOfString[1]), true); + Map localMap7 = new Map(new File(paramArrayOfString[2])); + try + { + localMap7.saveReferencing(new File(paramArrayOfString[3]), localMap6); + Systemoutprintln("Done"); + } + catch (Exception localException11) + { + localException11.printStackTrace(); + } + } + else + { + System.out.println(str1); + System.out.println(str2); + System.out.println(str3); + System.out.println(str4); + System.out.println(str5); + System.out.println(str6); + try { + System.in.read(); } catch (Exception localException7) { } + } + } + } + } + + public static void Systemoutprintln(String paramString) { if (!silent) + System.out.println(paramString); } + + public static void Systemoutprint(String paramString) + { + if (!silent) + System.out.print(paramString); + } +} diff --git a/tools/mapmerge/Source/SavingThread.java b/tools/mapmerge/Source/SavingThread.java new file mode 100644 index 00000000000..24a3d7b04df --- /dev/null +++ b/tools/mapmerge/Source/SavingThread.java @@ -0,0 +1,37 @@ +class SavingThread extends Thread +{ + int z; + Map mymap; + boolean done; + int progress; + StringBuilder result; + + public SavingThread(int paramInt1, Map paramMap, int paramInt2) + { + this.z = paramInt1; + this.mymap = paramMap; + this.progress = 0; + this.done = false; + this.result = new StringBuilder(paramInt2); + } + + public void run() + { + this.result.append("(" + this.mymap.minx + "," + this.mymap.miny + "," + this.z + ") = {\"\r\n"); + + int i = (this.mymap.maxx - this.mymap.minx) * (this.mymap.maxy - this.mymap.miny) / 100; + int j = 0; + for (int k = this.mymap.miny; k <= this.mymap.maxy; k++) + { + for (int m = this.mymap.minx; m <= this.mymap.maxx; m++) + { + this.result.append(this.mymap.getIdFor(this.mymap.contentAt(m, k, this.z))); + j++; if (j >= i) { j = 0; this.progress += 1; } + } + this.result.append("\r\n"); + } + this.result.append("\"}\r\n"); + this.result.append("\r\n"); + this.done = true; + } +} diff --git a/tools/mapmerge/clean_map.bat b/tools/mapmerge/clean_map.bat new file mode 100644 index 00000000000..8e1c9273d53 --- /dev/null +++ b/tools/mapmerge/clean_map.bat @@ -0,0 +1,7 @@ +@echo off +cd ../../_maps/map_files/ +set /P MAPFILE=Please enter mapfile (relative to map_files folder): + +java -jar ../../tools/mapmerge/MapPatcher.jar -clean "%MAPFILE%.backup" "%MAPFILE%" "%MAPFILE%" + +pause \ No newline at end of file diff --git a/tools/mapmerge/clean_map_git.sh b/tools/mapmerge/clean_map_git.sh deleted file mode 100644 index 59ef079a5a1..00000000000 --- a/tools/mapmerge/clean_map_git.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -MAPFILE='cyberiad.dmm' - -git show HEAD:maps/$MAPFILE > tmp.dmm -java -jar MapPatcher.jar -clean tmp.dmm '../../maps/'$MAPFILE '../../maps/'$MAPFILE -rm tmp.dmm diff --git a/tools/mapmerge/install.txt b/tools/mapmerge/install.txt index d6f9a946ec9..6aeeecb98fb 100644 --- a/tools/mapmerge/install.txt +++ b/tools/mapmerge/install.txt @@ -8,7 +8,9 @@ Committing This will make sure in the new version of your map, no paths are needlessly changed, thus instead of 8000 lines changed you'll get 50 lines changed. This not only reduces size of your commit, it also makes it possible to get an overview of your map changes on the "files changed" page in your pull request. Merging -The easiest way to do merging is to install the merge driver. For this, open `Baystation12/.git/config` in a text editor, and paste the following lines to the end of it: +The easiest way to do merging is to install the merge driver. For this, you can just double-click "install_driver.bat" in the tools/mapmerge/ directory. + +Alternatively, open ParadiseSS13/.git/config in a text editor, and paste the following lines to the end of it: [merge "merge-dmm"] name = mapmerge driver diff --git a/tools/mapmerge/install_driver.bat b/tools/mapmerge/install_driver.bat new file mode 100644 index 00000000000..fa04dddff55 --- /dev/null +++ b/tools/mapmerge/install_driver.bat @@ -0,0 +1,7 @@ +@echo off +echo. >> ../../.git/config +echo [merge "merge-dmm"] >> ../../.git/config +echo name = mapmerge driver >> ../../.git/config +echo driver = ./tools/mapmerge/mapmerge.sh %O %A %B >> ../../.git/config +echo. >> ../../.git/config + diff --git a/tools/mapmerge/prepare_map.bat b/tools/mapmerge/prepare_map.bat new file mode 100644 index 00000000000..bfe1e6560e9 --- /dev/null +++ b/tools/mapmerge/prepare_map.bat @@ -0,0 +1,12 @@ +@echo off +cd ../../_maps/map_files/ + +for /R %%f in (*.dmm) do copy %%f "%%f.backup" + +cls +echo All dmm files in map_files directories have been backed up +echo Now you can make your changes... +echo --- +echo Remember to run clean_map.bat just before you commit your changes! +echo --- +pause