From: <aki...@us...> - 2008-07-31 21:01:44
|
Revision: 4615 http://gridarta.svn.sourceforge.net/gridarta/?rev=4615&view=rev Author: akirschbaum Date: 2008-07-31 21:01:52 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove calls to CMainControlInstance.getInstance() and MainControl.getArchetypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 20:54:00 UTC (rev 4614) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:01:52 UTC (rev 4615) @@ -27,6 +27,7 @@ import cfeditor.gameobject.anim.AnimationObject; import cfeditor.gameobject.face.FaceObjects; import cfeditor.gameobject.scripts.ScriptArchUtils; +import cfeditor.gameobject.scripts.ScriptedEvent; import cfeditor.gui.GameObjectAttributesPanel; import cfeditor.gui.map.CMapViewBasic; import cfeditor.gui.prefs.GUIPrefs; @@ -228,6 +229,7 @@ animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, getEditTypes(), animationObjects, faceObjects, globalSettings.getImageSet()); GameObject.setArchetypeSet(archetypeSet); + ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java 2008-07-31 20:54:00 UTC (rev 4614) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java 2008-07-31 21:01:52 UTC (rev 4615) @@ -19,15 +19,17 @@ package cfeditor.gameobject.scripts; -import cfeditor.CMainControlInstance; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.map.MapArchObject; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeNameException; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeTypeException; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Class which stores information about one scripted event. @@ -38,6 +40,9 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(ScriptedEvent.class); + @Nullable + private static ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; + /** The underlying game object that represents the event. */ private final GameObject event; @@ -63,6 +68,10 @@ setEventData(pluginName, scriptPath, options); } + public static void setArchetypeSet(@Nullable final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + ScriptedEvent.archetypeSet = archetypeSet; + } + /** * Validate this event object: Check if there is sufficient data. * @return true if this object is valid, otherwise false @@ -172,7 +181,10 @@ if (eventArchetypeName == null) { throw new UndefinedEventArchetypeTypeException(eventType); } - final Archetype eventArchetype = CMainControlInstance.getInstance().getArchetypeSet().getArchetype(eventArchetypeName); + if (archetypeSet == null) { + throw new UndefinedEventArchetypeNameException(eventArchetypeName); + } + final Archetype eventArchetype = archetypeSet.getArchetype(eventArchetypeName); if (eventArchetype == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 20:54:00 UTC (rev 4614) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:01:52 UTC (rev 4615) @@ -26,6 +26,7 @@ import daieditor.gameobject.anim.AnimationObject; import daieditor.gameobject.face.FaceObjects; import daieditor.gameobject.scripts.ScriptArchUtils; +import daieditor.gameobject.scripts.ScriptedEvent; import daieditor.gui.GameObjectAttributesPanel; import daieditor.gui.map.CMapViewBasic; import daieditor.gui.prefs.AppPrefs; @@ -284,6 +285,7 @@ GameObject.setAnimationObjects(animationObjects); archetypeSet = new ArchetypeSet(this, getEditTypes(), animationObjects, faceObjects); GameObject.setArchetypeSet(archetypeSet); + ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java 2008-07-31 20:54:00 UTC (rev 4614) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java 2008-07-31 21:01:52 UTC (rev 4615) @@ -19,14 +19,16 @@ package daieditor.gameobject.scripts; -import daieditor.CMainControlInstance; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.map.MapArchObject; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeNameException; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeTypeException; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * Class which stores information about one scripted event. @@ -37,6 +39,9 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(ScriptedEvent.class); + @Nullable + private static ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; + /** The underlying game object that represents the event. */ private final GameObject event; @@ -62,6 +67,10 @@ setEventData(pluginName, scriptPath, options); } + public static void setArchetypeSet(@Nullable final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + ScriptedEvent.archetypeSet = archetypeSet; + } + /** * Validate this event object: Check if there is sufficient data. * @return true if this object is valid, otherwise false @@ -168,7 +177,10 @@ if (eventArchetypeName == null) { throw new UndefinedEventArchetypeTypeException(eventType); } - final Archetype eventArchetype = CMainControlInstance.getInstance().getArchetypeSet().getArchetype(eventArchetypeName); + if (archetypeSet == null) { + throw new UndefinedEventArchetypeNameException(eventArchetypeName); + } + final Archetype eventArchetype = archetypeSet.getArchetype(eventArchetypeName); if (eventArchetype == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |