From: <aki...@us...> - 2008-08-21 22:14:44
|
Revision: 4972 http://gridarta.svn.sourceforge.net/gridarta/?rev=4972&view=rev Author: akirschbaum Date: 2008-08-21 22:14:53 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 22:11:50 UTC (rev 4971) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 22:14:53 UTC (rev 4972) @@ -62,7 +62,6 @@ import net.sf.gridarta.archtype.ArchetypeTypeSetParser; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.LeftPanel; import net.sf.gridarta.gui.MainView; @@ -155,24 +154,6 @@ public CMainControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { super(gridartaObjectsFactory, new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(gridartaObjectsFactory), false, CResourceLoader.getHomeFile("thumbnails"), null, "DaimoninEditor.jar", pythonFileFilter, ".py", Archetype.TYPE_SPELL, null); - try { - final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), "GameObjectMatchers.xml"); - gameObjectMatchers.readGameObjectMatchers(filename); - } catch (final FileNotFoundException ex) { - log.error("Cannot read GameObjectMatchers.xml: " + ex.getMessage()); - } - GameObjectMatchersInstance.setInstance(gameObjectMatchers); - final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("floor"); - final GameObjectMatcher wallMatcher = gameObjectMatchers.getMatcher("wall"); - final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcher("monster"); - if (monsterMatcher == null) { - log.fatal("GameObjectMatcher 'monster' does not exist"); - throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); - } - final GameObjectMatcher belowFloorMatcher = gameObjectMatchers.getMatcher("below_floor"); - if (belowFloorMatcher == null) { - log.warn("GameObjectMatcher 'below_floor' does not exist"); - } DeletionTool.init(floorMatcher, wallMatcher, monsterMatcher); InsertionMode.init(floorMatcher, wallMatcher, belowFloorMatcher); final GameObjectMatcher exitMatcher = gameObjectMatchers.getMatcher("exit"); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 22:11:50 UTC (rev 4971) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 22:14:53 UTC (rev 4972) @@ -67,7 +67,6 @@ import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; import net.sf.gridarta.gameobject.match.MutableOrGameObjectMatcher; import net.sf.gridarta.gameobject.match.ViewGameObjectMatcherManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; @@ -217,24 +216,6 @@ public CMainControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { super(gridartaObjectsFactory, new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(gridartaObjectsFactory), true, null, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), "CrossfireEditor.jar", luaFileFilter, ".lua", 0, IGUIConstants.SPELL_FILE); - try { - final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), "GameObjectMatchers.xml"); - gameObjectMatchers.readGameObjectMatchers(filename); - } catch (final FileNotFoundException ex) { - log.error("Cannot read GameObjectMatchers.xml: " + ex.getMessage()); - } - GameObjectMatchersInstance.setInstance(gameObjectMatchers); - final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("floor"); - final GameObjectMatcher wallMatcher = gameObjectMatchers.getMatcher("wall"); - final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcher("monster"); - if (monsterMatcher == null) { - log.fatal("GameObjectMatcher 'monster' does not exist"); - throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); - } - final GameObjectMatcher belowFloorMatcher = gameObjectMatchers.getMatcher("below_floor"); - if (belowFloorMatcher == null) { - log.warn("GameObjectMatcher 'below_floor' does not exist"); - } DeletionTool.init(floorMatcher, wallMatcher, monsterMatcher); InsertionMode.init(floorMatcher, wallMatcher, belowFloorMatcher); final GameObjectMatcher exitMatcher = gameObjectMatchers.getMatcher("exit"); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 22:11:50 UTC (rev 4971) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 22:14:53 UTC (rev 4972) @@ -20,6 +20,7 @@ package net.sf.gridarta; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -36,7 +37,9 @@ import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; +import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; import net.sf.gridarta.gameobject.scripts.ScriptedEvent; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.About; @@ -65,6 +68,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.help.Help; +import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; @@ -254,6 +258,18 @@ @NotNull protected final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); + @NotNull + protected final GameObjectMatcher floorMatcher; + + @NotNull + protected final GameObjectMatcher wallMatcher; + + @NotNull + protected final GameObjectMatcher monsterMatcher; + + @NotNull + protected final GameObjectMatcher belowFloorMatcher; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -336,6 +352,24 @@ XMLSpellLoader.load(getConfigurationDirectory(), spellFile, xmlHelper.getDocumentBuilder(), numberSpells); numberSpells.sort(); } + try { + final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), "GameObjectMatchers.xml"); + gameObjectMatchers.readGameObjectMatchers(filename); + } catch (final FileNotFoundException ex) { + log.error("Cannot read GameObjectMatchers.xml: " + ex.getMessage()); + } + GameObjectMatchersInstance.setInstance(gameObjectMatchers); + floorMatcher = gameObjectMatchers.getMatcher("floor"); + wallMatcher = gameObjectMatchers.getMatcher("wall"); + monsterMatcher = gameObjectMatchers.getMatcher("monster"); + if (monsterMatcher == null) { + log.fatal("GameObjectMatcher 'monster' does not exist"); + throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); + } + belowFloorMatcher = gameObjectMatchers.getMatcher("below_floor"); + if (belowFloorMatcher == null) { + log.warn("GameObjectMatcher 'below_floor' does not exist"); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |