Make editor scripts work with current Gridarta.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@9750 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
622309a923
commit
c049e3eaea
|
@ -11,8 +11,6 @@ import net.sf.gridarta.map.MapSquare;
|
||||||
|
|
||||||
int countMapFiles = 0;
|
int countMapFiles = 0;
|
||||||
int countSpellObjects = 0;
|
int countSpellObjects = 0;
|
||||||
ArchetypeSet archetypeSet = mainControl.getArchetypeSet();
|
|
||||||
ArchetypeParser archetypeParser = mainControl.getArchetypeParser();
|
|
||||||
|
|
||||||
String[] spellMapping = {
|
String[] spellMapping = {
|
||||||
"spell_magic_bullet", /* 0 */
|
"spell_magic_bullet", /* 0 */
|
||||||
|
@ -255,7 +253,7 @@ void convertGameObject(GameObject gameObject) {
|
||||||
print("invalid spell number " + spellId + " in object " + gameObject.getBestName() + " at " + gameObject.getMapX() + "/" + gameObject.getMapY());
|
print("invalid spell number " + spellId + " in object " + gameObject.getBestName() + " at " + gameObject.getMapX() + "/" + gameObject.getMapY());
|
||||||
} else {
|
} else {
|
||||||
GameObject spell = archetypeSet.getOrCreateArchetype(spellMapping[spellId]).createArch();
|
GameObject spell = archetypeSet.getOrCreateArchetype(spellMapping[spellId]).createArch();
|
||||||
archetypeParser.postParseGameObject(spell, 0);
|
spell.postParseGameObject(0);
|
||||||
gameObject.addLast(spell);
|
gameObject.addLast(spell);
|
||||||
countSpellObjects++;
|
countSpellObjects++;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +272,7 @@ void convertGameObject(GameObject gameObject) {
|
||||||
void convertMap(File mapFile, String mapPath) {
|
void convertMap(File mapFile, String mapPath) {
|
||||||
print(mapPath);
|
print(mapPath);
|
||||||
|
|
||||||
mapControl = mainControl.getMapManager().openMapFile(mapFile, false);
|
mapControl = mapManager.openMapFile(mapFile, false);
|
||||||
if (mapControl == null) {
|
if (mapControl == null) {
|
||||||
print("Cannot load map file");
|
print("Cannot load map file");
|
||||||
return;
|
return;
|
||||||
|
@ -309,7 +307,7 @@ if (baseDirectory.endsWith("/")) {
|
||||||
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
|
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
String mapDefaultFolder = mainControl.getGlobalSettings().getMapDefaultFolder();
|
String mapDefaultFolder = globalSettings.getMapDefaultFolder();
|
||||||
String rootDirectory = mapDefaultFolder + baseDirectory;
|
String rootDirectory = mapDefaultFolder + baseDirectory;
|
||||||
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
|
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.sf.gridarta.map.ShrinkMapSizeUtils;
|
||||||
void normalizeMap(File mapFile, String mapPath) {
|
void normalizeMap(File mapFile, String mapPath) {
|
||||||
print(mapPath);
|
print(mapPath);
|
||||||
|
|
||||||
map = mainControl.getMapManager().openMapFile(mapFile, false);
|
map = mapManager.openMapFile(mapFile, false);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
print("Cannot load map file");
|
print("Cannot load map file");
|
||||||
return;
|
return;
|
||||||
|
@ -41,7 +41,7 @@ if (baseDirectory.endsWith("/")) {
|
||||||
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
|
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
String mapDefaultFolder = mainControl.getGlobalSettings().getMapDefaultFolder();
|
String mapDefaultFolder = globalSettings.getMapDefaultFolder();
|
||||||
String rootDirectory = mapDefaultFolder + baseDirectory;
|
String rootDirectory = mapDefaultFolder + baseDirectory;
|
||||||
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
|
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ void log(String message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkMap(File mapFile, String mapPath) {
|
void checkMap(File mapFile, String mapPath) {
|
||||||
map = mainControl.getMapManager().openMapFile(mapFile, false);
|
map = mapManager.openMapFile(mapFile, false);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
log(mapPath + ":");
|
log(mapPath + ":");
|
||||||
log("- cannot load map file");
|
log("- cannot load map file");
|
||||||
|
@ -27,11 +27,11 @@ void checkMap(File mapFile, String mapPath) {
|
||||||
}
|
}
|
||||||
ErrorCollector errorCollector;
|
ErrorCollector errorCollector;
|
||||||
try {
|
try {
|
||||||
mainControl.validateMap(map.getMapModel());
|
validators.validateAll(map.getMapModel());
|
||||||
} finally {
|
} finally {
|
||||||
errorCollector = map.getMapModel().getErrors();
|
errorCollector = map.getMapModel().getErrors();
|
||||||
if (map.nViews() <= 0) {
|
if (map.nViews() <= 0) {
|
||||||
mainControl.getMapManager().closeLevel(map);
|
mapManager.closeLevel(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ try {
|
||||||
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
|
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
String mapDefaultFolder = mainControl.getGlobalSettings().getMapDefaultFolder();
|
String mapDefaultFolder = globalSettings.getMapDefaultFolder();
|
||||||
String rootDirectory = mapDefaultFolder + baseDirectory;
|
String rootDirectory = mapDefaultFolder + baseDirectory;
|
||||||
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
|
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ boolean updateMap(File mapFile, File pictureFile) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
print("converting " + mapFile + " to " + pictureFile + ".");
|
print("converting " + mapFile + " to " + pictureFile + ".");
|
||||||
map = mainControl.getMapManager().openMapFile(mapFile, false);
|
map = mapManager.openMapFile(mapFile, false);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ boolean updateMap(File mapFile, File pictureFile) {
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (map.nViews() <= 0) {
|
if (map.nViews() <= 0) {
|
||||||
mainControl.getMapManager().closeLevel(map);
|
mapManager.closeLevel(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -74,7 +74,7 @@ void checkDaList() {
|
||||||
DestHeight = TileHeight.intValue() * NumY.intValue();
|
DestHeight = TileHeight.intValue() * NumY.intValue();
|
||||||
|
|
||||||
if (Location == null || Location.length() < 1) {
|
if (Location == null || Location.length() < 1) {
|
||||||
Location = mainControl.getGlobalSettings().getMapDefaultFolder();
|
Location = globalSettings.getMapDefaultFolder();
|
||||||
print("autodetected location " + Location);
|
print("autodetected location " + Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue