diff --git a/editor/scripts/LegacySpellConverter b/editor/scripts/LegacySpellConverter index a0fde9725..7d5138621 100644 --- a/editor/scripts/LegacySpellConverter +++ b/editor/scripts/LegacySpellConverter @@ -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()) { diff --git a/editor/scripts/MapNormalizer b/editor/scripts/MapNormalizer index d2424ded3..c3ffe19fc 100644 --- a/editor/scripts/MapNormalizer +++ b/editor/scripts/MapNormalizer @@ -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()) { diff --git a/editor/scripts/MapValidator b/editor/scripts/MapValidator index 7e954b479..8d534a710 100644 --- a/editor/scripts/MapValidator +++ b/editor/scripts/MapValidator @@ -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()) { diff --git a/editor/scripts/WorldMaker b/editor/scripts/WorldMaker index bc72dbffc..fec9d1139 100644 --- a/editor/scripts/WorldMaker +++ b/editor/scripts/WorldMaker @@ -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); }