mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Update mapmerge to -tg-'s latest
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
cd ../../_maps/
|
||||
|
||||
for /R %%f in (*.dmm) do copy "%%f" "%%f.backup"
|
||||
|
||||
cls
|
||||
echo All dmm files in _maps directories have been backed up
|
||||
echo Now you can make your changes...
|
||||
echo ---
|
||||
echo Remember to run Run_Map_Merge.bat just before you commit your changes!
|
||||
echo ---
|
||||
pause
|
||||
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
call java -jar MapMerge.jar "../../_maps/" /wait
|
||||
|
||||
pause
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="lib" path="src/MapPatcher.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>MapMerger</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -0,0 +1,60 @@
|
||||
cleanup.add_default_serial_version_id=false
|
||||
cleanup.add_generated_serial_version_id=true
|
||||
cleanup.add_missing_annotations=true
|
||||
cleanup.add_missing_deprecated_annotations=true
|
||||
cleanup.add_missing_methods=false
|
||||
cleanup.add_missing_nls_tags=false
|
||||
cleanup.add_missing_override_annotations=true
|
||||
cleanup.add_missing_override_annotations_interface_methods=true
|
||||
cleanup.add_serial_version_id=false
|
||||
cleanup.always_use_blocks=true
|
||||
cleanup.always_use_parentheses_in_expressions=true
|
||||
cleanup.always_use_this_for_non_static_field_access=false
|
||||
cleanup.always_use_this_for_non_static_method_access=false
|
||||
cleanup.convert_functional_interfaces=false
|
||||
cleanup.convert_to_enhanced_for_loop=false
|
||||
cleanup.correct_indentation=true
|
||||
cleanup.format_source_code=true
|
||||
cleanup.format_source_code_changes_only=false
|
||||
cleanup.insert_inferred_type_arguments=false
|
||||
cleanup.make_local_variable_final=true
|
||||
cleanup.make_parameters_final=false
|
||||
cleanup.make_private_fields_final=true
|
||||
cleanup.make_type_abstract_if_missing_method=false
|
||||
cleanup.make_variable_declarations_final=false
|
||||
cleanup.never_use_blocks=false
|
||||
cleanup.never_use_parentheses_in_expressions=false
|
||||
cleanup.organize_imports=true
|
||||
cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
cleanup.qualify_static_member_accesses_with_declaring_class=true
|
||||
cleanup.qualify_static_method_accesses_with_declaring_class=true
|
||||
cleanup.remove_private_constructors=true
|
||||
cleanup.remove_redundant_type_arguments=true
|
||||
cleanup.remove_trailing_whitespaces=false
|
||||
cleanup.remove_trailing_whitespaces_all=true
|
||||
cleanup.remove_trailing_whitespaces_ignore_empty=false
|
||||
cleanup.remove_unnecessary_casts=true
|
||||
cleanup.remove_unnecessary_nls_tags=true
|
||||
cleanup.remove_unused_imports=true
|
||||
cleanup.remove_unused_local_variables=true
|
||||
cleanup.remove_unused_private_fields=true
|
||||
cleanup.remove_unused_private_members=true
|
||||
cleanup.remove_unused_private_methods=true
|
||||
cleanup.remove_unused_private_types=true
|
||||
cleanup.sort_members=false
|
||||
cleanup.sort_members_all=false
|
||||
cleanup.use_anonymous_class_creation=false
|
||||
cleanup.use_blocks=true
|
||||
cleanup.use_blocks_only_for_return_and_throw=false
|
||||
cleanup.use_lambda=true
|
||||
cleanup.use_parentheses_in_expressions=true
|
||||
cleanup.use_this_for_non_static_field_access=true
|
||||
cleanup.use_this_for_non_static_field_access_only_if_necessary=true
|
||||
cleanup.use_this_for_non_static_method_access=true
|
||||
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
cleanup.use_type_arguments=false
|
||||
cleanup_profile=_Default
|
||||
cleanup_settings_version=2
|
||||
eclipse.preferences.version=1
|
||||
@@ -1,4 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Created-By: 1.6.0_31 (Sun Microsystems Inc.)
|
||||
Main-Class: MapPatcher
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.PathMatcher;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FileFinder extends SimpleFileVisitor<Path> {
|
||||
private PathMatcher matcher;
|
||||
public ArrayList<Path> foundPaths = new ArrayList<>();
|
||||
public FileFinder(String pattern) {
|
||||
matcher = FileSystems.getDefault().getPathMatcher("glob:" + pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
Path name = file.getFileName();
|
||||
if (matcher.matches(name)) {
|
||||
foundPaths.add(file);
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class MapMerge {
|
||||
|
||||
private static Scanner input = new Scanner(System.in);
|
||||
private static Path pathToMaps;
|
||||
|
||||
public static void main(String[] mapPath) throws IOException {
|
||||
pathToMaps = Paths.get(mapPath[0]);
|
||||
FileFinder dmmFinder = new FileFinder("*.dmm");
|
||||
Files.walkFileTree(pathToMaps, dmmFinder);
|
||||
ArrayList<Path> foundFiles = dmmFinder.foundPaths;
|
||||
if (foundFiles.size() > 0) {
|
||||
try {
|
||||
MapMerge.merge(foundFiles);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Something went wrong.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("No files were found in provided directory!");
|
||||
System.out.print("Path to maps folder: ");
|
||||
pathToMaps = Paths.get(input.nextLine());
|
||||
dmmFinder = new FileFinder("*.dmm");
|
||||
Files.walkFileTree(pathToMaps, dmmFinder);
|
||||
foundFiles = dmmFinder.foundPaths;
|
||||
try {
|
||||
MapMerge.merge(foundFiles);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Something went wrong.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void merge(ArrayList<Path> foundFiles) throws IOException {
|
||||
|
||||
System.out.println("How many files do you want to merge?");
|
||||
int selection1;
|
||||
inputCheck: while (true) {
|
||||
while (!input.hasNextInt()) {
|
||||
String temp = input.next();
|
||||
System.out.println(temp + " is not a valid int.");
|
||||
}
|
||||
selection1 = input.nextInt();
|
||||
if (selection1 < 0) {
|
||||
System.out.println("Use a number greater than 0!");
|
||||
continue inputCheck;
|
||||
} else {
|
||||
break inputCheck;
|
||||
}
|
||||
}
|
||||
|
||||
for (int numOfFiles = selection1; numOfFiles != 0; numOfFiles--) {
|
||||
|
||||
for (int num = 0; num < foundFiles.size(); num++) {
|
||||
System.out.println(num + ": " + foundFiles.get(num));
|
||||
}
|
||||
|
||||
System.out.print("File to use: ");
|
||||
int selection2;
|
||||
inputCheck: while (true) {
|
||||
while (!input.hasNextInt()) {
|
||||
String temp = input.next();
|
||||
System.out.println(temp + " is not a valid int.");
|
||||
}
|
||||
selection2 = input.nextInt();
|
||||
if ((selection2 < 0) || (selection2 >= foundFiles.size())) {
|
||||
if (selection2 < 0) {
|
||||
System.out.println("Use a number greater than 0!");
|
||||
} else {
|
||||
System.out.println("Use a number less than " + foundFiles.size() + "!");
|
||||
}
|
||||
continue inputCheck;
|
||||
} else {
|
||||
break inputCheck;
|
||||
}
|
||||
}
|
||||
|
||||
String selected_map = foundFiles.get(selection2) + "";
|
||||
String backup_map = selected_map + ".backup";
|
||||
String edited_map = selected_map;
|
||||
String to_save = selected_map;
|
||||
String[] passInto = { "-clean", backup_map, edited_map, to_save };
|
||||
MapPatcher.main(passInto);
|
||||
|
||||
// Will try to fix when I have time ~CorruptComputer
|
||||
/*try{
|
||||
Process process = new ProcessBuilder("dmm2tgm\\dmm2tgm.exe", selected_map).start();
|
||||
}catch(Exception e1){
|
||||
System.out.println("You are not on a windows machine, trying the .py");
|
||||
try{
|
||||
Process process = new ProcessBuilder("dmm2tgm\\Source\\dmm2tgm.py", selected_map).start();
|
||||
}catch(Exception e2){
|
||||
System.out.println("You do not have python 2.7.x installed.");
|
||||
System.out.println("Downloads can be found here: https://www.python.org/downloads/");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
@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
|
||||
@@ -1,19 +0,0 @@
|
||||
1. Install java(http://www.java.com/en/download/index.jsp)
|
||||
2. Make sure java is in your PATH. To test this, open git bash, and type "java". If it says unknown command, you need to add JAVA/bin to your PATH variable (A guide for this can be found at https://www.java.com/en/download/help/path.xml ).
|
||||
|
||||
Committing
|
||||
1. Before starting to edit the map, double-click "prepare_map.bat" in the tools/mapmerge/ directory.
|
||||
2. After finishing your edit, and before your commit, double-click "clean_map.bat" in the tools/mapmerge/ directory.
|
||||
|
||||
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, 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
|
||||
driver = ./tools/mapmerge/mapmerge.sh %O %A %B
|
||||
|
||||
After this, merging maps should happen automagically unless there are conflicts(a tile that both you and someone else changed). If there are conflicts, you will unfortunately still be stuck with opening both versions in a map editor, and manually resolving the issues.
|
||||
@@ -1,7 +0,0 @@
|
||||
@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
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
java -jar tools/mapmerge/MapPatcher.jar -merge $1 $2 $3 $2
|
||||
if [ "$?" -gt 0 ]
|
||||
then
|
||||
echo "Unable to automatically resolve map conflicts, please merge manually."
|
||||
exit 1
|
||||
fi
|
||||
java -jar tools/mapmerge/MapPatcher.jar -clean $1 $2 $2
|
||||
|
||||
exit 0
|
||||
@@ -1,12 +0,0 @@
|
||||
@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
|
||||
Reference in New Issue
Block a user