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-b93c2d0d6712
master
akirschbaum 2008-08-17 19:08:31 +00:00
parent 622309a923
commit c049e3eaea
4 changed files with 12 additions and 14 deletions

View File

@ -11,8 +11,6 @@ import net.sf.gridarta.map.MapSquare;
int countMapFiles = 0;
int countSpellObjects = 0;
ArchetypeSet archetypeSet = mainControl.getArchetypeSet();
ArchetypeParser archetypeParser = mainControl.getArchetypeParser();
String[] spellMapping = {
"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());
} else {
GameObject spell = archetypeSet.getOrCreateArchetype(spellMapping[spellId]).createArch();
archetypeParser.postParseGameObject(spell, 0);
spell.postParseGameObject(0);
gameObject.addLast(spell);
countSpellObjects++;
}
@ -274,7 +272,7 @@ void convertGameObject(GameObject gameObject) {
void convertMap(File mapFile, String mapPath) {
print(mapPath);
mapControl = mainControl.getMapManager().openMapFile(mapFile, false);
mapControl = mapManager.openMapFile(mapFile, false);
if (mapControl == null) {
print("Cannot load map file");
return;
@ -309,7 +307,7 @@ if (baseDirectory.endsWith("/")) {
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
}
String mapDefaultFolder = mainControl.getGlobalSettings().getMapDefaultFolder();
String mapDefaultFolder = globalSettings.getMapDefaultFolder();
String rootDirectory = mapDefaultFolder + baseDirectory;
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
while (it.hasNext()) {

View File

@ -10,7 +10,7 @@ import net.sf.gridarta.map.ShrinkMapSizeUtils;
void normalizeMap(File mapFile, String mapPath) {
print(mapPath);
map = mainControl.getMapManager().openMapFile(mapFile, false);
map = mapManager.openMapFile(mapFile, false);
if (map == null) {
print("Cannot load map file");
return;
@ -41,7 +41,7 @@ if (baseDirectory.endsWith("/")) {
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
}
String mapDefaultFolder = mainControl.getGlobalSettings().getMapDefaultFolder();
String mapDefaultFolder = globalSettings.getMapDefaultFolder();
String rootDirectory = mapDefaultFolder + baseDirectory;
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
while (it.hasNext()) {

View File

@ -19,7 +19,7 @@ void log(String message) {
}
void checkMap(File mapFile, String mapPath) {
map = mainControl.getMapManager().openMapFile(mapFile, false);
map = mapManager.openMapFile(mapFile, false);
if (map == null) {
log(mapPath + ":");
log("- cannot load map file");
@ -27,11 +27,11 @@ void checkMap(File mapFile, String mapPath) {
}
ErrorCollector errorCollector;
try {
mainControl.validateMap(map.getMapModel());
validators.validateAll(map.getMapModel());
} finally {
errorCollector = map.getMapModel().getErrors();
if (map.nViews() <= 0) {
mainControl.getMapManager().closeLevel(map);
mapManager.closeLevel(map);
}
}
@ -85,7 +85,7 @@ try {
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
}
String mapDefaultFolder = mainControl.getGlobalSettings().getMapDefaultFolder();
String mapDefaultFolder = globalSettings.getMapDefaultFolder();
String rootDirectory = mapDefaultFolder + baseDirectory;
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
while (it.hasNext()) {

View File

@ -35,7 +35,7 @@ boolean updateMap(File mapFile, File pictureFile) {
return false;
}
print("converting " + mapFile + " to " + pictureFile + ".");
map = mainControl.getMapManager().openMapFile(mapFile, false);
map = mapManager.openMapFile(mapFile, false);
if (map == null) {
return false;
}
@ -48,7 +48,7 @@ boolean updateMap(File mapFile, File pictureFile) {
}
} finally {
if (map.nViews() <= 0) {
mainControl.getMapManager().closeLevel(map);
mapManager.closeLevel(map);
}
}
return true;
@ -74,7 +74,7 @@ void checkDaList() {
DestHeight = TileHeight.intValue() * NumY.intValue();
if (Location == null || Location.length() < 1) {
Location = mainControl.getGlobalSettings().getMapDefaultFolder();
Location = globalSettings.getMapDefaultFolder();
print("autodetected location " + Location);
}