Adapt MapValidator plugin script to current Gridarta.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@13386 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
f16bb27dc8
commit
35e0178082
|
|
@ -5,10 +5,10 @@
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import net.sf.gridarta.gameobject.GameObject;
|
import net.sf.gridarta.model.gameobject.GameObject;
|
||||||
import net.sf.gridarta.io.RecursiveFileIterator;
|
import net.sf.gridarta.model.io.RecursiveFileIterator;
|
||||||
import net.sf.gridarta.map.validation.ErrorCollector;
|
import net.sf.gridarta.model.map.validation.ErrorCollector;
|
||||||
import net.sf.gridarta.map.validation.ValidationError;
|
import net.sf.gridarta.model.map.validation.errors.ValidationError;
|
||||||
|
|
||||||
void log(String message) {
|
void log(String message) {
|
||||||
print(message);
|
print(message);
|
||||||
|
|
@ -19,7 +19,12 @@ void log(String message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkMap(File mapFile, String mapPath) {
|
void checkMap(File mapFile, String mapPath) {
|
||||||
map = mapManager.openMapFile(mapFile, false);
|
try {
|
||||||
|
map = mapManager.openMapFile(mapFile, false);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
print("Cannot load map '"+mapFile+"': "+ex.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
log(mapPath + ":");
|
log(mapPath + ":");
|
||||||
log("- cannot load map file");
|
log("- cannot load map file");
|
||||||
|
|
@ -94,13 +99,23 @@ try {
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
File file = it.next();
|
File file = it.next();
|
||||||
String name = file.getName();
|
String name = file.getName();
|
||||||
|
String path = file.getPath();
|
||||||
if (file.isFile()
|
if (file.isFile()
|
||||||
&& file.getPath().startsWith(rootDirectory)
|
&& path.startsWith(rootDirectory)
|
||||||
&& !name.equalsIgnoreCase("README")
|
&& !name.equalsIgnoreCase("README")
|
||||||
&& !name.equalsIgnoreCase("README.txt")
|
|
||||||
&& !name.endsWith(".msg")
|
&& !name.endsWith(".msg")
|
||||||
&& !name.endsWith(".py")
|
&& !name.endsWith(".py")
|
||||||
&& !name.endsWith(".pyc")) {
|
&& !name.endsWith(".png")
|
||||||
|
&& !name.endsWith(".ppm")
|
||||||
|
&& !name.endsWith(".quests")
|
||||||
|
&& !name.endsWith(".animation")
|
||||||
|
&& !name.equals("pshop_copier")
|
||||||
|
&& !name.equals("pshops_changelog")
|
||||||
|
&& !name.equals(".emergency")
|
||||||
|
&& !name.equals("ChangeLog")
|
||||||
|
&& !name.equals("COPYING")
|
||||||
|
&& !path.contains("/Info/")
|
||||||
|
&& !path.contains("/editor/scripts/")) {
|
||||||
checkMap(file, file.getPath().substring(mapDefaultFolder.length()));
|
checkMap(file, file.getPath().substring(mapDefaultFolder.length()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue