You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2011-12-17 12:26:07
|
Revision: 9135 http://gridarta.svn.sourceforge.net/gridarta/?rev=9135&view=rev Author: akirschbaum Date: 2011-12-17 12:25:59 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Update comments. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/collectable/package.html Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java 2011-12-17 12:11:44 UTC (rev 9134) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java 2011-12-17 12:25:59 UTC (rev 9135) @@ -30,6 +30,12 @@ import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; +/** + * A {@link net.sf.gridarta.model.collectable.Collectable} that creates the + * Atrinik specific "archetypes" file. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ public class AtrinikArchetypeSetCollectable extends AbstractArchetypeSetCollectable<GameObject, MapArchObject, Archetype> { /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java 2011-12-17 12:11:44 UTC (rev 9134) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java 2011-12-17 12:25:59 UTC (rev 9135) @@ -30,6 +30,12 @@ import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; +/** + * A {@link net.sf.gridarta.model.collectable.Collectable} that creates the + * Crossfire specific "archetypes" file. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ public class CrossfireArchetypeSetCollectable extends AbstractArchetypeSetCollectable<GameObject, MapArchObject, Archetype> { /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java 2011-12-17 12:11:44 UTC (rev 9134) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java 2011-12-17 12:25:59 UTC (rev 9135) @@ -30,6 +30,12 @@ import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; +/** + * A {@link net.sf.gridarta.model.collectable.Collectable} that creates the + * Daimonin specific "archetypes" file. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ public class DaimoninArchetypeSetCollectable extends AbstractArchetypeSetCollectable<GameObject, MapArchObject, Archetype> { /** Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java 2011-12-17 12:11:44 UTC (rev 9134) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java 2011-12-17 12:25:59 UTC (rev 9135) @@ -39,10 +39,16 @@ import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; +/** + * Abstract base class for {@link Collectable Collectables} that create the + * "archetypes" file. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ public abstract class AbstractArchetypeSetCollectable<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Collectable { /** - * Action Builder. + * The {@link ActionBuilder} instance. */ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); @@ -78,7 +84,7 @@ } /** - * {@inheritDoc} Collects the Archetypes. + * {@inheritDoc} */ @Override public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java 2011-12-17 12:11:44 UTC (rev 9134) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java 2011-12-17 12:25:59 UTC (rev 9135) @@ -34,10 +34,16 @@ import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; +/** + * a {@link Collectable} that creates the "animations" file. It also creates the + * editor helper file "animtree". + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ public class AnimationObjectsCollectable implements Collectable { /** - * Action Builder. + * The {@link ActionBuilder} instance. */ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java 2011-12-17 12:11:44 UTC (rev 9134) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java 2011-12-17 12:25:59 UTC (rev 9135) @@ -27,14 +27,14 @@ /** * A Collectable has information that can be collected. This is used during the * "collection" process to gather information into files suitable for the - * server. + * game servers. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public interface Collectable { /** - * Collect information. - * @param progress Progress to report progress to. + * Collects information. + * @param progress the progress to report progress to * @param collectedDirectory the destination directory to collect data to * @throws IOException in case of I/O problems during collection */ Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java 2011-12-17 12:11:44 UTC (rev 9134) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java 2011-12-17 12:25:59 UTC (rev 9135) @@ -38,10 +38,17 @@ import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; +/** + * A {@link Collectable} that creates the atrinik.0/crossfire.0/daimonin.0 files + * which contains all defined faces. It also creates index or editor helper + * files such as bmaps or bmaps.paths. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ public class FaceObjectsCollectable implements Collectable { /** - * Action Builder. + * The {@link ActionBuilder} instance. */ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java 2011-12-17 12:11:44 UTC (rev 9134) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java 2011-12-17 12:25:59 UTC (rev 9135) @@ -31,6 +31,12 @@ import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; +/** + * A {@link Collectable} that creates the Crossfire specific smooth faces file. + * This file contains information needed for smoothing faces between adjacent + * map squares. + * @author Andreas Kirschbaum + */ public class SmoothFacesCollectable implements Collectable { /** Added: trunk/model/src/app/net/sf/gridarta/model/collectable/package.html =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/package.html (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/package.html 2011-12-17 12:25:59 UTC (rev 9135) @@ -0,0 +1,26 @@ +<!-- + ~ Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + ~ Copyright (C) 2000-2011 The Gridarta Developers. + ~ + ~ This program is free software; you can redistribute it and/or modify + ~ it under the terms of the GNU General Public License as published by + ~ the Free Software Foundation; either version 2 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU General Public License for more details. + ~ + ~ You should have received a copy of the GNU General Public License along + ~ with this program; if not, write to the Free Software Foundation, Inc., + ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + --> + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<body> +<p>Implements the collection process that combines individual files into + collected files which are read by the game servers at runtime.</p> +</body> +</html> Property changes on: trunk/model/src/app/net/sf/gridarta/model/collectable/package.html ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 12:11:52
|
Revision: 9134 http://gridarta.svn.sourceforge.net/gridarta/?rev=9134&view=rev Author: akirschbaum Date: 2011-12-17 12:11:44 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Remove dependency GlobalSettings -> ConfigSource. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/DefaultGlobalSettings.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/DefaultGlobalSettings.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/DefaultGlobalSettings.java trunk/model/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java trunk/model/src/app/net/sf/gridarta/model/settings/GlobalSettings.java trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java trunk/src/app/net/sf/gridarta/gui/dialog/prefs/ResPreferences.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -230,8 +230,8 @@ */ @NotNull @Override - public GlobalSettings newGlobalSettings(@NotNull final ConfigSourceFactory configSourceFactory) { - return new DefaultGlobalSettings(configSourceFactory); + public GlobalSettings newGlobalSettings() { + return new DefaultGlobalSettings(); } /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/DefaultGlobalSettings.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/DefaultGlobalSettings.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -20,7 +20,6 @@ package net.sf.gridarta.var.atrinik.model.settings; import java.io.File; -import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.var.atrinik.IGUIConstants; import org.jetbrains.annotations.NotNull; @@ -31,14 +30,6 @@ public class DefaultGlobalSettings extends net.sf.gridarta.model.settings.DefaultGlobalSettings { /** - * Creates a new instance. - * @param configSourceFactory the config source factory to use - */ - public DefaultGlobalSettings(@NotNull final ConfigSourceFactory configSourceFactory) { - super(configSourceFactory); - } - - /** * {@inheritDoc} */ @NotNull Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -201,8 +201,8 @@ */ @NotNull @Override - public GlobalSettings newGlobalSettings(@NotNull final ConfigSourceFactory configSourceFactory) { - return new DefaultGlobalSettings(configSourceFactory); + public GlobalSettings newGlobalSettings() { + return new DefaultGlobalSettings(); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/DefaultGlobalSettings.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/DefaultGlobalSettings.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -20,7 +20,6 @@ package net.sf.gridarta.var.crossfire.model.settings; import java.io.File; -import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.var.crossfire.IGUIConstants; import org.jetbrains.annotations.NotNull; @@ -31,14 +30,6 @@ public class DefaultGlobalSettings extends net.sf.gridarta.model.settings.DefaultGlobalSettings { /** - * Creates a new instance. - * @param configSourceFactory the config source factory to use - */ - public DefaultGlobalSettings(@NotNull final ConfigSourceFactory configSourceFactory) { - super(configSourceFactory); - } - - /** * {@inheritDoc} */ @NotNull Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -230,8 +230,8 @@ */ @NotNull @Override - public GlobalSettings newGlobalSettings(@NotNull final ConfigSourceFactory configSourceFactory) { - return new DefaultGlobalSettings(configSourceFactory); + public GlobalSettings newGlobalSettings() { + return new DefaultGlobalSettings(); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/DefaultGlobalSettings.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/DefaultGlobalSettings.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -20,7 +20,6 @@ package net.sf.gridarta.var.daimonin.model.settings; import java.io.File; -import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.var.daimonin.IGUIConstants; import org.jetbrains.annotations.NotNull; @@ -31,14 +30,6 @@ public class DefaultGlobalSettings extends net.sf.gridarta.model.settings.DefaultGlobalSettings { /** - * Creates a new instance. - * @param configSourceFactory the configuration source factory to use - */ - public DefaultGlobalSettings(@NotNull final ConfigSourceFactory configSourceFactory) { - super(configSourceFactory); - } - - /** * {@inheritDoc} */ @NotNull Modified: trunk/model/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/model/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -24,8 +24,6 @@ import java.util.prefs.PreferenceChangeListener; import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; -import net.sf.gridarta.model.configsource.ConfigSource; -import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -172,7 +170,7 @@ * Do we load arches from the collected archives. */ @NotNull - private ConfigSource configSource; + private String configSourceName; /** * Time for an automated documentation popup. @@ -187,9 +185,8 @@ /** * Creates a new instance. - * @param configSourceFactory the configuration source factory to use */ - protected DefaultGlobalSettings(@NotNull final ConfigSourceFactory configSourceFactory) { + protected DefaultGlobalSettings() { archDirectoryDefault = ActionBuilderUtils.getString(ACTION_BUILDER, "archDirectoryDefault", ""); mapsDirectoryDefault = ActionBuilderUtils.getString(ACTION_BUILDER, "mapsDirectoryDefault", ""); hasMediaDefaultDirectory = ActionBuilderUtils.getBoolean(ACTION_BUILDER, "mediaDirectory"); @@ -213,7 +210,7 @@ } else if (evt.getKey().equals(IMAGE_SET_KEY)) { imageSet = preferences.get(IMAGE_SET_KEY, imageSetDefault); } else if (evt.getKey().equals(CONFIG_SOURCE_KEY)) { - configSource = configSourceFactory.getConfigSource(preferences.get(CONFIG_SOURCE_KEY, "")); + configSourceName = preferences.get(CONFIG_SOURCE_KEY, ""); } } @@ -225,7 +222,7 @@ mediaDirectory = new File(preferences.get(MEDIA_DIRECTORY_KEY, mediaDirectoryDefault)); imageSet = preferences.get(IMAGE_SET_KEY, imageSetDefault); imageDirectory = mapsDirectory; - configSource = configSourceFactory.getConfigSource(preferences.get(CONFIG_SOURCE_KEY, "")); + configSourceName = preferences.get(CONFIG_SOURCE_KEY, ""); final int documentationVersion = ActionBuilderUtils.getInt(ACTION_BUILDER, "docuVersion", 0); if (documentationVersion > 0 && preferences.getInt(DOCUMENTATION_VERSION_KEY, 0) < documentationVersion) { // remember to open documentation @@ -417,21 +414,21 @@ */ @NotNull @Override - public ConfigSource getConfigSource() { - return configSource; + public String getConfigSourceName() { + return configSourceName; } /** * {@inheritDoc} */ @Override - public void setConfigSource(@NotNull final ConfigSource configSource) { - if (this.configSource == configSource) { + public void setConfigSourceName(@NotNull final String configSourceName) { + if (this.configSourceName.equals(configSourceName)) { return; } - this.configSource = configSource; - preferences.put(CONFIG_SOURCE_KEY, configSource.getName()); + this.configSourceName = configSourceName; + preferences.put(CONFIG_SOURCE_KEY, configSourceName); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/settings/GlobalSettings.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/settings/GlobalSettings.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/model/src/app/net/sf/gridarta/model/settings/GlobalSettings.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.settings; import java.io.File; -import net.sf.gridarta.model.configsource.ConfigSource; import org.jetbrains.annotations.NotNull; /** @@ -88,17 +87,17 @@ File getImageDirectory(); /** - * Returns the configuration source. - * @return the configuration source + * Returns the name of the configuration source. + * @return the name of the configuration source */ @NotNull - ConfigSource getConfigSource(); + String getConfigSourceName(); /** - * Sets the configuration source. - * @param configSource the configuration source + * Sets the name of the configuration source. + * @param configSourceName the name */ - void setConfigSource(@NotNull ConfigSource configSource); + void setConfigSourceName(@NotNull String configSourceName); /** * Returns the default directory for saving maps. Modified: trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.settings; import java.io.File; -import net.sf.gridarta.model.configsource.ConfigSource; import org.jetbrains.annotations.NotNull; /** @@ -114,7 +113,7 @@ */ @NotNull @Override - public ConfigSource getConfigSource() { + public String getConfigSourceName() { throw new AssertionError(); } @@ -122,7 +121,7 @@ * {@inheritDoc} */ @Override - public void setConfigSource(@NotNull final ConfigSource configSource) { + public void setConfigSourceName(@NotNull final String configSourceName) { throw new AssertionError(); } Modified: trunk/src/app/net/sf/gridarta/gui/dialog/prefs/ResPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/prefs/ResPreferences.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/src/app/net/sf/gridarta/gui/dialog/prefs/ResPreferences.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -170,7 +170,7 @@ assert mediaField != null; globalSettings.setMediaDirectory(new File(PathManager.getAbsolutePath(mediaField.getText()))); } - globalSettings.setConfigSource((ConfigSource) configSourceComboBox.getSelectedItem()); + globalSettings.setConfigSourceName(((ConfigSource) configSourceComboBox.getSelectedItem()).getName()); if (globalSettings.hasImageSet()) { assert imageSetBox != null; @@ -193,7 +193,7 @@ assert mediaField != null; mediaField.setText(text); } - configSourceComboBox.setSelectedItem(globalSettings.getConfigSource()); + configSourceComboBox.setSelectedItem(configSourceFactory.getConfigSource(globalSettings.getConfigSourceName())); if (globalSettings.hasImageSet()) { final String imageSet = getCurrentImageSet(); assert imageSets != null; @@ -247,7 +247,7 @@ } } - return !(imageSet.equals(getCurrentImageSet()) && configSourceComboBox.getSelectedItem() == globalSettings.getConfigSource()); + return !(imageSet.equals(getCurrentImageSet()) && ((ConfigSource) configSourceComboBox.getSelectedItem()).getName().equals(globalSettings.getConfigSourceName())); } /** @@ -277,7 +277,7 @@ panel.setBorder(createTitledBorder("optionsGlobal")); configSourceComboBox = new JComboBox(configSourceFactory.getConfigSources()); - final ConfigSource configSource = globalSettings.getConfigSource(); + final ConfigSource configSource = configSourceFactory.getConfigSource(globalSettings.getConfigSourceName()); configSourceComboBox.setSelectedItem(configSource); configSourceComboBox.addItemListener(itemListener); preferencesHelper.addComponent(ActionBuilderUtils.newLabel(ACTION_BUILDER, "optionsConfigSource.text")); Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -257,7 +257,7 @@ errorView.addWarning(ErrorViewCategory.TREASURES_FILE_INVALID, "TreasureLists.xml: " + ex.getMessage()); specialTreasureLists = Collections.emptyMap(); } - final ConfigSource configSource = forceReadFromFiles ? configSourceFactory.getFilesConfigSource() : globalSettings.getConfigSource(); + final ConfigSource configSource = forceReadFromFiles ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(globalSettings.getConfigSourceName()); treasureTree = TreasureLoader.parseTreasures(errorView, specialTreasureLists, configSource, globalSettings); final ArchetypeAttributeFactory archetypeAttributeFactory = new DefaultArchetypeAttributeFactory(); final ArchetypeAttributeParser archetypeAttributeParser = new ArchetypeAttributeParser(archetypeAttributeFactory); Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -161,11 +161,10 @@ /** * Creates a new {@link GlobalSettings} instance. - * @param configSourceFactory the config source factory to use * @return the new instance */ @NotNull - GlobalSettings newGlobalSettings(@NotNull ConfigSourceFactory configSourceFactory); + GlobalSettings newGlobalSettings(); /** * Creates a new {@link ArchetypeFactory} instance. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -237,7 +237,7 @@ final SystemIcons systemIcons = new SystemIcons(guiUtils); final ConfigSourceFactory configSourceFactory = new DefaultConfigSourceFactory(); final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); - final GlobalSettings globalSettings = editorFactory.newGlobalSettings(configSourceFactory); + final GlobalSettings globalSettings = editorFactory.newGlobalSettings(); final PathManager pathManager = new PathManager(globalSettings); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); final FaceObjects faceObjects = new DefaultFaceObjects(editorFactory.getIncludeFaceNumbers()); Modified: trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2011-12-17 10:46:51 UTC (rev 9133) +++ trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2011-12-17 12:11:44 UTC (rev 9134) @@ -31,8 +31,6 @@ import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; -import net.sf.gridarta.model.configsource.ConfigSourceFactory; -import net.sf.gridarta.model.configsource.DefaultConfigSourceFactory; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; @@ -90,8 +88,7 @@ */ @NotNull public ImageCreator<G, A, R> newImageCreator(@NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { - final ConfigSourceFactory configSourceFactory = new DefaultConfigSourceFactory(); - final GlobalSettings globalSettings = editorFactory.newGlobalSettings(configSourceFactory); + final GlobalSettings globalSettings = editorFactory.newGlobalSettings(); final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(globalSettings); final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 10:47:03
|
Revision: 9133 http://gridarta.svn.sourceforge.net/gridarta/?rev=9133&view=rev Author: akirschbaum Date: 2011-12-17 10:46:51 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Remove unneeded type parameters. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/DefaultArchetype.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/DefaultArchetypeFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/UndefinedArchetype.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/DefaultArchetype.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/DefaultArchetypeFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/UndefinedArchetype.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/DefaultArchetype.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/DefaultArchetypeFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/UndefinedArchetype.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/anim/AnimationValidator.java trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeValidator.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java trunk/model/src/app/net/sf/gridarta/model/face/AbstractFaceObjects.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjects.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFaces.java trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFacesLoader.java trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/archetype/AttributeListUtilsTest.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetype.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java trunk/model/src/test/net/sf/gridarta/model/gameobject/TestGameObject.java trunk/model/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java trunk/model/src/test/net/sf/gridarta/model/resource/TestFilesResourcesReader.java trunk/src/app/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/dialog/gameobjectattributes/ViewTreasurelistAL.java trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java trunk/src/app/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java trunk/src/app/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java trunk/src/app/net/sf/gridarta/gui/utils/AnimationComponent.java trunk/src/app/net/sf/gridarta/gui/utils/FaceComponent.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -212,7 +212,7 @@ */ @NotNull @Override - public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { return new DefaultGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); } @@ -239,7 +239,7 @@ */ @NotNull @Override - public ArchetypeFactory<GameObject, MapArchObject, Archetype> newArchetypeFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public ArchetypeFactory<GameObject, MapArchObject, Archetype> newArchetypeFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { return new DefaultArchetypeFactory(faceObjectProviders, animationObjects); } @@ -273,7 +273,7 @@ * {@inheritDoc} */ @Override - public void initSmoothFaces(@NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects) { + public void initSmoothFaces(@NotNull final FaceObjects faceObjects) { } /** @@ -362,7 +362,7 @@ * {@inheritDoc} */ @Override - public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { + public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), IGUIConstants.ARCHDEF_FILE); multiPositionData.load(errorView, url); @@ -467,7 +467,7 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } @@ -476,7 +476,7 @@ */ @NotNull @Override - public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -78,7 +78,7 @@ * @param multiPositionData the multi position data to query for multi-part * objects */ - public ArchetypeParser(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final MultiPositionData multiPositionData) { + public ArchetypeParser(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final MultiPositionData multiPositionData) { super(new DefaultArchetypeBuilder(gameObjectFactory), animationObjects, archetypeSet); this.gameObjectParser = gameObjectParser; this.multiPositionData = multiPositionData; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/DefaultArchetype.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/DefaultArchetype.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/DefaultArchetype.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -44,7 +44,7 @@ * faces * @param animationObjects the animation objects for looking up animations */ - public DefaultArchetype(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public DefaultArchetype(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { super(archetypeName, faceObjectProviders, animationObjects); } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/DefaultArchetypeFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/DefaultArchetypeFactory.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/DefaultArchetypeFactory.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -42,7 +42,7 @@ * The {@link AnimationObjects} for looking up animations. */ @NotNull - private final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects; + private final AnimationObjects animationObjects; /** * Creates a new instance. @@ -50,7 +50,7 @@ * faces * @param animationObjects the animation objects for looking up animations */ - public DefaultArchetypeFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public DefaultArchetypeFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { this.faceObjectProviders = faceObjectProviders; this.animationObjects = animationObjects; } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/UndefinedArchetype.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/UndefinedArchetype.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/UndefinedArchetype.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -45,7 +45,7 @@ * faces * @param animationObjects the animation objects for looking up animations */ - public UndefinedArchetype(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public UndefinedArchetype(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { super(archetypeName, faceObjectProviders, animationObjects); setEditorFolder(net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN); } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -46,7 +46,7 @@ * The {@link AnimationObjects} for looking up animations. */ @NotNull - private final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects; + private final AnimationObjects animationObjects; /** * The {@link ArchetypeTypeSet} for looking up archetype types. @@ -61,7 +61,7 @@ * @param archetypeTypeSet the archetype type set for looking up archetype * types */ - public DefaultGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + public DefaultGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { this.faceObjectProviders = faceObjectProviders; this.animationObjects = animationObjects; this.archetypeTypeSet = archetypeTypeSet; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -63,7 +63,7 @@ * @param archetypeTypeSet the archetype type set for looking up archetype * types */ - public GameObject(@NotNull final Archetype archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + public GameObject(@NotNull final Archetype archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { super(archetype, faceObjectProviders, animationObjects); this.archetypeTypeSet = archetypeTypeSet; } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -48,7 +48,7 @@ * @param faceObjects the face objects instance * @param animationObjects the animation objects instance */ - public CollectedResourcesReader(@NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public CollectedResourcesReader(@NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects) { super(collectedDirectory, null, archetypeSet, archetypeParser, animationObjects, faceObjects, IGUIConstants.ANIMTREE_FILE, IGUIConstants.ARCH_FILE); } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -74,13 +74,13 @@ * The {@link FaceObjects} instance. */ @NotNull - private final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects; + private final FaceObjects faceObjects; /** * The {@link AnimationObjects} instance. */ @NotNull - private final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects; + private final AnimationObjects animationObjects; /** * The {@link ArchFaceProvider} to use. @@ -106,7 +106,7 @@ * @param faceObjectProviders the face object providers for looking up * faces */ - public DefaultResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public DefaultResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { super(gameObjectParser, archetypeSet, mapViewSettings); this.gameObjectParser = gameObjectParser; this.archetypeSet = archetypeSet; @@ -143,10 +143,10 @@ */ @Override protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(); + final CollectedResourcesWriter collectedResourcesWriter = new CollectedResourcesWriter(); collectedResourcesWriter.addCollectable(new AtrinikArchetypeSetCollectable(archetypeSet, gameObjectParser)); - collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); - collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); + collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable(animationObjects, IGUIConstants.ANIMTREE_FILE)); + collectedResourcesWriter.addCollectable(new FaceObjectsCollectable(faceObjects, archFaceProvider)); collectedResourcesWriter.write(progress, collectedDirectory); } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -62,7 +62,7 @@ * @param animationObjects the animation objects instance * @param archFaceProvider the arch face provider to use */ - public FilesResourcesReader(@NotNull final File archDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchFaceProvider archFaceProvider) { + public FilesResourcesReader(@NotNull final File archDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider) { super(archDirectory, archetypeSet, archetypeParser, archFaceProvider, collectedDirectory, null, animationObjects, faceObjects); this.archDirectory = archDirectory; this.archFaceProvider = archFaceProvider; Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -140,11 +140,11 @@ @NotNull @Override protected AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ? extends AbstractArchetypeBuilder<GameObject, MapArchObject, Archetype>> newArchetypeParser() { - final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects = new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(true); + final FaceObjects faceObjects = new DefaultFaceObjects(true); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); + final AnimationObjects animationObjects = new DefaultAnimationObjects(); final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -57,7 +57,7 @@ * The {@link SmoothFaces} to use. */ @NotNull - private final SmoothFaces<?, ?, ?> smoothFaces; + private final SmoothFaces smoothFaces; /** * The {@link GridMapSquarePainter} to use. @@ -95,7 +95,7 @@ * faces * @param systemIcons the system icons for creating icons */ - public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final SmoothFaces<?, ?, ?> smoothFaces, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { + public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final SmoothFaces smoothFaces, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { this.mapViewSettings = mapViewSettings; this.filterControl = filterControl; this.smoothFaces = smoothFaces; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -68,7 +68,7 @@ * The {@link SmoothFaces} to use. */ @NotNull - private final SmoothFaces<?, ?, ?> smoothFaces; + private final SmoothFaces smoothFaces; /** * The {@link FaceObjectProviders} for looking up faces. @@ -92,7 +92,7 @@ * @param faceObjectProviders the face object providers for looking up * faces */ - protected SmoothingRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final SmoothFaces<?, ?, ?> smoothFaces, @NotNull final FaceObjectProviders faceObjectProviders) { + protected SmoothingRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final SmoothFaces smoothFaces, @NotNull final FaceObjectProviders faceObjectProviders) { this.mapModel = mapModel; this.smoothFaces = smoothFaces; this.faceObjectProviders = faceObjectProviders; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -141,7 +141,7 @@ * The {@link SmoothFaces} instance. */ @Nullable - private SmoothFaces<GameObject, MapArchObject, Archetype> smoothFaces = null; + private SmoothFaces smoothFaces = null; /** * {@inheritDoc} @@ -183,7 +183,7 @@ */ @NotNull @Override - public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { return new DefaultGameObjectFactory(faceObjectProviders, animationObjects); } @@ -210,7 +210,7 @@ */ @NotNull @Override - public ArchetypeFactory<GameObject, MapArchObject, Archetype> newArchetypeFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public ArchetypeFactory<GameObject, MapArchObject, Archetype> newArchetypeFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { return new DefaultArchetypeFactory(faceObjectProviders, animationObjects); } @@ -245,11 +245,11 @@ * {@inheritDoc} */ @Override - public void initSmoothFaces(@NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects) { + public void initSmoothFaces(@NotNull final FaceObjects faceObjects) { if (smoothFaces != null) { throw new IllegalStateException(); } - smoothFaces = new SmoothFaces<GameObject, MapArchObject, Archetype>(faceObjects); + smoothFaces = new SmoothFaces(faceObjects); } /** @@ -271,7 +271,7 @@ * {@inheritDoc} */ @Override - public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { + public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { if (smoothFaces == null) { throw new IllegalStateException(); } @@ -377,7 +377,7 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapModelFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } @@ -386,7 +386,7 @@ */ @NotNull @Override - public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { if (smoothFaces == null) { throw new IllegalStateException(); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -81,7 +81,7 @@ * The {@link SmoothFaces} instance to update. */ @NotNull - private final SmoothFaces<?, ?, ?> smoothFaces; + private final SmoothFaces smoothFaces; /** * Creates an ArchetypeParser. @@ -91,7 +91,7 @@ * @param gameObjectFactory the factory for creating game objects * @param smoothFaces the smooth faces instance to update */ - public ArchetypeParser(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SmoothFaces<?, ?, ?> smoothFaces) { + public ArchetypeParser(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SmoothFaces smoothFaces) { super(new DefaultArchetypeBuilder(gameObjectFactory), animationObjects, archetypeSet); this.gameObjectParser = gameObjectParser; this.smoothFaces = smoothFaces; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/DefaultArchetype.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/DefaultArchetype.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/DefaultArchetype.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -44,7 +44,7 @@ * faces * @param animationObjects the animation objects for looking up animations */ - public DefaultArchetype(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public DefaultArchetype(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { super(archetypeName, faceObjectProviders, animationObjects); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/DefaultArchetypeFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/DefaultArchetypeFactory.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/DefaultArchetypeFactory.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -42,7 +42,7 @@ * The {@link AnimationObjects} for looking up animations. */ @NotNull - private final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects; + private final AnimationObjects animationObjects; /** * Creates a new instance. @@ -50,7 +50,7 @@ * faces * @param animationObjects the animation objects for looking up animations */ - public DefaultArchetypeFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public DefaultArchetypeFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { this.faceObjectProviders = faceObjectProviders; this.animationObjects = animationObjects; } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/UndefinedArchetype.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/UndefinedArchetype.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/UndefinedArchetype.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -45,7 +45,7 @@ * faces * @param animationObjects the animation objects for looking up animations */ - public UndefinedArchetype(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public UndefinedArchetype(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { super(archetypeName, faceObjectProviders, animationObjects); setEditorFolder(net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -45,14 +45,14 @@ * The {@link AnimationObjects} for looking up animations. */ @NotNull - private final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects; + private final AnimationObjects animationObjects; /** * Creates a new instance. * @param faceObjectProviders the face object providers to use * @param animationObjects the animation objects for looking up animations */ - public DefaultGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public DefaultGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { this.faceObjectProviders = faceObjectProviders; this.animationObjects = animationObjects; } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -72,7 +72,7 @@ * faces * @param animationObjects the animation objects for looking up animations */ - public GameObject(@NotNull final Archetype archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { + public GameObject(@NotNull final Archetype archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { super(archetype, faceObjectProviders, animationObjects); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -56,7 +56,7 @@ * The smooth faces to update. */ @NotNull - private final SmoothFaces<?, ?, ?> smoothFaces; + private final SmoothFaces smoothFaces; /** * Creates a new instance. @@ -68,7 +68,7 @@ * @param animationObjects the animation objects instance * @param smoothFaces the smooth faces to update */ - public CollectedResourcesReader(@NotNull final File configurationDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final SmoothFaces<?, ?, ?> smoothFaces) { + public CollectedResourcesReader(@NotNull final File configurationDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final SmoothFaces smoothFaces) { super(collectedDirectory, archetypeSet.getImageSet(), archetypeSet, archetypeParser, animationObjects, faceObjects, IGUIConstants.ANIMTREE_FILE, IGUIConstants.ARCH_FILE); this.configurationDirectory = configurationDirectory; this.smoothFaces = smoothFaces; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 08:18:29 UTC (rev 9132) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 10:46:51 UTC (rev 9133) @@ -75,19 +75,19 @@ * The {@link FaceObjects} instance. */ @NotNull - private final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects; + private final FaceObjects faceObjects; /** * The {@link AnimationObjects} instance. */ @NotNull - private final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects; + private final AnimationObjects animationObjects; /** * The {@link SmoothFaces} instance. */ @NotNull - private final SmoothFaces<GameObject, MapArchObject, Archetype> smoothFaces; + private final SmoothFaces smoothFaces; /** * The {@link ArchFaceProvider} to use. @@ -114,7 +114,7 @@ * @param faceObjectProviders the face object providers for looking up * faces */ - public DefaultResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final SmoothFaces<GameObject, MapArchObject, Archetype> smoothFaces, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public DefaultResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectPars... [truncated message content] |
From: <aki...@us...> - 2011-12-17 08:18:37
|
Revision: 9132 http://gridarta.svn.sourceforge.net/gridarta/?rev=9132&view=rev Author: akirschbaum Date: 2011-12-17 08:18:29 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Remove dependency Collectable -> GameObjectParser. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java trunk/model/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -35,9 +35,11 @@ /** * Creates a new instance. * @param archetypeSet the archetype set to collect + * @param gameObjectParser the game object parser for writing inventory game + * objects */ - public AtrinikArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - super(archetypeSet, IGUIConstants.ARCH_FILE); + public AtrinikArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) { + super(archetypeSet, IGUIConstants.ARCH_FILE, gameObjectParser); } /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -143,8 +143,8 @@ */ @Override protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); - collectedResourcesWriter.addCollectable(new AtrinikArchetypeSetCollectable(archetypeSet)); + final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(); + collectedResourcesWriter.addCollectable(new AtrinikArchetypeSetCollectable(archetypeSet, gameObjectParser)); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.write(progress, collectedDirectory); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -35,9 +35,11 @@ /** * Creates a new instance. * @param archetypeSet the archetype set to collect + * @param gameObjectParser the game object parser for writing inventory game + * objects */ - public CrossfireArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - super(archetypeSet, IGUIConstants.ARCH_FILE); + public CrossfireArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) { + super(archetypeSet, IGUIConstants.ARCH_FILE, gameObjectParser); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -150,8 +150,8 @@ */ @Override protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); - collectedResourcesWriter.addCollectable(new CrossfireArchetypeSetCollectable(archetypeSet)); + final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(); + collectedResourcesWriter.addCollectable(new CrossfireArchetypeSetCollectable(archetypeSet, gameObjectParser)); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.addCollectable(new SmoothFacesCollectable<GameObject, MapArchObject, Archetype>(smoothFaces, IGUIConstants.SMOOTH_FILE)); Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -35,9 +35,11 @@ /** * Creates a new instance. * @param archetypeSet the archetype set to collect + * @param gameObjectParser the game object parser for writing inventory game + * objects */ - public DaimoninArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - super(archetypeSet, IGUIConstants.ARCH_FILE); + public DaimoninArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) { + super(archetypeSet, IGUIConstants.ARCH_FILE, gameObjectParser); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -143,8 +143,8 @@ */ @Override protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); - collectedResourcesWriter.addCollectable(new DaimoninArchetypeSetCollectable(archetypeSet)); + final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(); + collectedResourcesWriter.addCollectable(new DaimoninArchetypeSetCollectable(archetypeSet, gameObjectParser)); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.write(progress, collectedDirectory); Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -59,20 +59,29 @@ private final String archFile; /** + * The {@link GameObjectParser} for writing inventory game objects. + */ + @NotNull + private final GameObjectParser<G, A, R> gameObjectParser; + + /** * Creates a new instance. * @param archetypeSet the archetype set to collect * @param archFile the collected archetypes file name + * @param gameObjectParser the game object parser for writing inventory game + * objects */ - protected AbstractArchetypeSetCollectable(@NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final String archFile) { + protected AbstractArchetypeSetCollectable(@NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final String archFile, @NotNull final GameObjectParser<G, A, R> gameObjectParser) { this.archetypeSet = archetypeSet; this.archFile = archFile; + this.gameObjectParser = gameObjectParser; } /** * {@inheritDoc} Collects the Archetypes. */ @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { final File file = new File(collectedDirectory, archFile); final FileOutputStream fos = new FileOutputStream(file); try { Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -29,7 +29,6 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.data.NamedObject; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.IOUtils; @@ -73,7 +72,7 @@ * "animtree". */ @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { collectAnimations(progress, collectedDirectory); collectAnimTree(progress, collectedDirectory); } Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -23,7 +23,6 @@ import java.io.IOException; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; @@ -40,10 +39,8 @@ * Collect information. * @param progress Progress to report progress to. * @param collectedDirectory the destination directory to collect data to - * @param gameObjectParser the game object parser for writing inventory game - * objects * @throws IOException in case of I/O problems during collection */ - void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException; + void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException; } // interface Collectable Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -34,7 +34,6 @@ import net.sf.gridarta.model.face.FaceObject; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.japi.swing.action.ActionBuilder; @@ -80,7 +79,7 @@ * as that of gimp in many cases (yet much better as the old visualtek's). */ @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { collectTreeFile(progress, collectedDirectory); collectBmapsFile(progress, collectedDirectory); collectImageFile(progress, collectedDirectory); Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -27,7 +27,6 @@ import java.util.Map; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.smoothface.SmoothFace; import net.sf.gridarta.model.smoothface.SmoothFaces; @@ -63,7 +62,7 @@ * {@inheritDoc} */ @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, smoothFile)); try { final OutputStreamWriter osw = new OutputStreamWriter(fos, IOUtils.MAP_ENCODING); Modified: trunk/model/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java 2011-12-17 08:10:43 UTC (rev 9131) +++ trunk/model/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java 2011-12-17 08:18:29 UTC (rev 9132) @@ -26,7 +26,6 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; @@ -44,21 +43,6 @@ private final Collection<Collectable<G, A, R>> collectables = new ArrayList<Collectable<G, A, R>>(); /** - * The {@link GameObjectParser} for writing inventory game objects. - */ - @NotNull - private final GameObjectParser<G, A, R> gameObjectParser; - - /** - * Creates a new instance. - * @param gameObjectParser the game object parser for writing inventory game - * objects - */ - public CollectedResourcesWriter(@NotNull final GameObjectParser<G, A, R> gameObjectParser) { - this.gameObjectParser = gameObjectParser; - } - - /** * Adds a {@link Collectable} resource. * @param collectable the collectable resource */ @@ -74,7 +58,7 @@ */ public void write(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { for (final Collectable<G, A, R> collectable : collectables) { - collectable.collect(progress, collectedDirectory, gameObjectParser); + collectable.collect(progress, collectedDirectory); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 08:10:50
|
Revision: 9131 http://gridarta.svn.sourceforge.net/gridarta/?rev=9131&view=rev Author: akirschbaum Date: 2011-12-17 08:10:43 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Split off SmoothFacesCollectable from SmoothFaces. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFaces.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 07:49:59 UTC (rev 9130) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 08:10:43 UTC (rev 9131) @@ -249,7 +249,7 @@ if (smoothFaces != null) { throw new IllegalStateException(); } - smoothFaces = new SmoothFaces<GameObject, MapArchObject, Archetype>(faceObjects, IGUIConstants.SMOOTH_FILE); + smoothFaces = new SmoothFaces<GameObject, MapArchObject, Archetype>(faceObjects); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 07:49:59 UTC (rev 9130) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 08:10:43 UTC (rev 9131) @@ -28,6 +28,7 @@ import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.collectable.AnimationObjectsCollectable; import net.sf.gridarta.model.collectable.FaceObjectsCollectable; +import net.sf.gridarta.model.collectable.SmoothFacesCollectable; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -153,7 +154,7 @@ collectedResourcesWriter.addCollectable(new CrossfireArchetypeSetCollectable(archetypeSet)); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); - collectedResourcesWriter.addCollectable(smoothFaces); + collectedResourcesWriter.addCollectable(new SmoothFacesCollectable<GameObject, MapArchObject, Archetype>(smoothFaces, IGUIConstants.SMOOTH_FILE)); collectedResourcesWriter.write(progress, collectedDirectory); } Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 07:49:59 UTC (rev 9130) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 08:10:43 UTC (rev 9131) @@ -36,7 +36,6 @@ import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; -import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.gameobject.DefaultGameObjectFactory; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.io.DefaultGameObjectParser; @@ -111,7 +110,7 @@ assert archetypeSet != null; final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, archetypeSet); assert archetypeSet != null; - final SmoothFaces<?, ?, ?> smoothFaces = new SmoothFaces<GameObject, MapArchObject, Archetype>(faceObjects, IGUIConstants.SMOOTH_FILE); + final SmoothFaces<?, ?, ?> smoothFaces = new SmoothFaces<GameObject, MapArchObject, Archetype>(faceObjects); assert archetypeSet != null; return new ArchetypeParser(gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, smoothFaces); } Added: trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java 2011-12-17 08:10:43 UTC (rev 9131) @@ -0,0 +1,89 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.collectable; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.Map; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.smoothface.SmoothFace; +import net.sf.gridarta.model.smoothface.SmoothFaces; +import net.sf.gridarta.utils.IOUtils; +import net.sf.japi.swing.misc.Progress; +import org.jetbrains.annotations.NotNull; + +public class SmoothFacesCollectable<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Collectable<G, A, R> { + + /** + * The {@link SmoothFaces} being collected. + */ + @NotNull + private final SmoothFaces<G, A, R> smoothFaces; + + /** + * The smooth file to write to. + */ + @NotNull + private final String smoothFile; + + /** + * Creates a new instance. + * @param smoothFaces the smooth faces to collect + * @param smoothFile the smooth file to write to + */ + public SmoothFacesCollectable(@NotNull final SmoothFaces<G, A, R> smoothFaces, @NotNull final String smoothFile) { + this.smoothFaces = smoothFaces; + this.smoothFile = smoothFile; + } + + /** + * {@inheritDoc} + */ + @Override + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, smoothFile)); + try { + final OutputStreamWriter osw = new OutputStreamWriter(fos, IOUtils.MAP_ENCODING); + try { + final BufferedWriter out = new BufferedWriter(osw); + try { + out.append("default_smoothed.111 sdefault.001\n"); + for (final Map.Entry<String, SmoothFace> e : smoothFaces) { + final SmoothFace smoothFace = e.getValue(); + out.append(smoothFace.getFace()).append(' ').append(smoothFace.getValue()).append('\n'); + } + } finally { + out.close(); + } + } finally { + osw.close(); + } + } finally { + fos.close(); + } + } + +} Property changes on: trunk/model/src/app/net/sf/gridarta/model/collectable/SmoothFacesCollectable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFaces.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFaces.java 2011-12-17 07:49:59 UTC (rev 9130) +++ trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFaces.java 2011-12-17 08:10:43 UTC (rev 9131) @@ -19,22 +19,15 @@ package net.sf.gridarta.model.smoothface; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; +import java.util.Collections; +import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.model.face.FaceObject; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.utils.IOUtils; -import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -42,7 +35,7 @@ * Collection of all smoothing information. * @author Andreas Kirschbaum */ -public class SmoothFaces<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Collectable<G, A, R> { +public class SmoothFaces<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Iterable<Map.Entry<String, SmoothFace>> { /** * The defined {@link SmoothFaces}. @@ -56,46 +49,15 @@ @NotNull private final FaceObjects<G, A, R> faceObjects; - @NotNull - private final String smoothFile; - /** * Creates a new instance. * @param faceObjects the face objects for looking up faces */ - public SmoothFaces(@NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final String smoothFile) { + public SmoothFaces(@NotNull final FaceObjects<G, A, R> faceObjects) { this.faceObjects = faceObjects; - this.smoothFile = smoothFile; } /** - * {@inheritDoc} - */ - @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { - final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, smoothFile)); - try { - final OutputStreamWriter osw = new OutputStreamWriter(fos, IOUtils.MAP_ENCODING); - try { - final BufferedWriter out = new BufferedWriter(osw); - try { - out.append("default_smoothed.111 sdefault.001\n"); - for (final Map.Entry<String, SmoothFace> e : smoothFaces.entrySet()) { - final SmoothFace smoothFace = e.getValue(); - out.append(smoothFace.getFace()).append(' ').append(smoothFace.getValue()).append('\n'); - } - } finally { - out.close(); - } - } finally { - osw.close(); - } - } finally { - fos.close(); - } - } - - /** * Adds a {@link SmoothFace} instance. * @param smoothFace the smooth face instance * @throws DuplicateSmoothFaceException if the smooth face is not unique @@ -135,4 +97,13 @@ return faceObjects.get(smoothFace.getValue()); } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public Iterator<Map.Entry<String, SmoothFace>> iterator() { + return Collections.unmodifiableMap(smoothFaces).entrySet().iterator(); + } + } // class SmoothFaces This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 07:50:06
|
Revision: 9130 http://gridarta.svn.sourceforge.net/gridarta/?rev=9130&view=rev Author: akirschbaum Date: 2011-12-17 07:49:59 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Declare variable more local. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-12-17 07:49:23 UTC (rev 9129) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-12-17 07:49:59 UTC (rev 9130) @@ -240,7 +240,6 @@ final GlobalSettings globalSettings = editorFactory.newGlobalSettings(configSourceFactory); final PathManager pathManager = new PathManager(globalSettings); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final FaceObjects<G, A, R> faceObjects = new DefaultFaceObjects<G, A, R>(editorFactory.getIncludeFaceNumbers()); editorFactory.initSmoothFaces(faceObjects); final int doubleFaceOffset = editorFactory.getDoubleFaceOffset(); @@ -269,6 +268,7 @@ final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(globalSettings); final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); final AbstractArchetypeParser<G, A, R, ?> archetypeParser = editorFactory.newArchetypeParser(errorView, gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, globalSettings); + final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final AbstractResources<G, A, R> resources = editorFactory.newResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 07:49:30
|
Revision: 9129 http://gridarta.svn.sourceforge.net/gridarta/?rev=9129&view=rev Author: akirschbaum Date: 2011-12-17 07:49:23 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 07:43:37 UTC (rev 9128) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 07:49:23 UTC (rev 9129) @@ -60,7 +60,6 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObjectFactory; @@ -265,10 +264,9 @@ /** * {@inheritDoc} */ - @NotNull @Override - public FaceObjects<GameObject, MapArchObject, Archetype> createFaceObjects(@NotNull final ArchFaceProvider archFaceProvider) { - return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(true); + public boolean getIncludeFaceNumbers() { + return true; } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 07:43:37 UTC (rev 9128) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 07:49:23 UTC (rev 9129) @@ -57,7 +57,6 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObjectFactory; @@ -237,10 +236,9 @@ /** * {@inheritDoc} */ - @NotNull @Override - public FaceObjects<GameObject, MapArchObject, Archetype> createFaceObjects(@NotNull final ArchFaceProvider archFaceProvider) { - return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(false); + public boolean getIncludeFaceNumbers() { + return false; } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 07:43:37 UTC (rev 9128) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 07:49:23 UTC (rev 9129) @@ -60,7 +60,6 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObjectFactory; @@ -265,10 +264,9 @@ /** * {@inheritDoc} */ - @NotNull @Override - public FaceObjects<GameObject, MapArchObject, Archetype> createFaceObjects(@NotNull final ArchFaceProvider archFaceProvider) { - return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(true); + public boolean getIncludeFaceNumbers() { + return true; } /** Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2011-12-17 07:43:37 UTC (rev 9128) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2011-12-17 07:49:23 UTC (rev 9129) @@ -198,12 +198,10 @@ MapControlFactory<G, A, R> newMapControlFactory(@NotNull MapWriter<G, A, R> mapWriter, @NotNull GlobalSettings globalSettings, @NotNull MapModelFactory<G, A, R> mapModelFactory); /** - * Creates a new {@link FaceObjects} instance. - * @param archFaceProvider the arch face provider to use - * @return the new instance + * Returns whether the face file contains face numbers. + * @return whether the face file contains face numbers */ - @NotNull - FaceObjects<G, A, R> createFaceObjects(@NotNull ArchFaceProvider archFaceProvider); + boolean getIncludeFaceNumbers(); /** * Initializes smoothing information. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-12-17 07:43:37 UTC (rev 9128) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-12-17 07:49:23 UTC (rev 9129) @@ -57,6 +57,7 @@ import net.sf.gridarta.model.configsource.DefaultConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; +import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.filter.NamedFilter; @@ -240,7 +241,7 @@ final PathManager pathManager = new PathManager(globalSettings); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<G, A, R> faceObjects = editorFactory.createFaceObjects(archFaceProvider); + final FaceObjects<G, A, R> faceObjects = new DefaultFaceObjects<G, A, R>(editorFactory.getIncludeFaceNumbers()); editorFactory.initSmoothFaces(faceObjects); final int doubleFaceOffset = editorFactory.getDoubleFaceOffset(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(doubleFaceOffset, faceObjects, systemIcons); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 07:43:49
|
Revision: 9128 http://gridarta.svn.sourceforge.net/gridarta/?rev=9128&view=rev Author: akirschbaum Date: 2011-12-17 07:43:37 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Remove unneeded code. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/archetype/DefaultArchetypeSet.java Removed Paths: ------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 07:26:00 UTC (rev 9127) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 07:43:37 UTC (rev 9128) @@ -47,6 +47,8 @@ import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeFactory; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.DefaultArchetypeSet; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; @@ -107,7 +109,6 @@ import net.sf.gridarta.var.atrinik.gui.scripts.DefaultScriptArchUtils; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.archetype.ArchetypeParser; -import net.sf.gridarta.var.atrinik.model.archetype.ArchetypeSet; import net.sf.gridarta.var.atrinik.model.archetype.DefaultArchetypeFactory; import net.sf.gridarta.var.atrinik.model.gameobject.DefaultGameObjectFactory; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; @@ -177,7 +178,7 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } @@ -221,7 +222,7 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); } @@ -248,8 +249,8 @@ */ @NotNull @Override - public ArchetypeSet newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - return new ArchetypeSet(archetypeFactory, faceObjectProviders); + public ArchetypeSet<GameObject, MapArchObject, Archetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { + return new DefaultArchetypeSet<GameObject, MapArchObject, Archetype>(archetypeFactory, null, faceObjectProviders); } /** @@ -363,7 +364,7 @@ * {@inheritDoc} */ @Override - public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { + public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), IGUIConstants.ARCHDEF_FILE); multiPositionData.load(errorView, url); @@ -387,7 +388,7 @@ */ @NotNull @Override - public ScriptedEventFactory<GameObject, MapArchObject, Archetype> newScriptedEventFactory(@NotNull final ScriptArchUtils scriptArchUtils, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public ScriptedEventFactory<GameObject, MapArchObject, Archetype> newScriptedEventFactory(@NotNull final ScriptArchUtils scriptArchUtils, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { return new DefaultScriptedEventFactory(scriptArchUtils, "sub_type", gameObjectFactory, scriptedEventEditor, archetypeSet); } @@ -468,7 +469,7 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } @@ -477,7 +478,7 @@ */ @NotNull @Override - public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); } Deleted: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2011-12-17 07:26:00 UTC (rev 9127) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2011-12-17 07:43:37 UTC (rev 9128) @@ -1,46 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.var.atrinik.model.archetype; - -import net.sf.gridarta.model.archetype.AbstractArchetypeSet; -import net.sf.gridarta.model.archetype.ArchetypeFactory; -import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; -import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * The <code>ArchetypeSet</code> contains all the Archetypes. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class ArchetypeSet extends AbstractArchetypeSet<GameObject, MapArchObject, Archetype> { - - /** - * Create the ArchetypeSet. - * @param archetypeFactory the archetype factory instance to use - * @param faceObjectProviders the face object providers - */ - public ArchetypeSet(@NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, null, faceObjectProviders); - } - -} // class ArchetypeSet Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-12-17 07:26:00 UTC (rev 9127) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-12-17 07:43:37 UTC (rev 9128) @@ -25,6 +25,8 @@ import net.sf.gridarta.model.archetype.AbstractArchetypeBuilder; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.AbstractArchetypeParserTest; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.DefaultArchetypeSet; import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.baseobject.BaseObject; @@ -58,7 +60,7 @@ * The loaded archetypes. */ @Nullable - private ArchetypeSet archetypeSet = null; + private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; /** * Checks that mpart_id fields are parsed correctly. @@ -146,7 +148,7 @@ final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); - archetypeSet = new ArchetypeSet(archetypeFactory, faceObjectProviders); + archetypeSet = new DefaultArchetypeSet<GameObject, MapArchObject, Archetype>(archetypeFactory, null, faceObjectProviders); archetypeSet.setLoadedFromArchive(true); assert archetypeSet != null; final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, archetypeSet); @@ -163,7 +165,7 @@ @NotNull @Override @SuppressWarnings("NullableProblems") - protected ArchetypeSet getArchetypeSet() { + protected ArchetypeSet<GameObject, MapArchObject, Archetype> getArchetypeSet() { if (archetypeSet == null) { throw new IllegalStateException(); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 07:26:00 UTC (rev 9127) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 07:43:37 UTC (rev 9128) @@ -45,6 +45,8 @@ import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeFactory; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.DefaultArchetypeSet; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; @@ -81,6 +83,7 @@ import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; @@ -102,7 +105,6 @@ import net.sf.gridarta.var.crossfire.gui.scripts.DefaultScriptArchUtils; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.archetype.ArchetypeParser; -import net.sf.gridarta.var.crossfire.model.archetype.ArchetypeSet; import net.sf.gridarta.var.crossfire.model.archetype.DefaultArchetypeFactory; import net.sf.gridarta.var.crossfire.model.gameobject.DefaultGameObjectFactory; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; @@ -113,7 +115,6 @@ import net.sf.gridarta.var.crossfire.model.mapcontrol.DefaultMapControlFactory; import net.sf.gridarta.var.crossfire.model.scripts.DefaultScriptedEventFactory; import net.sf.gridarta.var.crossfire.model.settings.DefaultGlobalSettings; -import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.var.crossfire.resource.DefaultResources; import net.sf.japi.swing.prefs.PreferencesGroup; import org.apache.log4j.Category; @@ -148,7 +149,7 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } @@ -192,7 +193,7 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); } @@ -219,8 +220,9 @@ */ @NotNull @Override - public ArchetypeSet newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - return new ArchetypeSet(globalSettings.getImageSet(), archetypeFactory, faceObjectProviders); + public ArchetypeSet<GameObject, MapArchObject, Archetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { + final String imageSet = globalSettings.getImageSet(); + return new DefaultArchetypeSet<GameObject, MapArchObject, Archetype>(archetypeFactory, imageSet.equals("none") ? null : imageSet, faceObjectProviders); } /** @@ -271,7 +273,7 @@ * {@inheritDoc} */ @Override - public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { + public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { if (smoothFaces == null) { throw new IllegalStateException(); } @@ -292,7 +294,7 @@ */ @NotNull @Override - public ScriptedEventFactory<GameObject, MapArchObject, Archetype> newScriptedEventFactory(@NotNull final ScriptArchUtils scriptArchUtils, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public ScriptedEventFactory<GameObject, MapArchObject, Archetype> newScriptedEventFactory(@NotNull final ScriptArchUtils scriptArchUtils, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { return new DefaultScriptedEventFactory(scriptArchUtils, "subtype", gameObjectFactory, scriptedEventEditor, archetypeSet); } @@ -377,7 +379,7 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapModelFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } @@ -386,7 +388,7 @@ */ @NotNull @Override - public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { if (smoothFaces == null) { throw new IllegalStateException(); } Deleted: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2011-12-17 07:26:00 UTC (rev 9127) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2011-12-17 07:43:37 UTC (rev 9128) @@ -1,47 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.var.crossfire.model.archetype; - -import net.sf.gridarta.model.archetype.AbstractArchetypeSet; -import net.sf.gridarta.model.archetype.ArchetypeFactory; -import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; -import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * The <code>ArchetypeSet</code> contains all the Archetypes. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class ArchetypeSet extends AbstractArchetypeSet<GameObject, MapArchObject, Archetype> { - - /** - * Create the ArchetypeSet. - * @param imageSet the image set to use - * @param archetypeFactory the archetype factory to use - * @param faceObjectProviders the face object providers - */ - public ArchetypeSet(@NotNull final String imageSet, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, imageSet.equals("none") ? null : imageSet, faceObjectProviders); - } - -} // class ArchetypeSet Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 07:26:00 UTC (rev 9127) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 07:43:37 UTC (rev 9128) @@ -25,6 +25,8 @@ import net.sf.gridarta.model.archetype.AbstractArchetypeBuilder; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.AbstractArchetypeParserTest; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.DefaultArchetypeSet; import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.DefaultFaceObjects; @@ -57,7 +59,7 @@ * The loaded archetypes. */ @Nullable - private ArchetypeSet archetypeSet = null; + private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; /** * Checks that inventory game objects are recognized. @@ -104,7 +106,7 @@ final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects); final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); - archetypeSet = new ArchetypeSet("images", archetypeFactory, faceObjectProviders); + archetypeSet = new DefaultArchetypeSet<GameObject, MapArchObject, Archetype>(archetypeFactory, "images", faceObjectProviders); archetypeSet.setLoadedFromArchive(true); assert archetypeSet != null; final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, archetypeSet); @@ -120,7 +122,7 @@ @NotNull @Override @SuppressWarnings("NullableProblems") - protected ArchetypeSet getArchetypeSet() { + protected ArchetypeSet<GameObject, MapArchObject, Archetype> getArchetypeSet() { if (archetypeSet == null) { throw new IllegalStateException(); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 07:26:00 UTC (rev 9127) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 07:43:37 UTC (rev 9128) @@ -47,6 +47,8 @@ import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeFactory; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.DefaultArchetypeSet; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; @@ -107,7 +109,6 @@ import net.sf.gridarta.var.daimonin.gui.scripts.DefaultScriptArchUtils; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.archetype.ArchetypeParser; -import net.sf.gridarta.var.daimonin.model.archetype.ArchetypeSet; import net.sf.gridarta.var.daimonin.model.archetype.DefaultArchetypeFactory; import net.sf.gridarta.var.daimonin.model.gameobject.DefaultGameObjectFactory; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; @@ -177,7 +178,7 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } @@ -221,7 +222,7 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); } @@ -248,8 +249,8 @@ */ @NotNull @Override - public ArchetypeSet newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - return new ArchetypeSet(archetypeFactory, faceObjectProviders); + public ArchetypeSet<GameObject, MapArchObject, Archetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { + return new DefaultArchetypeSet<GameObject, MapArchObject, Archetype>(archetypeFactory, null, faceObjectProviders); } /** @@ -363,7 +364,7 @@ * {@inheritDoc} */ @Override - public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { + public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GlobalSettings globalSettings) { try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), IGUIConstants.ARCHDEF_FILE); multiPositionData.load(errorView, url); @@ -387,7 +388,7 @@ */ @NotNull @Override - public ScriptedEventFactory<GameObject, MapArchObject, Archetype> newScriptedEventFactory(@NotNull final ScriptArchUtils scriptArchUtils, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public ScriptedEventFactory<GameObject, MapArchObject, Archetype> newScriptedEventFactory(@NotNull final ScriptArchUtils scriptArchUtils, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { return new DefaultScriptedEventFactory(scriptArchUtils, "sub_type", gameObjectFactory, scriptedEventEditor, archetypeSet); } @@ -468,7 +469,7 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { return mainControl.createGUIMainControl(GuiFileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, ... [truncated message content] |
From: <aki...@us...> - 2011-12-17 07:26:07
|
Revision: 9127 http://gridarta.svn.sourceforge.net/gridarta/?rev=9127&view=rev Author: akirschbaum Date: 2011-12-17 07:26:00 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2011-12-17 07:26:00 UTC (rev 9127) @@ -25,7 +25,6 @@ import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * The <code>ArchetypeSet</code> contains all the Archetypes. @@ -41,16 +40,7 @@ * @param faceObjectProviders the face object providers */ public ArchetypeSet(@NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, faceObjectProviders); + super(archetypeFactory, null, faceObjectProviders); } - /** - * {@inheritDoc} - */ - @Nullable - @Override - public String getImageSet() { - return null; - } - } // class ArchetypeSet Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2011-12-17 07:26:00 UTC (rev 9127) @@ -25,7 +25,6 @@ import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * The <code>ArchetypeSet</code> contains all the Archetypes. @@ -36,29 +35,13 @@ public class ArchetypeSet extends AbstractArchetypeSet<GameObject, MapArchObject, Archetype> { /** - * The image set to use. - */ - @Nullable - private final String imageSet; - - /** * Create the ArchetypeSet. * @param imageSet the image set to use * @param archetypeFactory the archetype factory to use * @param faceObjectProviders the face object providers */ public ArchetypeSet(@NotNull final String imageSet, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, faceObjectProviders); - this.imageSet = imageSet.equals("none") ? null : imageSet; + super(archetypeFactory, imageSet.equals("none") ? null : imageSet, faceObjectProviders); } - /** - * {@inheritDoc} - */ - @Nullable - @Override - public String getImageSet() { - return imageSet; - } - } // class ArchetypeSet Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java 2011-12-17 07:26:00 UTC (rev 9127) @@ -25,7 +25,6 @@ import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * The <code>ArchetypeSet</code> contains all the Archetypes. @@ -41,16 +40,7 @@ * @param faceObjectProviders the face object providers */ public ArchetypeSet(@NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, faceObjectProviders); + super(archetypeFactory, null, faceObjectProviders); } - /** - * {@inheritDoc} - */ - @Nullable - @Override - public String getImageSet() { - return null; - } - } // class ArchetypeSet Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2011-12-17 07:26:00 UTC (rev 9127) @@ -33,6 +33,7 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Base implementation of ArchetypeSet. @@ -47,6 +48,12 @@ private final ArchetypeFactory<G, A, R> archetypeFactory; /** + * The image set to use. + */ + @Nullable + private final String imageSet; + + /** * The defined Archetypes mapped by name. */ private final Map<String, R> archetypeMap = new TreeMap<String, R>(); @@ -82,10 +89,12 @@ /** * Create an AbstractArchetypeSet. * @param archetypeFactory the archetype factory to use + * @param imageSet the image set to use * @param faceObjectProviders the face object providers */ - protected AbstractArchetypeSet(@NotNull final ArchetypeFactory<G, A, R> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { + protected AbstractArchetypeSet(@NotNull final ArchetypeFactory<G, A, R> archetypeFactory, @Nullable final String imageSet, @NotNull final FaceObjectProviders faceObjectProviders) { this.archetypeFactory = archetypeFactory; + this.imageSet = imageSet; final FaceObjectProvidersListener faceObjectProvidersListener = new FaceObjectProvidersListener() { @@ -101,7 +110,16 @@ /** * {@inheritDoc} */ + @Nullable @Override + public String getImageSet() { + return imageSet; + } + + /** + * {@inheritDoc} + */ + @Override public boolean isLoadedFromArchive() { return loadedFromArchive; } Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java 2011-12-17 07:26:00 UTC (rev 9127) @@ -23,7 +23,6 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * An {@link ArchetypeSet} implementation for testing purposes. @@ -37,16 +36,7 @@ * @param faceObjectProviders the face object providers */ public TestArchetypeSet(@NotNull final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, faceObjectProviders); + super(archetypeFactory, null, faceObjectProviders); } - /** - * {@inheritDoc} - */ - @Nullable - @Override - public String getImageSet() { - return null; - } - } // class TestArchetypeSet This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 07:20:01
|
Revision: 9126 http://gridarta.svn.sourceforge.net/gridarta/?rev=9126&view=rev Author: akirschbaum Date: 2011-12-17 07:19:53 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Split off ArchetypeSetCollectable from ArchetypeSet. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java Added Paths: ----------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -19,13 +19,9 @@ package net.sf.gridarta.var.atrinik.model.archetype; -import java.io.IOException; -import java.io.Writer; import net.sf.gridarta.model.archetype.AbstractArchetypeSet; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -45,77 +41,12 @@ * @param faceObjectProviders the face object providers */ public ArchetypeSet(@NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, IGUIConstants.ARCH_FILE, faceObjectProviders); + super(archetypeFactory, faceObjectProviders); } /** * {@inheritDoc} */ - @Override - protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - writeArchetype(out, archetype, true, gameObjectParser); - - // process the multi-part tails: - int result = 1; - for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - result++; - - out.append("More\n"); - writeArchetype(out, tail, false, gameObjectParser); - } - - return result; - } - - /** - * Writes an {@link Archetype}. - * @param writer the writer to write to - * @param archetype the archetype to write - * @param isHeadPart whether this part is the head part - * @param gameObjectParser the game object parser for writing the inventory - * @throws IOException if an I/O error occurs - */ - private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> archetype, final boolean isHeadPart, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); - - if (archetype.getMultiShapeID() > 0) { - writer.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); - } - if (archetype.getMultiPartNr() > 0) { - writer.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); - } - - if (archetype.getMsgText() != null) { - writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); - } - - if (isHeadPart) { - // special: add a string-attribute with the display-category - writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); - } - - writer.append(archetype.getObjectText()); - - if (isHeadPart) { - for (final GameObject inv : archetype) { - gameObjectParser.save(writer, inv); - } - } else { - // position of multi relative to head - if (archetype.getMultiX() != 0) { - writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); - } - if (archetype.getMultiY() != 0) { - writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); - } - } - - writer.append("end\n"); - } - - /** - * {@inheritDoc} - */ @Nullable @Override public String getImageSet() { Added: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java (rev 0) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -0,0 +1,108 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.var.atrinik.model.collectable; + +import java.io.IOException; +import java.io.Writer; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.collectable.AbstractArchetypeSetCollectable; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.var.atrinik.IGUIConstants; +import net.sf.gridarta.var.atrinik.model.archetype.Archetype; +import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; +import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; + +public class AtrinikArchetypeSetCollectable extends AbstractArchetypeSetCollectable<GameObject, MapArchObject, Archetype> { + + /** + * Creates a new instance. + * @param archetypeSet the archetype set to collect + */ + public AtrinikArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + super(archetypeSet, IGUIConstants.ARCH_FILE); + } + + /** + * {@inheritDoc} + */ + @Override + protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + writeArchetype(out, archetype, true, gameObjectParser); + + // process the multi-part tails: + int result = 1; + for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + result++; + + out.append("More\n"); + writeArchetype(out, tail, false, gameObjectParser); + } + + return result; + } + + /** + * Writes an {@link Archetype}. + * @param writer the writer to write to + * @param archetype the archetype to write + * @param isHeadPart whether this part is the head part + * @param gameObjectParser the game object parser for writing the inventory + * @throws IOException if an I/O error occurs + */ + private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> archetype, final boolean isHeadPart, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); + + if (archetype.getMultiShapeID() > 0) { + writer.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); + } + if (archetype.getMultiPartNr() > 0) { + writer.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); + } + + if (archetype.getMsgText() != null) { + writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); + } + + if (isHeadPart) { + // special: add a string-attribute with the display-category + writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); + } + + writer.append(archetype.getObjectText()); + + if (isHeadPart) { + for (final GameObject inv : archetype) { + gameObjectParser.save(writer, inv); + } + } else { + // position of multi relative to head + if (archetype.getMultiX() != 0) { + writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); + } + if (archetype.getMultiY() != 0) { + writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); + } + } + + writer.append("end\n"); + } + +} Property changes on: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/collectable/AtrinikArchetypeSetCollectable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -40,6 +40,7 @@ import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; +import net.sf.gridarta.var.atrinik.model.collectable.AtrinikArchetypeSetCollectable; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; import net.sf.japi.swing.misc.Progress; @@ -143,7 +144,7 @@ @Override protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); - collectedResourcesWriter.addCollectable(archetypeSet); + collectedResourcesWriter.addCollectable(new AtrinikArchetypeSetCollectable(archetypeSet)); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.write(progress, collectedDirectory); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -19,13 +19,9 @@ package net.sf.gridarta.var.crossfire.model.archetype; -import java.io.IOException; -import java.io.Writer; import net.sf.gridarta.model.archetype.AbstractArchetypeSet; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -52,71 +48,13 @@ * @param faceObjectProviders the face object providers */ public ArchetypeSet(@NotNull final String imageSet, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, IGUIConstants.ARCH_FILE, faceObjectProviders); + super(archetypeFactory, faceObjectProviders); this.imageSet = imageSet.equals("none") ? null : imageSet; } /** * {@inheritDoc} */ - @Override - protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - writeArchetype(out, archetype, true, gameObjectParser); - - // process the multi-part tails: - int result = 1; - for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - result++; - - out.append("More\n"); - writeArchetype(out, tail, false, gameObjectParser); - } - - return result; - } - - /** - * Writes an {@link Archetype}. - * @param writer the writer to write to - * @param archetype the archetype to write - * @param isHeadPart whether this part is the head part - * @param gameObjectParser the game object parser for writing the inventory - * @throws IOException if an I/O error occurs - */ - private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, ?, ?> archetype, final boolean isHeadPart, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); - - if (isHeadPart) { - // special: add a string-attribute with the display-category - writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); - - // add message text - if (archetype.getMsgText() != null) { - writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); - } - } - - writer.append(archetype.getObjectText()); - if (isHeadPart) { - for (final GameObject inv : archetype) { - gameObjectParser.save(writer, inv); - } - } else { - // position of multi relative to head - if (archetype.getMultiX() != 0) { - writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); - } - if (archetype.getMultiY() != 0) { - writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); - } - } - - writer.append("end\n"); - } - - /** - * {@inheritDoc} - */ @Nullable @Override public String getImageSet() { Added: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java (rev 0) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -0,0 +1,101 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.var.crossfire.model.collectable; + +import java.io.IOException; +import java.io.Writer; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.collectable.AbstractArchetypeSetCollectable; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.var.crossfire.IGUIConstants; +import net.sf.gridarta.var.crossfire.model.archetype.Archetype; +import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; +import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; + +public class CrossfireArchetypeSetCollectable extends AbstractArchetypeSetCollectable<GameObject, MapArchObject, Archetype> { + + /** + * Creates a new instance. + * @param archetypeSet the archetype set to collect + */ + public CrossfireArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + super(archetypeSet, IGUIConstants.ARCH_FILE); + } + + /** + * {@inheritDoc} + */ + @Override + protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + writeArchetype(out, archetype, true, gameObjectParser); + + // process the multi-part tails: + int result = 1; + for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + result++; + + out.append("More\n"); + writeArchetype(out, tail, false, gameObjectParser); + } + + return result; + } + + /** + * Writes an {@link Archetype}. + * @param writer the writer to write to + * @param archetype the archetype to write + * @param isHeadPart whether this part is the head part + * @param gameObjectParser the game object parser for writing the inventory + * @throws IOException if an I/O error occurs + */ + private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, ?, ?> archetype, final boolean isHeadPart, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); + + if (isHeadPart) { + // special: add a string-attribute with the display-category + writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); + + // add message text + if (archetype.getMsgText() != null) { + writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); + } + } + + writer.append(archetype.getObjectText()); + if (isHeadPart) { + for (final GameObject inv : archetype) { + gameObjectParser.save(writer, inv); + } + } else { + // position of multi relative to head + if (archetype.getMultiX() != 0) { + writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); + } + if (archetype.getMultiY() != 0) { + writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); + } + } + + writer.append("end\n"); + } + +} Property changes on: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/collectable/CrossfireArchetypeSetCollectable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -37,11 +37,12 @@ import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.resource.CollectedResourcesWriter; import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; +import net.sf.gridarta.var.crossfire.model.collectable.CrossfireArchetypeSetCollectable; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; @@ -149,7 +150,7 @@ @Override protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); - collectedResourcesWriter.addCollectable(archetypeSet); + collectedResourcesWriter.addCollectable(new CrossfireArchetypeSetCollectable(archetypeSet)); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.addCollectable(smoothFaces); Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -19,13 +19,9 @@ package net.sf.gridarta.var.daimonin.model.archetype; -import java.io.IOException; -import java.io.Writer; import net.sf.gridarta.model.archetype.AbstractArchetypeSet; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -45,72 +41,12 @@ * @param faceObjectProviders the face object providers */ public ArchetypeSet(@NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, IGUIConstants.ARCH_FILE, faceObjectProviders); + super(archetypeFactory, faceObjectProviders); } /** * {@inheritDoc} */ - @Override - protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - writeArchetype(out, archetype, true); - - // process the multi-part tails: - int result = 1; - for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - result++; - - out.append("More\n"); - writeArchetype(out, tail, false); - } - - return result; - } - - /** - * Writes an {@link Archetype}. - * @param writer the writer to write to - * @param archetype the archetype to write - * @param isHeadPart whether this part is the head part - * @throws IOException if an I/O error occurs - */ - private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> archetype, final boolean isHeadPart) throws IOException { - writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); - - if (archetype.getMultiShapeID() > 0) { - writer.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); - } - if (archetype.getMultiPartNr() > 0) { - writer.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); - } - - if (archetype.getMsgText() != null) { - writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); - } - - if (isHeadPart) { - // special: add a string-attribute with the display-category - writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); - } - - writer.append(archetype.getObjectText()); - - if (!isHeadPart) { - // position of multi relative to head - if (archetype.getMultiX() != 0) { - writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); - } - if (archetype.getMultiY() != 0) { - writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); - } - } - - writer.append("end\n"); - } - - /** - * {@inheritDoc} - */ @Nullable @Override public String getImageSet() { Added: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java (rev 0) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -0,0 +1,103 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.var.daimonin.model.collectable; + +import java.io.IOException; +import java.io.Writer; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.collectable.AbstractArchetypeSetCollectable; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.var.daimonin.IGUIConstants; +import net.sf.gridarta.var.daimonin.model.archetype.Archetype; +import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; +import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; + +public class DaimoninArchetypeSetCollectable extends AbstractArchetypeSetCollectable<GameObject, MapArchObject, Archetype> { + + /** + * Creates a new instance. + * @param archetypeSet the archetype set to collect + */ + public DaimoninArchetypeSetCollectable(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + super(archetypeSet, IGUIConstants.ARCH_FILE); + } + + /** + * {@inheritDoc} + */ + @Override + protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + writeArchetype(out, archetype, true); + + // process the multi-part tails: + int result = 1; + for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + result++; + + out.append("More\n"); + writeArchetype(out, tail, false); + } + + return result; + } + + /** + * Writes an {@link Archetype}. + * @param writer the writer to write to + * @param archetype the archetype to write + * @param isHeadPart whether this part is the head part + * @throws IOException if an I/O error occurs + */ + private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> archetype, final boolean isHeadPart) throws IOException { + writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); + + if (archetype.getMultiShapeID() > 0) { + writer.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); + } + if (archetype.getMultiPartNr() > 0) { + writer.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); + } + + if (archetype.getMsgText() != null) { + writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); + } + + if (isHeadPart) { + // special: add a string-attribute with the display-category + writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); + } + + writer.append(archetype.getObjectText()); + + if (!isHeadPart) { + // position of multi relative to head + if (archetype.getMultiX() != 0) { + writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); + } + if (archetype.getMultiY() != 0) { + writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); + } + } + + writer.append("end\n"); + } + +} Property changes on: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/collectable/DaimoninArchetypeSetCollectable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -40,6 +40,7 @@ import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; +import net.sf.gridarta.var.daimonin.model.collectable.DaimoninArchetypeSetCollectable; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; import net.sf.japi.swing.misc.Progress; @@ -143,7 +144,7 @@ @Override protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); - collectedResourcesWriter.addCollectable(archetypeSet); + collectedResourcesWriter.addCollectable(new DaimoninArchetypeSetCollectable(archetypeSet)); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.write(progress, collectedDirectory); Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -19,12 +19,6 @@ package net.sf.gridarta.model.archetype; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; @@ -36,14 +30,8 @@ import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjectProvidersListener; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.EventListenerList2; -import net.sf.gridarta.utils.IOUtils; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; /** @@ -53,23 +41,12 @@ public abstract class AbstractArchetypeSet<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements ArchetypeSet<G, A, R> { /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The archetype factory to use. */ @NotNull private final ArchetypeFactory<G, A, R> archetypeFactory; /** - * The collected archetype file name. - */ - @NotNull - private final String archFile; - - /** * The defined Archetypes mapped by name. */ private final Map<String, R> archetypeMap = new TreeMap<String, R>(); @@ -105,12 +82,10 @@ /** * Create an AbstractArchetypeSet. * @param archetypeFactory the archetype factory to use - * @param archFile the collected archetypes file name * @param faceObjectProviders the face object providers */ - protected AbstractArchetypeSet(@NotNull final ArchetypeFactory<G, A, R> archetypeFactory, @NotNull final String archFile, @NotNull final FaceObjectProviders faceObjectProviders) { + protected AbstractArchetypeSet(@NotNull final ArchetypeFactory<G, A, R> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { this.archetypeFactory = archetypeFactory; - this.archFile = archFile; final FaceObjectProvidersListener faceObjectProvidersListener = new FaceObjectProvidersListener() { @@ -250,99 +225,4 @@ } } - /** - * {@inheritDoc} Collects the Archetypes. - */ - @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { - final File file = new File(collectedDirectory, archFile); - final FileOutputStream fos = new FileOutputStream(file); - try { - final OutputStreamWriter osw = new OutputStreamWriter(fos, IOUtils.MAP_ENCODING); - try { - final BufferedWriter out = new BufferedWriter(osw); - try { - collect(progress, out, gameObjectParser); - } finally { - out.close(); - } - } finally { - osw.close(); - } - } finally { - fos.close(); - } - } - - /** - * Collects the archetypes. - * @param progress the progress to report progress to - * @param writer the writer to write the archetypes to - * @param gameObjectParser the game object parser for writing inventory game - * objects - * @throws IOException in case of I/O problems during collection - */ - private void collect(@NotNull final Progress progress, @NotNull final Writer writer, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectArches"), archetypes.size()); - int artifactCount = 0; - int count = 0; - for (final R archetype : archetypes) { - if (archetype.isArtifact()) { - artifactCount++; - continue; - } - if (archetype.isUndefinedArchetype()) { - continue; - } - - if (archetype.isTail()) { - continue; - } - - if (archetype.getArchetypeName().equals(ArchetypeParser.START_ARCH_NAME)) { - collectStartArch(archetype, writer); - count++; - } else { - count += collectArchetype(archetype, writer, gameObjectParser); - } - - if (count % 100 == 0) { - progress.setValue(count); - } - } - - if ((count + artifactCount) - getArchetypeCount() != 0) { - ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectWarningMissed", getArchetypeCount() - count - artifactCount); - } - progress.setValue(archetypes.size()); - } - - /** - * Processes the special archetype {@link ArchetypeParser#START_ARCH_NAME}. - * @param archetype the archetype - * @param out the writer collecting into - * @throws IOException if an I/O error occurs - */ - private static void collectStartArch(@NotNull final Archetype<?, ?, ?> archetype, @NotNull final Writer out) throws IOException { - out.append("Object ").append(archetype.getArchetypeName()).append('\n'); - - if (archetype.getArchetypeName().equals(ArchetypeParser.START_ARCH_NAME)) { - out.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); - out.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); - } - - out.append(archetype.getObjectText()); - - out.append("end\n"); - } - - /** - * Collects an {@link Archetype}: writes its definition into a writer. - * @param archetype the archetype - * @param out the writer - * @return the number of archetype parts written - * @throws IOException if an I/O error occurs - */ - protected abstract int collectArchetype(@NotNull final R archetype, @NotNull final Writer out, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException; - } // class AbstractArchetypeSet Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.archetype; import java.util.Collection; -import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -31,7 +30,7 @@ * implementations. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface ArchetypeSet<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Collectable<G, A, R> { +public interface ArchetypeSet<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** * Returns whether the Archetypes in this ArchetypeSet were loaded from an Added: trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -0,0 +1,167 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.collectable; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.Collection; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetype.ArchetypeParser; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.gridarta.utils.IOUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.misc.Progress; +import org.jetbrains.annotations.NotNull; + +public abstract class AbstractArchetypeSetCollectable<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Collectable<G, A, R> { + + /** + * Action Builder. + */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The {@link ArchetypeSet} being collected. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The collected archetype file name. + */ + @NotNull + private final String archFile; + + /** + * Creates a new instance. + * @param archetypeSet the archetype set to collect + * @param archFile the collected archetypes file name + */ + protected AbstractArchetypeSetCollectable(@NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final String archFile) { + this.archetypeSet = archetypeSet; + this.archFile = archFile; + } + + /** + * {@inheritDoc} Collects the Archetypes. + */ + @Override + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + final File file = new File(collectedDirectory, archFile); + final FileOutputStream fos = new FileOutputStream(file); + try { + final OutputStreamWriter osw = new OutputStreamWriter(fos, IOUtils.MAP_ENCODING); + try { + final BufferedWriter out = new BufferedWriter(osw); + try { + collect(progress, out, gameObjectParser); + } finally { + out.close(); + } + } finally { + osw.close(); + } + } finally { + fos.close(); + } + } + + /** + * Collects the archetypes. + * @param progress the progress to report progress to + * @param writer the writer to write the archetypes to + * @param gameObjectParser the game object parser for writing inventory game + * objects + * @throws IOException in case of I/O problems during collection + */ + private void collect(@NotNull final Progress progress, @NotNull final Writer writer, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + final Collection<R> archetypes = archetypeSet.getArchetypes(); + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectArches"), archetypes.size()); + int artifactCount = 0; + int count = 0; + for (final R archetype : archetypes) { + if (archetype.isArtifact()) { + artifactCount++; + continue; + } + if (archetype.isUndefinedArchetype()) { + continue; + } + + if (archetype.isTail()) { + continue; + } + + if (archetype.getArchetypeName().equals(ArchetypeParser.START_ARCH_NAME)) { + collectStartArch(archetype, writer); + count++; + } else { + count += collectArchetype(archetype, writer, gameObjectParser); + } + + if (count % 100 == 0) { + progress.setValue(count); + } + } + + if ((count + artifactCount) - archetypeSet.getArchetypeCount() != 0) { + ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectWarningMissed", archetypeSet.getArchetypeCount() - count - artifactCount); + } + progress.setValue(archetypes.size()); + } + + /** + * Processes the special archetype {@link ArchetypeParser#START_ARCH_NAME}. + * @param archetype the archetype + * @param out the writer collecting into + * @throws IOException if an I/O error occurs + */ + private static void collectStartArch(@NotNull final Archetype<?, ?, ?> archetype, @NotNull final Writer out) throws IOException { + out.append("Object ").append(archetype.getArchetypeName()).append('\n'); + + if (archetype.getArchetypeName().equals(ArchetypeParser.START_ARCH_NAME)) { + out.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); + out.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); + } + + out.append(archetype.getObjectText()); + + out.append("end\n"); + } + + /** + * Collects an {@link Archetype}: writes its definition into a writer. + * @param archetype the archetype + * @param out the writer + * @return the number of archetype parts written + * @throws IOException if an I/O error occurs + */ + protected abstract int collectArchetype(@NotNull final R archetype, @NotNull final Writer out, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException; + +} Property changes on: trunk/model/src/app/net/sf/gridarta/model/collectable/AbstractArchetypeSetCollectable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -194,7 +194,7 @@ final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final TestArchetypeBuilder archetypeBuilder = new TestArchetypeBuilder(gameObjectFactory); final TestArchetypeFactory archetypeFactory = new TestArchetypeFactory(); - archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes", faceObjectProviders); + archetypeSet = new TestArchetypeSet(archetypeFactory, faceObjectProviders); archetypeSet.setLoadedFromArchive(true); assert archetypeSet != null; return new TestArchetypeParser(archetypeBuilder, animationObjects, archetypeSet); Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -19,11 +19,8 @@ package net.sf.gridarta.model.archetype; -import java.io.IOException; -import java.io.Writer; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -37,24 +34,15 @@ /** * Create an AbstractArchetypeSet. * @param archetypeFactory the archetype factory to use - * @param archFile the collected archetypes file name * @param faceObjectProviders the face object providers */ - public TestArchetypeSet(@NotNull final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory, @NotNull final String archFile, @NotNull final FaceObjectProviders faceObjectProviders) { - super(archetypeFactory, archFile, faceObjectProviders); + public TestArchetypeSet(@NotNull final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory, @NotNull final FaceObjectProviders faceObjectProviders) { + super(archetypeFactory, faceObjectProviders); } /** * {@inheritDoc} */ - @Override - protected int collectArchetype(@NotNull final TestArchetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser) throws IOException { - throw new AssertionError(); - } - - /** - * {@inheritDoc} - */ @Nullable @Override public String getImageSet() { Modified: trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -105,7 +105,7 @@ final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); - archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes", faceObjectProviders); + archetypeSet = new TestArchetypeSet(archetypeFactory, faceObjectProviders); final TestArchetypeBuilder archetypeBuilder = new TestArchetypeBuilder(gameObjectFactory); final AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype, TestArchetypeBuilder> archetypeParser = new TestArchetypeParser(archetypeBuilder, animationObjects, archetypeSet); final List<TestGameObject> invObjects = new ArrayList<TestGameObject>(); Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -143,7 +143,7 @@ final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory = new TestArchetypeFactory(); - archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes", faceObjectProviders); + archetypeSet = new TestArchetypeSet(archetypeFactory, faceObjectProviders); gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); insertionModeSet = new InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype>(topmostInsertionMode, new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher()); Modified: trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java 2011-12-17 06:48:30 UTC (rev 9125) +++ trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java 2011-12-17 07:19:53 UTC (rev 9126) @@ -167,7 +167,7 @@ final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); - final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet = new TestArchetypeSet(archetypeFactory, new File(collectedDirectory, "archetypes").getPath(), faceObjectProviders); + final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet = new TestArchetypeSet(archetypeFactory, faceObjectProviders); final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final TestArchetypeBuilder archetypeBuilder = new TestArchetypeBuilder(gameObjectFactory); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 06:48:38
|
Revision: 9125 http://gridarta.svn.sourceforge.net/gridarta/?rev=9125&view=rev Author: akirschbaum Date: 2011-12-17 06:48:30 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Move SmoothFaces into model module. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/model/src/app/net/sf/gridarta/model/smoothface/DuplicateSmoothFaceException.java trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFace.java trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFaces.java trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFacesLoader.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/smoothface/ Removed Paths: ------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/ Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -31,7 +31,7 @@ import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; +import net.sf.gridarta.model.smoothface.SmoothFaces; import org.jetbrains.annotations.NotNull; /** @@ -57,7 +57,7 @@ * The {@link SmoothFaces} to use. */ @NotNull - private final SmoothFaces smoothFaces; + private final SmoothFaces<?, ?, ?> smoothFaces; /** * The {@link GridMapSquarePainter} to use. @@ -95,7 +95,7 @@ * faces * @param systemIcons the system icons for creating icons */ - public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final SmoothFaces smoothFaces, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { + public DefaultRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final SmoothFaces<?, ?, ?> smoothFaces, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { this.mapViewSettings = mapViewSettings; this.filterControl = filterControl; this.smoothFaces = smoothFaces; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -30,7 +30,7 @@ import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; +import net.sf.gridarta.model.smoothface.SmoothFaces; import org.jetbrains.annotations.NotNull; /** @@ -68,7 +68,7 @@ * The {@link SmoothFaces} to use. */ @NotNull - private final SmoothFaces smoothFaces; + private final SmoothFaces<?, ?, ?> smoothFaces; /** * The {@link FaceObjectProviders} for looking up faces. @@ -92,7 +92,7 @@ * @param faceObjectProviders the face object providers for looking up * faces */ - protected SmoothingRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final SmoothFaces smoothFaces, @NotNull final FaceObjectProviders faceObjectProviders) { + protected SmoothingRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final SmoothFaces<?, ?, ?> smoothFaces, @NotNull final FaceObjectProviders faceObjectProviders) { this.mapModel = mapModel; this.smoothFaces = smoothFaces; this.faceObjectProviders = faceObjectProviders; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -113,7 +113,7 @@ import net.sf.gridarta.var.crossfire.model.mapcontrol.DefaultMapControlFactory; import net.sf.gridarta.var.crossfire.model.scripts.DefaultScriptedEventFactory; import net.sf.gridarta.var.crossfire.model.settings.DefaultGlobalSettings; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.var.crossfire.resource.DefaultResources; import net.sf.japi.swing.prefs.PreferencesGroup; import org.apache.log4j.Category; @@ -141,7 +141,7 @@ * The {@link SmoothFaces} instance. */ @Nullable - private SmoothFaces smoothFaces = null; + private SmoothFaces<GameObject, MapArchObject, Archetype> smoothFaces = null; /** * {@inheritDoc} @@ -249,7 +249,7 @@ if (smoothFaces != null) { throw new IllegalStateException(); } - smoothFaces = new SmoothFaces(faceObjects); + smoothFaces = new SmoothFaces<GameObject, MapArchObject, Archetype>(faceObjects, IGUIConstants.SMOOTH_FILE); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -32,9 +32,9 @@ import net.sf.gridarta.utils.StringUtils; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import net.sf.gridarta.var.crossfire.model.smoothface.DuplicateSmoothFaceException; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFace; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; +import net.sf.gridarta.model.smoothface.DuplicateSmoothFaceException; +import net.sf.gridarta.model.smoothface.SmoothFace; +import net.sf.gridarta.model.smoothface.SmoothFaces; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -81,7 +81,7 @@ * The {@link SmoothFaces} instance to update. */ @NotNull - private final SmoothFaces smoothFaces; + private final SmoothFaces<?, ?, ?> smoothFaces; /** * Creates an ArchetypeParser. @@ -91,7 +91,7 @@ * @param gameObjectFactory the factory for creating game objects * @param smoothFaces the smooth faces instance to update */ - public ArchetypeParser(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SmoothFaces smoothFaces) { + public ArchetypeParser(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SmoothFaces<?, ?, ?> smoothFaces) { super(new DefaultArchetypeBuilder(gameObjectFactory), animationObjects, archetypeSet); this.gameObjectParser = gameObjectParser; this.smoothFaces = smoothFaces; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -36,8 +36,8 @@ import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFacesLoader; +import net.sf.gridarta.model.smoothface.SmoothFaces; +import net.sf.gridarta.model.smoothface.SmoothFacesLoader; import org.jetbrains.annotations.NotNull; /** @@ -56,7 +56,7 @@ * The smooth faces to update. */ @NotNull - private final SmoothFaces smoothFaces; + private final SmoothFaces<?, ?, ?> smoothFaces; /** * Creates a new instance. @@ -68,7 +68,7 @@ * @param animationObjects the animation objects instance * @param smoothFaces the smooth faces to update */ - public CollectedResourcesReader(@NotNull final File configurationDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final SmoothFaces smoothFaces) { + public CollectedResourcesReader(@NotNull final File configurationDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final SmoothFaces<?, ?, ?> smoothFaces) { super(collectedDirectory, archetypeSet.getImageSet(), archetypeSet, archetypeParser, animationObjects, faceObjects, IGUIConstants.ANIMTREE_FILE, IGUIConstants.ARCH_FILE); this.configurationDirectory = configurationDirectory; this.smoothFaces = smoothFaces; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -41,7 +41,7 @@ import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; @@ -85,7 +85,7 @@ * The {@link SmoothFaces} instance. */ @NotNull - private final SmoothFaces smoothFaces; + private final SmoothFaces<GameObject, MapArchObject, Archetype> smoothFaces; /** * The {@link ArchFaceProvider} to use. @@ -112,7 +112,7 @@ * @param faceObjectProviders the face object providers for looking up * faces */ - public DefaultResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final SmoothFaces smoothFaces, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public DefaultResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final SmoothFaces<GameObject, MapArchObject, Archetype> smoothFaces, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { super(gameObjectParser, archetypeSet, mapViewSettings); this.gameObjectParser = gameObjectParser; this.archetypeSet = archetypeSet; Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -31,13 +31,14 @@ import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.gameobject.DefaultGameObjectFactory; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.io.DefaultGameObjectParser; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -108,7 +109,7 @@ assert archetypeSet != null; final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, archetypeSet); assert archetypeSet != null; - final SmoothFaces smoothFaces = new SmoothFaces(faceObjects); + final SmoothFaces<?, ?, ?> smoothFaces = new SmoothFaces<GameObject, MapArchObject, Archetype>(faceObjects, IGUIConstants.SMOOTH_FILE); assert archetypeSet != null; return new ArchetypeParser(gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, smoothFaces); } Modified: trunk/model/src/app/net/sf/gridarta/model/smoothface/DuplicateSmoothFaceException.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/DuplicateSmoothFaceException.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/model/src/app/net/sf/gridarta/model/smoothface/DuplicateSmoothFaceException.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.var.crossfire.model.smoothface; +package net.sf.gridarta.model.smoothface; import org.jetbrains.annotations.NotNull; Modified: trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFace.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/SmoothFace.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFace.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.var.crossfire.model.smoothface; +package net.sf.gridarta.model.smoothface; import org.jetbrains.annotations.NotNull; Modified: trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFaces.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/SmoothFaces.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFaces.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.var.crossfire.model.smoothface; +package net.sf.gridarta.model.smoothface; import java.io.BufferedWriter; import java.io.File; @@ -26,15 +26,14 @@ import java.io.OutputStreamWriter; import java.util.Map; import java.util.TreeMap; +import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.model.face.FaceObject; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.IOUtils; -import net.sf.gridarta.var.crossfire.IGUIConstants; -import net.sf.gridarta.var.crossfire.model.archetype.Archetype; -import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; -import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -43,7 +42,7 @@ * Collection of all smoothing information. * @author Andreas Kirschbaum */ -public class SmoothFaces implements Collectable<GameObject, MapArchObject, Archetype> { +public class SmoothFaces<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Collectable<G, A, R> { /** * The defined {@link SmoothFaces}. @@ -55,22 +54,26 @@ * The {@link FaceObjects} for looking up faces. */ @NotNull - private final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects; + private final FaceObjects<G, A, R> faceObjects; + @NotNull + private final String smoothFile; + /** * Creates a new instance. * @param faceObjects the face objects for looking up faces */ - public SmoothFaces(@NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects) { + public SmoothFaces(@NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final String smoothFile) { this.faceObjects = faceObjects; + this.smoothFile = smoothFile; } /** * {@inheritDoc} */ @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, IGUIConstants.SMOOTH_FILE)); + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, smoothFile)); try { final OutputStreamWriter osw = new OutputStreamWriter(fos, IOUtils.MAP_ENCODING); try { @@ -117,7 +120,7 @@ * attached smooth face */ @Nullable - public FaceObject getSmoothFace(@NotNull final net.sf.gridarta.model.gameobject.GameObject<?, ?, ?> gameObject) { + public FaceObject getSmoothFace(@NotNull final GameObject<?, ?, ?> gameObject) { String faceName = gameObject.getFaceName(); if (faceName == null) { faceName = gameObject.getArchetype().getFaceName(); Modified: trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFacesLoader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/SmoothFacesLoader.java 2011-12-17 06:31:05 UTC (rev 9124) +++ trunk/model/src/app/net/sf/gridarta/model/smoothface/SmoothFacesLoader.java 2011-12-17 06:48:30 UTC (rev 9125) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.var.crossfire.model.smoothface; +package net.sf.gridarta.model.smoothface; import java.io.BufferedReader; import java.io.IOException; @@ -30,7 +30,6 @@ import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.utils.IOUtils; -import net.sf.gridarta.var.crossfire.IGUIConstants; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -59,7 +58,7 @@ * @param smoothFaces the smooth faces to update * @param errorView the error view for reporting errors */ - public static void load(@NotNull final URL url, @NotNull final SmoothFaces smoothFaces, @NotNull final ErrorView errorView) { + public static void load(@NotNull final URL url, @NotNull final SmoothFaces<?, ?, ?> smoothFaces, @NotNull final ErrorView errorView) { final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, url); try { final InputStream inputStream = url.openStream(); @@ -91,7 +90,7 @@ * @param errorViewCollector the error view collector for reporting errors * @throws IOException if loadings fails */ - private static void load(@NotNull final String readerName, @NotNull final Reader reader, @NotNull final SmoothFaces smoothFaces, @NotNull final ErrorViewCollector errorViewCollector) throws IOException { + private static void load(@NotNull final String readerName, @NotNull final Reader reader, @NotNull final SmoothFaces<?, ?, ?> smoothFaces, @NotNull final ErrorViewCollector errorViewCollector) throws IOException { int smoothEntries = 0; final BufferedReader bufferedReader = new BufferedReader(reader); try { @@ -102,7 +101,7 @@ } final String[] elements = pattern.split(line); if (elements.length != 2) { - log.warn("Error reading " + IGUIConstants.SMOOTH_FILE + ": " + line); + errorViewCollector.addWarning(ErrorViewCategory.SMOOTH_FILE_INVALID, "syntax error in line " + line); return; } final SmoothFace smoothFace = new SmoothFace(elements[0], elements[1]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 06:31:14
|
Revision: 9124 http://gridarta.svn.sourceforge.net/gridarta/?rev=9124&view=rev Author: akirschbaum Date: 2011-12-17 06:31:05 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Split off FaceObjectsCollectable from DefaultFaceObjects. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjects.java trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -267,7 +267,7 @@ @NotNull @Override public FaceObjects<GameObject, MapArchObject, Archetype> createFaceObjects(@NotNull final ArchFaceProvider archFaceProvider) { - return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(archFaceProvider, true); + return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(true); } /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -28,6 +28,7 @@ import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.artifact.ArtifactParser; import net.sf.gridarta.model.collectable.AnimationObjectsCollectable; +import net.sf.gridarta.model.collectable.FaceObjectsCollectable; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -144,7 +145,7 @@ final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); collectedResourcesWriter.addCollectable(archetypeSet); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); - collectedResourcesWriter.addCollectable(faceObjects); + collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.write(progress, collectedDirectory); } Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -28,7 +28,6 @@ import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; @@ -139,8 +138,7 @@ @NotNull @Override protected AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ? extends AbstractArchetypeBuilder<GameObject, MapArchObject, Archetype>> newArchetypeParser() { - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects = new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(archFaceProvider, true); + final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects = new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(true); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -238,7 +238,7 @@ @NotNull @Override public FaceObjects<GameObject, MapArchObject, Archetype> createFaceObjects(@NotNull final ArchFaceProvider archFaceProvider) { - return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(archFaceProvider, false); + return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(false); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -27,6 +27,7 @@ import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.collectable.AnimationObjectsCollectable; +import net.sf.gridarta.model.collectable.FaceObjectsCollectable; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -150,7 +151,7 @@ final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); collectedResourcesWriter.addCollectable(archetypeSet); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); - collectedResourcesWriter.addCollectable(faceObjects); + collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.addCollectable(smoothFaces); collectedResourcesWriter.write(progress, collectedDirectory); } Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -27,7 +27,6 @@ import net.sf.gridarta.model.archetype.AbstractArchetypeParserTest; import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; @@ -97,8 +96,7 @@ @NotNull @Override protected AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ? extends AbstractArchetypeBuilder<GameObject, MapArchObject, Archetype>> newArchetypeParser() { - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects = new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(archFaceProvider, false); + final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects = new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(false); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -21,7 +21,6 @@ import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.DefaultAnimationObjects; -import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; @@ -60,8 +59,7 @@ * Creates a new instance. */ public GameObjectCreator() { - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects = new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(archFaceProvider, false); + final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects = new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(false); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -267,7 +267,7 @@ @NotNull @Override public FaceObjects<GameObject, MapArchObject, Archetype> createFaceObjects(@NotNull final ArchFaceProvider archFaceProvider) { - return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(archFaceProvider, true); + return new DefaultFaceObjects<GameObject, MapArchObject, Archetype>(true); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -28,6 +28,7 @@ import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.artifact.ArtifactParser; import net.sf.gridarta.model.collectable.AnimationObjectsCollectable; +import net.sf.gridarta.model.collectable.FaceObjectsCollectable; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -144,7 +145,7 @@ final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); collectedResourcesWriter.addCollectable(archetypeSet); collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); - collectedResourcesWriter.addCollectable(faceObjects); + collectedResourcesWriter.addCollectable(new FaceObjectsCollectable<GameObject, MapArchObject, Archetype>(faceObjects, archFaceProvider)); collectedResourcesWriter.write(progress, collectedDirectory); } Added: trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -0,0 +1,201 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.collectable; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; +import java.nio.charset.Charset; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.face.ArchFaceProvider; +import net.sf.gridarta.model.face.FaceObject; +import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.misc.Progress; +import org.jetbrains.annotations.NotNull; + +public class FaceObjectsCollectable<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Collectable<G, A, R> { + + /** + * Action Builder. + */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The {@link FaceObjects} being collected. + */ + @NotNull + private final FaceObjects<G, A, R> faceObjects; + + /** + * The {@link ArchFaceProvider} to use for collection. + */ + @NotNull + private final ArchFaceProvider archFaceProvider; + + /** + * Creates a new instance. + * @param faceObjects the face objects to collect + * @param archFaceProvider the arch face provider to use + */ + public FaceObjectsCollectable(@NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final ArchFaceProvider archFaceProvider) { + this.faceObjects = faceObjects; + this.archFaceProvider = archFaceProvider; + } + + /** + * {@inheritDoc} Collects the faces. The graphics information is written to + * "crossfire.0" resp. "daimonin.0". The meta information (offsets etc.) is + * written to "bmaps". The tree information for the editor is written to + * "bmaps.paths" resp. "facetree". <p/> Theoretically it would also be + * possible to recode the images. But the Java image encoder isn't as good + * as that of gimp in many cases (yet much better as the old visualtek's). + */ + @Override + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + collectTreeFile(progress, collectedDirectory); + collectBmapsFile(progress, collectedDirectory); + collectImageFile(progress, collectedDirectory); + } + + /** + * Creates the image file. + * @param progress the progress to report progress to + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectImageFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + final File file = new File(collectedDirectory, ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.image.name")); + final FileOutputStream fos = new FileOutputStream(file); + try { + final FileChannel outChannel = fos.getChannel(); + try { + final int numOfFaceObjects = faceObjects.size(); + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectImages"), numOfFaceObjects); + final ByteBuffer byteBuffer = ByteBuffer.allocate(1024); + final Charset charset = Charset.forName("ISO-8859-1"); + int i = 0; + for (final FaceObject faceObject : faceObjects) { + final String face = faceObject.getFaceName(); + final String path = archFaceProvider.getFilename(face); + try { + final FileInputStream fin = new FileInputStream(path); + try { + final FileChannel inChannel = fin.getChannel(); + final long imageSize = inChannel.size(); + byteBuffer.clear(); + byteBuffer.put(("IMAGE " + (faceObjects.isIncludeFaceNumbers() ? i + " " : "") + imageSize + " " + face + "\n").getBytes(charset)); + byteBuffer.flip(); + outChannel.write(byteBuffer); + inChannel.transferTo(0L, imageSize, outChannel); + } finally { + fin.close(); + } + } catch (final FileNotFoundException ignored) { + ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorFileNotFound", path); + return; + } catch (final IOException e) { + ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorIOException", path, e); + return; + } + + if (i++ % 100 == 0) { + progress.setValue(i); + } + } + progress.setValue(faceObjects.size()); // finished + } finally { + outChannel.close(); + } + } finally { + fos.close(); + } + } + + /** + * Creates the tree file. + * @param progress the progress to report progress to + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectTreeFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + collectFile(progress, new File(collectedDirectory, ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.facetree.name")), ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectTree"), ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.facetree.output")); + } + + /** + * Creates the bmaps file. + * @param progress the progress to report progress to + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectBmapsFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + collectFile(progress, new File(collectedDirectory, ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.face.name")), ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectBmaps"), ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.face.output")); + } + + /** + * Creates an output file containing all faces. + * @param progress the process to report progress to + * @param file the output file to write + * @param label the progress label + * @param format the format string for writing the output file + * @throws IOException if an I/O error occurs + */ + private void collectFile(@NotNull final Progress progress, @NotNull final File file, @NotNull final String label, @NotNull final String format) throws IOException { + final FileOutputStream fos = new FileOutputStream(file); + try { + final OutputStreamWriter osw = new OutputStreamWriter(fos); + try { + final BufferedWriter bw = new BufferedWriter(osw); + try { + final int numOfFaceObjects = faceObjects.size(); + progress.setLabel(label, numOfFaceObjects); + int i = 0; + for (final FaceObject faceObject : faceObjects) { + final String path = faceObject.getPath(); + final String face = faceObject.getFaceName(); + bw.append(String.format(format, i, path, face)).append('\n'); + if (i++ % 100 == 0) { + progress.setValue(i); + } + } + progress.setValue(numOfFaceObjects); + } finally { + bw.close(); + } + } finally { + osw.close(); + } + } finally { + fos.close(); + } + } + +} Property changes on: trunk/model/src/app/net/sf/gridarta/model/collectable/FaceObjectsCollectable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -20,21 +20,15 @@ package net.sf.gridarta.model.face; import java.io.BufferedReader; -import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.OutputStreamWriter; import java.io.Reader; import java.net.URL; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.charset.Charset; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sf.gridarta.model.archetype.Archetype; @@ -42,14 +36,12 @@ import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.ArrayUtils; import net.sf.gridarta.utils.IOUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.misc.Progress; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -81,154 +73,19 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** - * The {@link ArchFaceProvider} to use for collection. - */ - @NotNull - private final ArchFaceProvider archFaceProvider; - - /** * Whether the face file contains face numbers. */ private final boolean includeFaceNumbers; /** * Creates a new instance. - * @param archFaceProvider the arch face provider to use for collection * @param includeFaceNumbers whether the face file contains face numbers */ - public DefaultFaceObjects(@NotNull final ArchFaceProvider archFaceProvider, final boolean includeFaceNumbers) { + public DefaultFaceObjects(final boolean includeFaceNumbers) { super(ActionBuilderUtils.getString(ACTION_BUILDER, "nameOfFaceObject")); - this.archFaceProvider = archFaceProvider; this.includeFaceNumbers = includeFaceNumbers; } - /** - * {@inheritDoc} Collects the faces. The graphics information is written to - * "crossfire.0" resp. "daimonin.0". The meta information (offsets etc.) is - * written to "bmaps". The tree information for the editor is written to - * "bmaps.paths" resp. "facetree". <p/> Theoretically it would also be - * possible to recode the images. But the Java image encoder isn't as good - * as that of gimp in many cases (yet much better as the old visualtek's). - */ - @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { - collectTreeFile(progress, collectedDirectory); - collectBmapsFile(progress, collectedDirectory); - collectImageFile(progress, collectedDirectory); - } - - /** - * Creates the image file. - * @param progress the progress to report progress to - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectImageFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - final File file = new File(collectedDirectory, ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.image.name")); - final FileOutputStream fos = new FileOutputStream(file); - try { - final FileChannel outChannel = fos.getChannel(); - try { - final int numOfFaceObjects = size(); - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectImages"), numOfFaceObjects); - final ByteBuffer byteBuffer = ByteBuffer.allocate(1024); - final Charset charset = Charset.forName("ISO-8859-1"); - int i = 0; - for (final FaceObject faceObject : this) { - final String face = faceObject.getFaceName(); - final String path = archFaceProvider.getFilename(face); - try { - final FileInputStream fin = new FileInputStream(path); - try { - final FileChannel inChannel = fin.getChannel(); - final long imageSize = inChannel.size(); - byteBuffer.clear(); - byteBuffer.put(("IMAGE " + (includeFaceNumbers ? i + " " : "") + imageSize + " " + face + "\n").getBytes(charset)); - byteBuffer.flip(); - outChannel.write(byteBuffer); - inChannel.transferTo(0L, imageSize, outChannel); - } finally { - fin.close(); - } - } catch (final FileNotFoundException ignored) { - ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorFileNotFound", path); - return; - } catch (final IOException e) { - ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorIOException", path, e); - return; - } - - if (i++ % 100 == 0) { - progress.setValue(i); - } - } - progress.setValue(size()); // finished - } finally { - outChannel.close(); - } - } finally { - fos.close(); - } - } - - /** - * Creates the tree file. - * @param progress the progress to report progress to - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectTreeFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - collectFile(progress, new File(collectedDirectory, ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.facetree.name")), ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectTree"), ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.facetree.output")); - } - - /** - * Creates the bmaps file. - * @param progress the progress to report progress to - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectBmapsFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - collectFile(progress, new File(collectedDirectory, ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.face.name")), ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectBmaps"), ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.face.output")); - } - - /** - * Creates an output file containing all faces. - * @param progress the process to report progress to - * @param file the output file to write - * @param label the progress label - * @param format the format string for writing the output file - * @throws IOException if an I/O error occurs - */ - private void collectFile(@NotNull final Progress progress, @NotNull final File file, @NotNull final String label, @NotNull final String format) throws IOException { - final FileOutputStream fos = new FileOutputStream(file); - try { - final OutputStreamWriter osw = new OutputStreamWriter(fos); - try { - final BufferedWriter bw = new BufferedWriter(osw); - try { - final int numOfFaceObjects = size(); - progress.setLabel(label, numOfFaceObjects); - int i = 0; - for (final FaceObject faceObject : this) { - final String path = faceObject.getPath(); - final String face = faceObject.getFaceName(); - bw.append(String.format(format, i, path, face)).append('\n'); - if (i++ % 100 == 0) { - progress.setValue(i); - } - } - progress.setValue(numOfFaceObjects); - } finally { - bw.close(); - } - } finally { - osw.close(); - } - } finally { - fos.close(); - } - } - @NotNull @Override public FaceProvider loadFacesCollection(@NotNull final ErrorView errorView, @NotNull final File collectedDirectory) { @@ -373,4 +230,13 @@ return bufOut.toByteArray(); } + /** + * Returns whether the images file contains face numbers. + * @return whether the images file contains face numbers + */ + @Override + public boolean isIncludeFaceNumbers() { + return includeFaceNumbers; + } + } // class DefaultFaceObjects Modified: trunk/model/src/app/net/sf/gridarta/model/face/FaceObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/FaceObjects.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/model/src/app/net/sf/gridarta/model/face/FaceObjects.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -21,7 +21,6 @@ import java.io.File; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.model.data.NamedObjects; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.gameobject.GameObject; @@ -32,7 +31,7 @@ * FaceObjects is a container for {@link FaceObject FaceObjects}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface FaceObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Collectable<G, A, R>, NamedObjects<FaceObject> { +public interface FaceObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends NamedObjects<FaceObject> { /** * Loads all faces from a png collection file. @@ -57,4 +56,10 @@ */ void addFaceObject(String faceName, String originalFilename, int offset, int size) throws DuplicateFaceException, IllegalFaceException; + /** + * Returns whether the images file contains face numbers. + * @return whether the images file contains face numbers + */ + boolean isIncludeFaceNumbers(); + } // interface FaceObjects Modified: trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java 2011-12-17 06:15:21 UTC (rev 9123) +++ trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java 2011-12-17 06:31:05 UTC (rev 9124) @@ -20,13 +20,10 @@ package net.sf.gridarta.model.face; import java.io.File; -import java.io.IOException; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; /** @@ -60,8 +57,8 @@ * {@inheritDoc} */ @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser) throws IOException { - throw new AssertionError(); + public boolean isIncludeFaceNumbers() { + return false; } } // class TestFaceObjects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 06:15:29
|
Revision: 9123 http://gridarta.svn.sourceforge.net/gridarta/?rev=9123&view=rev Author: akirschbaum Date: 2011-12-17 06:15:21 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Remove EditorFactory.newAnimationObjects(). Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 06:08:25 UTC (rev 9122) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 06:15:21 UTC (rev 9123) @@ -45,7 +45,6 @@ import net.sf.gridarta.maincontrol.EditorFactory; import net.sf.gridarta.maincontrol.GUIMainControl; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; @@ -482,13 +481,4 @@ return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public AnimationObjects<GameObject, MapArchObject, Archetype> newAnimationObjects() { - return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); - } - } // class DefaultEditorFactory Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 06:08:25 UTC (rev 9122) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 06:15:21 UTC (rev 9123) @@ -43,7 +43,6 @@ import net.sf.gridarta.maincontrol.EditorFactory; import net.sf.gridarta.maincontrol.GUIMainControl; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; @@ -394,13 +393,4 @@ return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, smoothFaces, archFaceProvider, faceObjectProviders); } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public AnimationObjects<GameObject, MapArchObject, Archetype> newAnimationObjects() { - return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); - } - } // class DefaultEditorFactory Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 06:08:25 UTC (rev 9122) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 06:15:21 UTC (rev 9123) @@ -45,7 +45,6 @@ import net.sf.gridarta.maincontrol.EditorFactory; import net.sf.gridarta.maincontrol.GUIMainControl; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; @@ -482,13 +481,4 @@ return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public AnimationObjects<GameObject, MapArchObject, Archetype> newAnimationObjects() { - return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); - } - } // class DefaultEditorFactory Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2011-12-17 06:08:25 UTC (rev 9122) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2011-12-17 06:15:21 UTC (rev 9123) @@ -390,11 +390,4 @@ @NotNull AbstractResources<G, A, R> newResources(@NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AbstractArchetypeParser<G, A, R, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders); - /** - * Creates a new {@link AnimationObjects} instance. - * @return the new instance - */ - @NotNull - AnimationObjects<G, A, R> newAnimationObjects(); - } // class EditorFactory Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-12-17 06:08:25 UTC (rev 9122) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-12-17 06:15:21 UTC (rev 9123) @@ -45,6 +45,7 @@ import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.model.anim.AnimationObjects; +import net.sf.gridarta.model.anim.DefaultAnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeFactory; @@ -244,7 +245,7 @@ final int doubleFaceOffset = editorFactory.getDoubleFaceOffset(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(doubleFaceOffset, faceObjects, systemIcons); final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); - final AnimationObjects<G, A, R> animationObjects = editorFactory.newAnimationObjects(); + final AnimationObjects<G, A, R> animationObjects = new DefaultAnimationObjects<G, A, R>(); final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(globalSettings, archetypeFactory, faceObjectProviders); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-17 06:08:34
|
Revision: 9122 http://gridarta.svn.sourceforge.net/gridarta/?rev=9122&view=rev Author: akirschbaum Date: 2011-12-17 06:08:25 +0000 (Sat, 17 Dec 2011) Log Message: ----------- Split off AnimationObjectsCollectable from DefaultAnimationObjects. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -488,7 +488,7 @@ @NotNull @Override public AnimationObjects<GameObject, MapArchObject, Archetype> newAnimationObjects() { - return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(IGUIConstants.ANIMTREE_FILE); + return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); } } // class DefaultEditorFactory Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -27,6 +27,7 @@ import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.artifact.ArtifactParser; +import net.sf.gridarta.model.collectable.AnimationObjectsCollectable; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -142,7 +143,7 @@ protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); collectedResourcesWriter.addCollectable(archetypeSet); - collectedResourcesWriter.addCollectable(animationObjects); + collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(faceObjects); collectedResourcesWriter.write(progress, collectedDirectory); } Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -144,7 +144,7 @@ final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>("animtree"); + final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -400,7 +400,7 @@ @NotNull @Override public AnimationObjects<GameObject, MapArchObject, Archetype> newAnimationObjects() { - return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(IGUIConstants.ANIMTREE_FILE); + return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); } } // class DefaultEditorFactory Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.collectable.AnimationObjectsCollectable; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -35,6 +36,7 @@ import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.resource.CollectedResourcesWriter; import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; @@ -147,7 +149,7 @@ protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); collectedResourcesWriter.addCollectable(archetypeSet); - collectedResourcesWriter.addCollectable(animationObjects); + collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(faceObjects); collectedResourcesWriter.addCollectable(smoothFaces); collectedResourcesWriter.write(progress, collectedDirectory); Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -102,7 +102,7 @@ final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>("animtree"); + final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects); final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); archetypeSet = new ArchetypeSet("images", archetypeFactory, faceObjectProviders); Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/GameObjectCreator.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -65,7 +65,7 @@ final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); - animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>("animTreeFile"); + animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); archetype = new DefaultArchetype("arch", faceObjectProviders, animationObjects); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -488,7 +488,7 @@ @NotNull @Override public AnimationObjects<GameObject, MapArchObject, Archetype> newAnimationObjects() { - return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(IGUIConstants.ANIMTREE_FILE); + return new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>(); } } // class DefaultEditorFactory Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -27,6 +27,7 @@ import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.artifact.ArtifactParser; +import net.sf.gridarta.model.collectable.AnimationObjectsCollectable; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -142,7 +143,7 @@ protected void writeCollectedInt(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { final CollectedResourcesWriter<GameObject, MapArchObject, Archetype> collectedResourcesWriter = new CollectedResourcesWriter<GameObject, MapArchObject, Archetype>(gameObjectParser); collectedResourcesWriter.addCollectable(archetypeSet); - collectedResourcesWriter.addCollectable(animationObjects); + collectedResourcesWriter.addCollectable(new AnimationObjectsCollectable<GameObject, MapArchObject, Archetype>(animationObjects, IGUIConstants.ANIMTREE_FILE)); collectedResourcesWriter.addCollectable(faceObjects); collectedResourcesWriter.write(progress, collectedDirectory); } Modified: trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.anim; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.model.data.NamedObjects; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -31,7 +30,7 @@ * AnimationObjects}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface AnimationObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Collectable<G, A, R>, NamedObjects<AnimationObject> { +public interface AnimationObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends NamedObjects<AnimationObject> { /** * Add an animation object. Modified: trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -19,22 +19,12 @@ package net.sf.gridarta.model.anim; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.data.NamedObject; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.ActionBuilderUtils; -import net.sf.gridarta.utils.IOUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.misc.Progress; -import org.jetbrains.annotations.NotNull; /** * Abstract base implementation of {@link AnimationObjects}. @@ -53,76 +43,10 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** - * The collected animation tree file. - */ - @NotNull - private final String animTreeFile; - - /** * Creates a new instance. - * @param animTreeFile the collected animation tree file */ - public DefaultAnimationObjects(@NotNull final String animTreeFile) { + public DefaultAnimationObjects() { super(ActionBuilderUtils.getString(ACTION_BUILDER, "nameOfAnimationObject")); - this.animTreeFile = animTreeFile; } - /** - * {@inheritDoc} Collects the Animations. The animation data is written to - * "animations". The tree information for the editor is written to - * "animtree". - */ - @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { - collectAnimations(progress, collectedDirectory); - collectAnimTree(progress, collectedDirectory); - } - - /** - * Collects the animation data into the file "animations". - * @param progress the progress to report progress to - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectAnimations(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectAnimations"), size()); - final BufferedWriter animations = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(collectedDirectory, "animations")), IOUtils.MAP_ENCODING)); - try { - int counter = 0; // counter for progress bar - for (final AnimationObject anim : this) { - animations.append("anim ").append(anim.getAnimName()).append('\n').append(anim.getAnimList()).append("mina\n"); - if (counter++ % 128 == 0) { - progress.setValue(counter); - } - } - } finally { - animations.close(); - } - progress.setValue(size()); - } - - /** - * Collects the animation data into the file "animations". - * @param progress the progress to report progress to - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectAnimTree(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectAnimTree"), size()); - final BufferedWriter animtree = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(collectedDirectory, animTreeFile)), IOUtils.MAP_ENCODING)); - try { - int counter = 0; // counter for progress bar - for (final NamedObject anim : this) { - animtree.append(anim.getPath()).append('\n'); - if (counter++ % 128 == 0) { - progress.setValue(counter); - } - } - } finally { - animtree.close(); - } - progress.setValue(size()); - } - - } // class DefaultAnimationObjects Added: trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -0,0 +1,128 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.collectable; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import net.sf.gridarta.model.anim.AnimationObject; +import net.sf.gridarta.model.anim.AnimationObjects; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.data.NamedObject; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.gridarta.utils.IOUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.misc.Progress; +import org.jetbrains.annotations.NotNull; + +public class AnimationObjectsCollectable<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Collectable<G, A, R> { + + /** + * Action Builder. + */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The {@link AnimationObjects} being collected. + */ + @NotNull + private final AnimationObjects<G, A, R> animationObjects; + + /** + * The collected animation tree file. + */ + @NotNull + private final String animTreeFile; + + /** + * Creates a new instance. + * @param animationObjects the animation objects to be collected + * @param animTreeFile the collected animation tree file + */ + public AnimationObjectsCollectable(@NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final String animTreeFile) { + this.animationObjects = animationObjects; + this.animTreeFile = animTreeFile; + } + + /** + * {@inheritDoc} Collects the Animations. The animation data is written to + * "animations". The tree information for the editor is written to + * "animtree". + */ + @Override + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + collectAnimations(progress, collectedDirectory); + collectAnimTree(progress, collectedDirectory); + } + + /** + * Collects the animation data into the file "animations". + * @param progress the progress to report progress to + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectAnimations(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectAnimations"), animationObjects.size()); + final BufferedWriter animations = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(collectedDirectory, "animations")), IOUtils.MAP_ENCODING)); + try { + int counter = 0; // counter for progress bar + for (final AnimationObject anim : animationObjects) { + animations.append("anim ").append(anim.getAnimName()).append('\n').append(anim.getAnimList()).append("mina\n"); + if (counter++ % 128 == 0) { + progress.setValue(counter); + } + } + } finally { + animations.close(); + } + progress.setValue(animationObjects.size()); + } + + /** + * Collects the animation data into the file "animations". + * @param progress the progress to report progress to + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectAnimTree(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectAnimTree"), animationObjects.size()); + final BufferedWriter animtree = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(collectedDirectory, animTreeFile)), IOUtils.MAP_ENCODING)); + try { + int counter = 0; // counter for progress bar + for (final NamedObject anim : animationObjects) { + animtree.append(anim.getPath()).append('\n'); + if (counter++ % 128 == 0) { + progress.setValue(counter); + } + } + } finally { + animtree.close(); + } + progress.setValue(animationObjects.size()); + } + + +} Property changes on: trunk/model/src/app/net/sf/gridarta/model/collectable/AnimationObjectsCollectable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java 2011-12-16 19:26:09 UTC (rev 9121) +++ trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java 2011-12-17 06:08:25 UTC (rev 9122) @@ -19,14 +19,9 @@ package net.sf.gridarta.model.anim; -import java.io.File; -import java.io.IOException; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.japi.swing.misc.Progress; -import org.jetbrains.annotations.NotNull; /** * An {@link AnimationObjects} for regression tests. @@ -46,12 +41,4 @@ super("anim"); } - /** - * {@inheritDoc} - */ - @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser) throws IOException { - throw new AssertionError(); - } - } // class TestAnimationObjects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-16 19:26:17
|
Revision: 9121 http://gridarta.svn.sourceforge.net/gridarta/?rev=9121&view=rev Author: akirschbaum Date: 2011-12-16 19:26:09 +0000 (Fri, 16 Dec 2011) Log Message: ----------- Move classes to correct packages. Modified Paths: -------------- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java Added Paths: ----------- trunk/model/src/test/net/sf/gridarta/model/validation/ trunk/model/src/test/net/sf/gridarta/model/validation/AbstractValidatorTest.java trunk/model/src/test/net/sf/gridarta/model/validation/TestValidatorPreferences.java trunk/model/src/test/net/sf/gridarta/model/validation/ValidationUtils.java trunk/model/src/test/net/sf/gridarta/model/validation/checks/ trunk/model/src/test/net/sf/gridarta/model/validation/checks/ValidatorFactoryTest.java Removed Paths: ------------- trunk/model/src/test/net/sf/gridarta/validation/ Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java 2011-12-16 19:18:31 UTC (rev 9120) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java 2011-12-16 19:26:09 UTC (rev 9121) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.crossfire.model.validation.checks; import net.sf.gridarta.model.validation.NoSuchValidatorException; -import net.sf.gridarta.validation.ValidationUtils; +import net.sf.gridarta.model.validation.ValidationUtils; import org.junit.Test; /** Copied: trunk/model/src/test/net/sf/gridarta/model/validation/AbstractValidatorTest.java (from rev 9120, trunk/model/src/test/net/sf/gridarta/validation/AbstractValidatorTest.java) =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/validation/AbstractValidatorTest.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/validation/AbstractValidatorTest.java 2011-12-16 19:26:09 UTC (rev 9121) @@ -0,0 +1,80 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import junit.framework.TestCase; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.utils.TestActionBuilder; +import org.jetbrains.annotations.Nullable; + +/** + * Test for {@link AbstractValidator}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class AbstractValidatorTest extends TestCase { + + /** + * Object Under Test: A AbstractValidator. + */ + @Nullable + private Validator<?, ?, ?> oUT; + + /** + * {@inheritDoc} + * @noinspection ProhibitedExceptionDeclared + */ + @Override + public void setUp() throws Exception { + super.setUp(); + TestActionBuilder.initialize(); + final ValidatorPreferences validatorPreferences = new TestValidatorPreferences(); + //noinspection EmptyClass + oUT = new AbstractValidator<TestGameObject, TestMapArchObject, TestArchetype>(validatorPreferences, DelegatingMapValidator.DEFAULT_KEY) { + + }; + } + + /** + * {@inheritDoc} + * @noinspection ProhibitedExceptionDeclared + */ + @Override + public void tearDown() throws Exception { + super.tearDown(); + oUT = null; + } + + /** + * Test case for {@link AbstractValidator#setEnabled(boolean)}. + */ + public void testEnabled() { + assert oUT != null; + oUT.setEnabled(false); + assert oUT != null; + assertFalse(oUT.isEnabled()); + assert oUT != null; + oUT.setEnabled(true); + assert oUT != null; + assertTrue(oUT.isEnabled()); + } + +} // class AbstractValidatorTest Property changes on: trunk/model/src/test/net/sf/gridarta/model/validation/AbstractValidatorTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/test/net/sf/gridarta/model/validation/TestValidatorPreferences.java (from rev 9120, trunk/model/src/test/net/sf/gridarta/validation/TestValidatorPreferences.java) =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/validation/TestValidatorPreferences.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/validation/TestValidatorPreferences.java 2011-12-16 19:26:09 UTC (rev 9121) @@ -0,0 +1,47 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import org.jetbrains.annotations.NotNull; + +/** + * {@link ValidatorPreferences} implementation for regression tests. The + * settings are not stored or restored. + * @author Andreas Kirschbaum + */ +public class TestValidatorPreferences implements ValidatorPreferences { + + /** + * {@inheritDoc} + */ + @Override + public boolean loadEnabled(@NotNull final String key, final boolean defaultEnabled) { + return defaultEnabled; + } + + /** + * {@inheritDoc} + */ + @Override + public void saveEnabled(@NotNull final String key, final boolean enabled) { + // ignore + } + +} // class TestValidatorPreferences Property changes on: trunk/model/src/test/net/sf/gridarta/model/validation/TestValidatorPreferences.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/test/net/sf/gridarta/model/validation/ValidationUtils.java (from rev 9120, trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java) =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/validation/ValidationUtils.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/validation/ValidationUtils.java 2011-12-16 19:26:09 UTC (rev 9121) @@ -0,0 +1,68 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.io.DefaultMapWriter; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.io.MapArchObjectParserFactory; +import net.sf.gridarta.model.io.MapWriter; +import net.sf.gridarta.model.io.TestMapArchObjectParserFactory; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapmodel.TestMapModelCreator; +import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.match.NamedGameObjectMatcher; +import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; +import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.model.settings.TestGlobalSettings; +import net.sf.gridarta.model.validation.checks.ValidatorFactory; +import org.jetbrains.annotations.NotNull; + +/** + * Utility class for helper functions needed be regression tests. + * @author Andreas Kirschbaum + */ +public class ValidationUtils { + + /** + * Private constructor to prevent instantiation. + */ + private ValidationUtils() { + } + + /** + * Creates a new {@link ValidatorFactory} instance. + * @return the new instance + */ + @NotNull + public static ValidatorFactory<TestGameObject, TestMapArchObject, TestArchetype> newValidatorFactory() { + final ValidatorPreferences validatorPreferences = new TestValidatorPreferences(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final GameObjectMatchers gameObjectMatchers = mapModelCreator.getGameObjectMatchers(); + gameObjectMatchers.addGameObjectMatcher(new NamedGameObjectMatcher(0, "matcher", "name", false, null, new TypeNrsGameObjectMatcher(1))); + final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser = mapModelCreator.newGameObjectParser(); + final MapArchObjectParserFactory<TestMapArchObject> mapArchObjectParserFactory = new TestMapArchObjectParserFactory(); + final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter = new DefaultMapWriter<TestGameObject, TestMapArchObject, TestArchetype>(mapArchObjectParserFactory, gameObjectParser); + final GlobalSettings globalSettings = new TestGlobalSettings(); + return new ValidatorFactory<TestGameObject, TestMapArchObject, TestArchetype>(validatorPreferences, gameObjectMatchers, globalSettings, mapWriter); + } + +} // class ValidationUtils Property changes on: trunk/model/src/test/net/sf/gridarta/model/validation/ValidationUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/test/net/sf/gridarta/model/validation/checks/ValidatorFactoryTest.java (from rev 9120, trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java) =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/validation/checks/ValidatorFactoryTest.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/validation/checks/ValidatorFactoryTest.java 2011-12-16 19:26:09 UTC (rev 9121) @@ -0,0 +1,302 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation.checks; + +import net.sf.gridarta.model.validation.NoSuchValidatorException; +import net.sf.gridarta.model.validation.ValidationUtils; +import net.sf.gridarta.utils.TestActionBuilder; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Regression tests for {@link net.sf.gridarta.model.validation.checks.ValidatorFactory} + * to create validators. + * @author Andreas Kirschbaum + */ +public class ValidatorFactoryTest { + + /** + * Checks that creating an undefined validator results in an exception. + * @throws NoSuchValidatorException if the test succeeds + */ + @Test(expected = NoSuchValidatorException.class) + public void testNewUndefinedChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("abc"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.AttributeRangeChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewAttributeRangeChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.AttributeRangeChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.BlockedMobOrSpawnPointChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewBlockedMobOrSpawnPointChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.BlockedMobOrSpawnPointChecker 1,2,3"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.BlockedSpawnPointChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewBlockedSpawnPointChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.BlockedSpawnPointChecker 1,2,3"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.ConnectedInsideContainerChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewConnectedInsideContainerChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.ConnectedInsideContainerChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.ConnectedPickableChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewConnectedPickableChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.ConnectedPickableChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.ConnectionChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewConnectionChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.ConnectionChecker matcher matcher matcher"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.CustomTypeChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewCustomTypeChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.CustomTypeChecker 1,2 1,2,3"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.DoubleLayerChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewDoubleLayerChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.DoubleLayerChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.DoubleTypeChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewDoubleTypeChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.DoubleTypeChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.EmptySpawnPointChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewEmptySpawnPointChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.EmptySpawnPointChecker 1,2,3"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.EnvironmentChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewEnvironmentChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.EnvironmentChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.ExitChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewExitChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.ExitChecker 1"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.MapDifficultyChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewMapDifficultyChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.MapDifficultyChecker 1 2"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.MobOutsideSpawnPointChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewMobOutsideSpawnPointChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.MobOutsideSpawnPointChecker 1,2,3"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.PaidItemShopSquareChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewPaidItemShopSquareChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.PaidItemShopSquareChecker matcher matcher"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.ShopSquareChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewShopSquareChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.ShopSquareChecker matcher matcher matcher"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.SlayingChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewSlayingChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.SlayingChecker pattern matcher,pattern"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.SquareWithoutFloorChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewSquareWithoutFloorChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.SquareWithoutFloorChecker 1,2,3"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.SysObjectNotOnLayerZeroChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewSysObjectNotOnLayerZeroChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.SysObjectNotOnLayerZeroChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.TilePathsChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewTilePathsChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.TilePathsChecker 4"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.UndefinedArchetypeChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewUndefinedArchetypeChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.UndefinedArchetypeChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.UndefinedFaceChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewUndefinedFaceChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.UndefinedFaceChecker"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.UnsetSlayingChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewUnsetSlayingChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 1,2,3 player"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test(expected = NoSuchValidatorException.class) + public void testNewMapCheckerScriptChecker1() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker a b c"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewMapCheckerScriptChecker2() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker a ${MAP} c"); + } + + /** + * Initializes the action builder. + */ + @BeforeClass + public static void setUp() { + TestActionBuilder.initialize(); + } + +} // class ValidatorFactoryTest Property changes on: trunk/model/src/test/net/sf/gridarta/model/validation/checks/ValidatorFactoryTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-16 19:18:37
|
Revision: 9120 http://gridarta.svn.sourceforge.net/gridarta/?rev=9120&view=rev Author: akirschbaum Date: 2011-12-16 19:18:31 +0000 (Fri, 16 Dec 2011) Log Message: ----------- Remove empty directories. Removed Paths: ------------- trunk/model/src/app/net/sf/gridarta/gui/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-16 19:17:25
|
Revision: 9119 http://gridarta.svn.sourceforge.net/gridarta/?rev=9119&view=rev Author: akirschbaum Date: 2011-12-16 19:17:18 +0000 (Fri, 16 Dec 2011) Log Message: ----------- Move MapLocation and related classes to different package. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/maplocation/ trunk/model/src/app/net/sf/gridarta/model/maplocation/MapLocation.java trunk/model/src/app/net/sf/gridarta/model/maplocation/NoExitPathException.java Removed Paths: ------------- trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/ Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2011-12-15 19:37:34 UTC (rev 9118) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2011-12-16 19:17:18 UTC (rev 9119) @@ -19,8 +19,8 @@ package net.sf.gridarta.var.crossfire.model.validation.checks; -import net.sf.gridarta.gui.map.mapactions.MapLocation; -import net.sf.gridarta.gui.map.mapactions.NoExitPathException; +import net.sf.gridarta.model.maplocation.MapLocation; +import net.sf.gridarta.model.maplocation.NoExitPathException; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.match.GameObjectMatcher; Copied: trunk/model/src/app/net/sf/gridarta/model/maplocation/MapLocation.java (from rev 9114, trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/maplocation/MapLocation.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/maplocation/MapLocation.java 2011-12-16 19:17:18 UTC (rev 9119) @@ -0,0 +1,254 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.maplocation; + +import java.awt.Point; +import java.io.File; +import java.util.regex.Pattern; +import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.utils.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a location on a map consisting of a map path and a map + * coordinate. + * @author Andreas Kirschbaum + */ +public class MapLocation implements Comparable<MapLocation> { + + /** + * The {@link Pattern} that matches end of lines in random map parameters. + */ + @NotNull + private static final Pattern PATTERN_END_OF_LINE = Pattern.compile("[\r\n]+"); + + /** + * The map path. + */ + @NotNull + private final String mapPath; + + /** + * The map coordinate. + */ + @NotNull + private final Point mapCoordinate; + + /** + * Creates a new instance. + * @param mapPath the map path + * @param mapXCoordinate the map x-coordinate + * @param mapYCoordinate the map y-coordinate + */ + private MapLocation(@NotNull final String mapPath, final int mapXCoordinate, final int mapYCoordinate) { + this.mapPath = mapPath; + mapCoordinate = new Point(mapXCoordinate, mapYCoordinate); + } + + /** + * Creates a new instance from a {@link BaseObject} instance. + * @param gameObject the game object + * @param allowRandomMapParameters whether random map parameters should be + * considered + * @throws NoExitPathException if the game object is not a valid exit + */ + public MapLocation(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException { + this(getMapPath(gameObject, allowRandomMapParameters), getMapX(gameObject), getMapY(gameObject)); + } + + /** + * Creates a new instance from a {@link BaseObject} instance. The new + * <code>MapLocation</code> instance includes an absolute map path. + * @param gameObject the game object + * @param allowRandomMapParameters whether random map parameters should be + * considered + * @param pathManager the path manager for converting relative path names + * @return the new map location instance + * @throws NoExitPathException if the game object is not a valid exit + */ + @NotNull + public static MapLocation newAbsoluteMapLocation(@NotNull final GameObject<?, ?, ?> gameObject, final boolean allowRandomMapParameters, @NotNull final PathManager pathManager) throws NoExitPathException { + final String mapPath = getMapPath(gameObject, allowRandomMapParameters); + if (mapPath.isEmpty()) { + throw new NoExitPathException(gameObject); + } + final String baseMapPath; + final MapSquare<?, ?, ?> mapSquare = gameObject.getMapSquare(); + if (mapSquare == null) { + baseMapPath = "/"; + } else { + final MapModel<?, ?, ?> mapModel = mapSquare.getMapModel(); + final File mapFile = mapModel.getMapFile(); + if (mapFile == null) { + baseMapPath = "/"; + } else { + baseMapPath = pathManager.getMapPath(mapFile); + } + } + final String canonicalMapPath = PathManager.relativeToAbsolute(baseMapPath, mapPath); + final int mapX = getMapX(gameObject); + final int mapY = getMapY(gameObject); + return new MapLocation(canonicalMapPath, mapX, mapY); + } + + /** + * Returns the map path. + * @return the map path + */ + @NotNull + public String getMapPath() { + return mapPath; + } + + /** + * Returns the map coordinate. + * @return the map coordinate + */ + @NotNull + public Point getMapCoordinate() { + return new Point(mapCoordinate); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(@Nullable final Object obj) { + if (obj == this) { + return true; + } + if (obj == null || obj.getClass() != getClass()) { + return false; + } + final MapLocation mapLocation = (MapLocation) obj; + return mapLocation.mapPath.equals(mapPath) && mapLocation.mapCoordinate.equals(mapCoordinate); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return mapPath.hashCode() ^ mapCoordinate.hashCode(); + } + + /** + * Returns the exit x coordinate of a {@link BaseObject}. + * @param gameObject the game object + * @return the exit x coordinate + */ + private static int getMapY(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { + return gameObject.getAttributeInt(BaseObject.SP); + } + + /** + * Returns the exit y coordinate of a {@link BaseObject}. + * @param gameObject the game object + * @return the exit y coordinate + */ + private static int getMapX(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { + return gameObject.getAttributeInt(BaseObject.HP); + } + + /** + * Returns the exit map path of a {@link BaseObject}. + * @param gameObject the game object + * @param allowRandomMapParameters whether random maps should be considered + * @return the exit map path + * @throws NoExitPathException if the game object is not a valid exit + */ + public static String getMapPath(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException { + String path = gameObject.getAttributeString(BaseObject.SLAYING); + if (allowRandomMapParameters && (path.equals("/!") || path.startsWith("/random/"))) { + // destination is a random map; extract the final non-random map + path = getRandomMapParameter(gameObject, "final_map"); + if (path == null) { + throw new NoExitPathException(gameObject); + } + } + + return path; + } + + /** + * Extracts a parameter value for an exit to a random map. + * @param gameObject the exit object containing the parameters + * @param parameterName the parameter name to use + * @return the value of the given parameter name, or <code>null</code> if + * the parameter does not exist + */ + @Nullable + private static String getRandomMapParameter(@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final String parameterName) { + final String msg = gameObject.getMsgText(); + if (msg == null) { + return null; + } + + final String[] lines = PATTERN_END_OF_LINE.split(msg); + for (final String line : lines) { + final String[] tmp = StringUtils.PATTERN_SPACES.split(line, 2); + if (tmp.length == 2 && tmp[0].equals(parameterName)) { + return tmp[1]; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String toString() { + return mapCoordinate.x + "/" + mapCoordinate.y + "@" + mapPath; + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("CompareToUsesNonFinalVariable") + public int compareTo(@NotNull final MapLocation o) { + final int cmp = mapPath.compareTo(o.mapPath); + if (cmp != 0) { + return cmp; + } + if (mapCoordinate.x < o.mapCoordinate.x) { + return -1; + } + if (mapCoordinate.x > o.mapCoordinate.x) { + return -1; + } + if (mapCoordinate.y < o.mapCoordinate.y) { + return -1; + } + if (mapCoordinate.y > o.mapCoordinate.y) { + return -1; + } + return 0; + } + +} // class MapLocation Property changes on: trunk/model/src/app/net/sf/gridarta/model/maplocation/MapLocation.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/maplocation/NoExitPathException.java (from rev 9114, trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/maplocation/NoExitPathException.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/maplocation/NoExitPathException.java 2011-12-16 19:17:18 UTC (rev 9119) @@ -0,0 +1,45 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.maplocation; + +import net.sf.gridarta.model.baseobject.BaseObject; +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if a game object does not specify a valid exit path. + * @author Andreas Kirschbaum + */ +public class NoExitPathException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param baseObject the game object that does not specify a valid exit + * path + */ + public NoExitPathException(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { + super(baseObject.getBestName()); + } + +} // class NoExitPathException Property changes on: trunk/model/src/app/net/sf/gridarta/model/maplocation/NoExitPathException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java 2011-12-15 19:37:34 UTC (rev 9118) +++ trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java 2011-12-16 19:17:18 UTC (rev 9119) @@ -36,8 +36,6 @@ import javax.swing.ScrollPaneConstants; import javax.swing.WindowConstants; import net.sf.gridarta.gui.map.mapactions.EnterMap; -import net.sf.gridarta.gui.map.mapactions.MapLocation; -import net.sf.gridarta.gui.map.mapactions.NoExitPathException; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.utils.SwingUtils; import net.sf.gridarta.model.archetype.Archetype; @@ -46,6 +44,8 @@ import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.maplocation.MapLocation; +import net.sf.gridarta.model.maplocation.NoExitPathException; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.utils.ActionBuilderUtils; Modified: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java 2011-12-15 19:37:34 UTC (rev 9118) +++ trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java 2011-12-16 19:17:18 UTC (rev 9119) @@ -24,11 +24,11 @@ import java.util.Comparator; import javax.swing.DefaultListCellRenderer; import javax.swing.JList; -import net.sf.gridarta.gui.map.mapactions.MapLocation; -import net.sf.gridarta.gui.map.mapactions.NoExitPathException; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.maplocation.MapLocation; +import net.sf.gridarta.model.maplocation.NoExitPathException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2011-12-15 19:37:34 UTC (rev 9118) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2011-12-16 19:17:18 UTC (rev 9119) @@ -33,6 +33,8 @@ import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.maplocation.MapLocation; +import net.sf.gridarta.model.maplocation.NoExitPathException; import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mappathnormalizer.IOErrorException; import net.sf.gridarta.model.mappathnormalizer.InvalidPathException; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-15 19:37:41
|
Revision: 9118 http://gridarta.svn.sourceforge.net/gridarta/?rev=9118&view=rev Author: akirschbaum Date: 2011-12-15 19:37:34 +0000 (Thu, 15 Dec 2011) Log Message: ----------- Remove default implementation for AbstractCollectedResourcesReader.read(). Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java 2011-12-15 19:27:54 UTC (rev 9117) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java 2011-12-15 19:37:34 UTC (rev 9118) @@ -1,6 +1,6 @@ /* * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. + * Copyright (C) 2000-2011 The Gridarta Developers. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,10 +20,13 @@ package net.sf.gridarta.var.atrinik.resource; import java.io.File; +import java.util.List; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.FaceProvider; import net.sf.gridarta.model.resource.AbstractCollectedResourcesReader; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; @@ -49,4 +52,15 @@ super(collectedDirectory, null, archetypeSet, archetypeParser, animationObjects, faceObjects, IGUIConstants.ANIMTREE_FILE, IGUIConstants.ARCH_FILE); } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { + loadAnimations(errorView); + loadArchetypes(errorView, invObjects); + return loadFacesCollection(errorView); + } + } // class CollectedResourcesReader Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-15 19:27:54 UTC (rev 9117) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-15 19:37:34 UTC (rev 9118) @@ -1,6 +1,6 @@ /* * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. + * Copyright (C) 2000-2011 The Gridarta Developers. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,7 +80,9 @@ @NotNull @Override public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { - final FaceProvider faceProvider = super.read(errorView, invObjects); + loadAnimations(errorView); + loadArchetypes(errorView, invObjects); + final FaceProvider faceProvider = loadFacesCollection(errorView); loadSmoothFaces(errorView); return faceProvider; } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java 2011-12-15 19:27:54 UTC (rev 9117) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java 2011-12-15 19:37:34 UTC (rev 9118) @@ -1,6 +1,6 @@ /* * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. + * Copyright (C) 2000-2011 The Gridarta Developers. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,10 +20,13 @@ package net.sf.gridarta.var.daimonin.resource; import java.io.File; +import java.util.List; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.FaceProvider; import net.sf.gridarta.model.resource.AbstractCollectedResourcesReader; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; @@ -49,4 +52,15 @@ super(collectedDirectory, null, archetypeSet, archetypeParser, animationObjects, faceObjects, IGUIConstants.ANIMTREE_FILE, IGUIConstants.ARCH_FILE); } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { + loadAnimations(errorView); + loadArchetypes(errorView, invObjects); + return loadFacesCollection(errorView); + } + } // class CollectedResourcesReader Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:27:54 UTC (rev 9117) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:37:34 UTC (rev 9118) @@ -51,7 +51,7 @@ * AbstractResourcesReaders} that read from collected files. * @author Andreas Kirschbaum */ -public class AbstractCollectedResourcesReader<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractResourcesReader<G, A, R> { +public abstract class AbstractCollectedResourcesReader<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractResourcesReader<G, A, R> { /** * The logger for printing log messages. @@ -116,21 +116,10 @@ } /** - * {@inheritDoc} - */ - @NotNull - @Override - public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { - loadAnimations(errorView); - loadArchetypes(errorView, invObjects); - return faceObjects.loadFacesCollection(errorView, collectedDirectory); - } - - /** * Loads all animations. * @param errorView the error view for reporting problems */ - private void loadAnimations(@NotNull final ErrorView errorView) { + protected void loadAnimations(@NotNull final ErrorView errorView) { Map<String, String> animations = null; try { final URL url = IOUtils.getResource(collectedDirectory, animTreeFile); @@ -150,7 +139,7 @@ * @param errorView the error view for reporting problems * @param invObjects all read archetypes are added to this list */ - private void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { + protected void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { archetypeSet.setLoadedFromArchive(true); try { final int archetypeCount = archetypeSet.getArchetypeCount(); @@ -185,4 +174,14 @@ } } + /** + * Loads all faces. + * @param errorView the error view for reporting problems + * @return the face provider for accessing the read faces + */ + @NotNull + protected FaceProvider loadFacesCollection(@NotNull final ErrorView errorView) { + return faceObjects.loadFacesCollection(errorView, collectedDirectory); + } + } // class AbstractCollectedResourcesReader This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-15 19:28:00
|
Revision: 9117 http://gridarta.svn.sourceforge.net/gridarta/?rev=9117&view=rev Author: akirschbaum Date: 2011-12-15 19:27:54 +0000 (Thu, 15 Dec 2011) Log Message: ----------- Move code. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:21:58 UTC (rev 9116) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:27:54 UTC (rev 9117) @@ -121,7 +121,6 @@ @NotNull @Override public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { - archetypeSet.setLoadedFromArchive(true); loadAnimations(errorView); loadArchetypes(errorView, invObjects); return faceObjects.loadFacesCollection(errorView, collectedDirectory); @@ -152,6 +151,7 @@ * @param invObjects all read archetypes are added to this list */ private void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { + archetypeSet.setLoadedFromArchive(true); try { final int archetypeCount = archetypeSet.getArchetypeCount(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-15 19:22:05
|
Revision: 9116 http://gridarta.svn.sourceforge.net/gridarta/?rev=9116&view=rev Author: akirschbaum Date: 2011-12-15 19:21:58 +0000 (Thu, 15 Dec 2011) Log Message: ----------- Extract code into functions. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-15 19:18:23 UTC (rev 9115) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-15 19:21:58 UTC (rev 9116) @@ -81,13 +81,21 @@ @Override public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { final FaceProvider faceProvider = super.read(errorView, invObjects); + loadSmoothFaces(errorView); + return faceProvider; + } + + /** + * Loads all smooth faces. + * @param errorView the error view for reporting problems + */ + private void loadSmoothFaces(final ErrorView errorView) { try { final URL url = IOUtils.getResource(configurationDirectory, IGUIConstants.SMOOTH_FILE); SmoothFacesLoader.load(url, smoothFaces, errorView); } catch (final IOException ex) { errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, IGUIConstants.SMOOTH_FILE + ": " + ex.getMessage()); } - return faceProvider; } } // class CollectedResourcesReader Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:18:23 UTC (rev 9115) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:21:58 UTC (rev 9116) @@ -122,6 +122,16 @@ @Override public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { archetypeSet.setLoadedFromArchive(true); + loadAnimations(errorView); + loadArchetypes(errorView, invObjects); + return faceObjects.loadFacesCollection(errorView, collectedDirectory); + } + + /** + * Loads all animations. + * @param errorView the error view for reporting problems + */ + private void loadAnimations(@NotNull final ErrorView errorView) { Map<String, String> animations = null; try { final URL url = IOUtils.getResource(collectedDirectory, animTreeFile); @@ -134,6 +144,14 @@ errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, animTreeFile + ": " + ex.getMessage()); } loadAnimationsFromCollect(errorView, animations == null ? Collections.<String, String>emptyMap() : animations); + } + + /** + * Loads all archetypes. + * @param errorView the error view for reporting problems + * @param invObjects all read archetypes are added to this list + */ + private void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { try { final int archetypeCount = archetypeSet.getArchetypeCount(); @@ -165,7 +183,6 @@ } catch (final IOException ex) { errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, archetypesFile + ": " + ex.getMessage()); } - return faceObjects.loadFacesCollection(errorView, collectedDirectory); } } // class AbstractCollectedResourcesReader This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-15 19:18:31
|
Revision: 9115 http://gridarta.svn.sourceforge.net/gridarta/?rev=9115&view=rev Author: akirschbaum Date: 2011-12-15 19:18:23 +0000 (Thu, 15 Dec 2011) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java 2011-12-15 18:47:26 UTC (rev 9114) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java 2011-12-15 19:18:23 UTC (rev 9115) @@ -19,70 +19,25 @@ package net.sf.gridarta.var.atrinik.resource; -import java.io.BufferedReader; import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; -import java.util.Collections; -import java.util.List; -import java.util.Map; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; -import net.sf.gridarta.model.errorview.ErrorView; -import net.sf.gridarta.model.errorview.ErrorViewCategory; -import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.face.FaceProvider; -import net.sf.gridarta.model.resource.AbstractResourcesReader; -import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.model.resource.AbstractCollectedResourcesReader; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; /** * Loads all resources from collected files. * @author Andreas Kirschbaum */ -public class CollectedResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { +public class CollectedResourcesReader extends AbstractCollectedResourcesReader<GameObject, MapArchObject, Archetype> { /** - * The logger for printing log messages. - */ - private static final Category log = Logger.getLogger(CollectedResourcesReader.class); - - /** - * The collected directory. - */ - @NotNull - private final File collectedDirectory; - - /** - * The {@link ArchetypeSet} to update. - */ - @NotNull - private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; - - /** - * The {@link AbstractArchetypeParser} to use. - */ - @NotNull - private final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser; - - /** - * The {@link FaceObjects} instance. - */ - @NotNull - private final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects; - - /** * Creates a new instance. * @param collectedDirectory the collected directory * @param archetypeSet the archetype set to update @@ -91,64 +46,7 @@ * @param animationObjects the animation objects instance */ public CollectedResourcesReader(@NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { - super(collectedDirectory, null, animationObjects, faceObjects); - this.collectedDirectory = collectedDirectory; - this.archetypeSet = archetypeSet; - this.archetypeParser = archetypeParser; - this.faceObjects = faceObjects; + super(collectedDirectory, null, archetypeSet, archetypeParser, animationObjects, faceObjects, IGUIConstants.ANIMTREE_FILE, IGUIConstants.ARCH_FILE); } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { - archetypeSet.setLoadedFromArchive(true); // load from the collected files - Map<String, String> animations = null; - try { - final URL url = IOUtils.getResource(collectedDirectory, IGUIConstants.ANIMTREE_FILE); - try { - animations = loadAnimTree(url); - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, url + ": " + ex.getMessage()); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, IGUIConstants.ANIMTREE_FILE + ": " + ex.getMessage()); - } - loadAnimationsFromCollect(errorView, animations == null ? Collections.<String, String>emptyMap() : animations); - try { - final int archetypeCount = archetypeSet.getArchetypeCount(); - - final URL url = IOUtils.getResource(collectedDirectory, IGUIConstants.ARCH_FILE); - try { - final InputStream inputStream = url.openStream(); - try { - final Reader reader = new InputStreamReader(inputStream, IOUtils.MAP_ENCODING); - try { - final BufferedReader bufferedReader = new BufferedReader(reader); - try { - archetypeParser.parseArchetypeFromStream(bufferedReader, null, null, null, "default", "default", "", invObjects, new ErrorViewCollector(errorView, url)); - } finally { - bufferedReader.close(); - } - } finally { - reader.close(); - } - } finally { - inputStream.close(); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, url + ": " + ex.getMessage()); - } - - if (log.isInfoEnabled()) { - log.info("Loaded " + (archetypeSet.getArchetypeCount() - archetypeCount) + " archetypes from '" + url + "'."); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, IGUIConstants.ARCH_FILE + ": " + ex.getMessage()); - } - return faceObjects.loadFacesCollection(errorView, collectedDirectory); - } - } // class CollectedResourcesReader Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-15 18:47:26 UTC (rev 9114) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-15 19:18:23 UTC (rev 9115) @@ -19,25 +19,18 @@ package net.sf.gridarta.var.crossfire.resource; -import java.io.BufferedReader; import java.io.File; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; import java.net.URL; -import java.util.Collections; import java.util.List; -import java.util.Map; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; -import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; -import net.sf.gridarta.model.resource.AbstractResourcesReader; +import net.sf.gridarta.model.resource.AbstractCollectedResourcesReader; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; @@ -45,52 +38,21 @@ import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFacesLoader; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; /** * Loads all resources from collected files. * @author Andreas Kirschbaum */ -public class CollectedResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { +public class CollectedResourcesReader extends AbstractCollectedResourcesReader<GameObject, MapArchObject, Archetype> { /** - * The logger for printing log messages. - */ - private static final Category log = Logger.getLogger(CollectedResourcesReader.class); - - /** * The configuration directory. */ @NotNull private final File configurationDirectory; /** - * The collected directory. - */ - @NotNull - private final File collectedDirectory; - - /** - * The archetype set to update. - */ - @NotNull - private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; - - /** - * The archetype parser to use. - */ - @NotNull - private final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser; - - /** - * The face objects to update. - */ - @NotNull - private final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects; - - /** * The smooth faces to update. */ @NotNull @@ -107,12 +69,8 @@ * @param smoothFaces the smooth faces to update */ public CollectedResourcesReader(@NotNull final File configurationDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final SmoothFaces smoothFaces) { - super(collectedDirectory, archetypeSet.getImageSet(), animationObjects, faceObjects); + super(collectedDirectory, archetypeSet.getImageSet(), archetypeSet, archetypeParser, animationObjects, faceObjects, IGUIConstants.ANIMTREE_FILE, IGUIConstants.ARCH_FILE); this.configurationDirectory = configurationDirectory; - this.collectedDirectory = collectedDirectory; - this.archetypeSet = archetypeSet; - this.archetypeParser = archetypeParser; - this.faceObjects = faceObjects; this.smoothFaces = smoothFaces; } @@ -122,52 +80,8 @@ @NotNull @Override public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { - archetypeSet.setLoadedFromArchive(true); - Map<String, String> animations = null; + final FaceProvider faceProvider = super.read(errorView, invObjects); try { - final URL url = IOUtils.getResource(collectedDirectory, IGUIConstants.ANIMTREE_FILE); - try { - animations = loadAnimTree(url); - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, url + ": " + ex.getMessage()); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, IGUIConstants.ANIMTREE_FILE + ": " + ex.getMessage()); - } - loadAnimationsFromCollect(errorView, animations == null ? Collections.<String, String>emptyMap() : animations); - try { - final int archetypeCount = archetypeSet.getArchetypeCount(); - - final URL url = IOUtils.getResource(collectedDirectory, IGUIConstants.ARCH_FILE); - try { - final InputStream inputStream = url.openStream(); - try { - final Reader reader = new InputStreamReader(inputStream, IOUtils.MAP_ENCODING); - try { - final BufferedReader bufferedReader = new BufferedReader(reader); - try { - archetypeParser.parseArchetypeFromStream(bufferedReader, null, null, null, "default", "default", "", invObjects, new ErrorViewCollector(errorView, url)); - } finally { - bufferedReader.close(); - } - } finally { - reader.close(); - } - } finally { - inputStream.close(); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, url + ": " + ex.getMessage()); - } - - if (log.isInfoEnabled()) { - log.info("Loaded " + (archetypeSet.getArchetypeCount() - archetypeCount) + " archetypes from '" + url + "'."); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, IGUIConstants.ARCH_FILE + ": " + ex.getMessage()); - } - final FaceProvider faceProvider = faceObjects.loadFacesCollection(errorView, collectedDirectory); - try { final URL url = IOUtils.getResource(configurationDirectory, IGUIConstants.SMOOTH_FILE); SmoothFacesLoader.load(url, smoothFaces, errorView); } catch (final IOException ex) { Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java 2011-12-15 18:47:26 UTC (rev 9114) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java 2011-12-15 19:18:23 UTC (rev 9115) @@ -19,70 +19,25 @@ package net.sf.gridarta.var.daimonin.resource; -import java.io.BufferedReader; import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; -import java.util.Collections; -import java.util.List; -import java.util.Map; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeSet; -import net.sf.gridarta.model.errorview.ErrorView; -import net.sf.gridarta.model.errorview.ErrorViewCategory; -import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.face.FaceProvider; -import net.sf.gridarta.model.resource.AbstractResourcesReader; -import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.model.resource.AbstractCollectedResourcesReader; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; /** * Loads all resources from collected files. * @author Andreas Kirschbaum */ -public class CollectedResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { +public class CollectedResourcesReader extends AbstractCollectedResourcesReader<GameObject, MapArchObject, Archetype> { /** - * The logger for printing log messages. - */ - private static final Category log = Logger.getLogger(CollectedResourcesReader.class); - - /** - * The collected directory. - */ - @NotNull - private final File collectedDirectory; - - /** - * The {@link ArchetypeSet} to update. - */ - @NotNull - private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; - - /** - * The {@link AbstractArchetypeParser} to use. - */ - @NotNull - private final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser; - - /** - * The {@link FaceObjects} instance. - */ - @NotNull - private final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects; - - /** * Creates a new instance. * @param collectedDirectory the collected directory * @param archetypeSet the archetype set to update @@ -91,64 +46,7 @@ * @param animationObjects the animation objects instance */ public CollectedResourcesReader(@NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects) { - super(collectedDirectory, null, animationObjects, faceObjects); - this.collectedDirectory = collectedDirectory; - this.archetypeSet = archetypeSet; - this.archetypeParser = archetypeParser; - this.faceObjects = faceObjects; + super(collectedDirectory, null, archetypeSet, archetypeParser, animationObjects, faceObjects, IGUIConstants.ANIMTREE_FILE, IGUIConstants.ARCH_FILE); } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { - archetypeSet.setLoadedFromArchive(true); // load from the collected files - Map<String, String> animations = null; - try { - final URL url = IOUtils.getResource(collectedDirectory, IGUIConstants.ANIMTREE_FILE); - try { - animations = loadAnimTree(url); - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, url + ": " + ex.getMessage()); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, IGUIConstants.ANIMTREE_FILE + ": " + ex.getMessage()); - } - loadAnimationsFromCollect(errorView, animations == null ? Collections.<String, String>emptyMap() : animations); - try { - final int archetypeCount = archetypeSet.getArchetypeCount(); - - final URL url = IOUtils.getResource(collectedDirectory, IGUIConstants.ARCH_FILE); - try { - final InputStream inputStream = url.openStream(); - try { - final Reader reader = new InputStreamReader(inputStream, IOUtils.MAP_ENCODING); - try { - final BufferedReader bufferedReader = new BufferedReader(reader); - try { - archetypeParser.parseArchetypeFromStream(bufferedReader, null, null, null, "default", "default", "", invObjects, new ErrorViewCollector(errorView, url)); - } finally { - bufferedReader.close(); - } - } finally { - reader.close(); - } - } finally { - inputStream.close(); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, url + ": " + ex.getMessage()); - } - - if (log.isInfoEnabled()) { - log.info("Loaded " + (archetypeSet.getArchetypeCount() - archetypeCount) + " archetypes from '" + url + "'."); - } - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, IGUIConstants.ARCH_FILE + ": " + ex.getMessage()); - } - return faceObjects.loadFacesCollection(errorView, collectedDirectory); - } - } // class CollectedResourcesReader Added: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:18:23 UTC (rev 9115) @@ -0,0 +1,171 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.resource; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.net.URL; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import net.sf.gridarta.model.anim.AnimationObjects; +import net.sf.gridarta.model.archetype.AbstractArchetypeParser; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.errorview.ErrorView; +import net.sf.gridarta.model.errorview.ErrorViewCategory; +import net.sf.gridarta.model.errorview.ErrorViewCollector; +import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.FaceProvider; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.IOUtils; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Abstract base class for {@link AbstractResourcesReader + * AbstractResourcesReaders} that read from collected files. + * @author Andreas Kirschbaum + */ +public class AbstractCollectedResourcesReader<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractResourcesReader<G, A, R> { + + /** + * The logger for printing log messages. + */ + private static final Category log = Logger.getLogger(AbstractCollectedResourcesReader.class); + + /** + * The collected directory. + */ + @NotNull + private final File collectedDirectory; + + /** + * The {@link ArchetypeSet} to update. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The {@link AbstractArchetypeParser} to use. + */ + @NotNull + private final AbstractArchetypeParser<G, A, R, ?> archetypeParser; + + /** + * The {@link FaceObjects} instance. + */ + @NotNull + private final FaceObjects<G, A, R> faceObjects; + + /** + * The name of the animation tree information file. + */ + @NotNull + private final String animTreeFile; + + /** + * The name of the collected archetypes file. + */ + @NotNull + private final String archetypesFile; + + /** + * Creates a new instance. + * @param collectedDirectory the collected directory + * @param imageSet the active image set or <code>null</code> + * @param archetypeSet the archetype set to update + * @param archetypeParser the archetype parser to use + * @param animationObjects the animation objects instance + * @param faceObjects the face objects instance + * @param animTreeFile the name of the animation tree information file + * @param archetypesFile the name of the collected archetypes file + */ + protected AbstractCollectedResourcesReader(@NotNull final File collectedDirectory, @Nullable final String imageSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AbstractArchetypeParser<G, A, R, ?> archetypeParser, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final String animTreeFile, @NotNull final String archetypesFile) { + super(collectedDirectory, imageSet, animationObjects, faceObjects); + this.collectedDirectory = collectedDirectory; + this.archetypeSet = archetypeSet; + this.archetypeParser = archetypeParser; + this.faceObjects = faceObjects; + this.animTreeFile = animTreeFile; + this.archetypesFile = archetypesFile; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { + archetypeSet.setLoadedFromArchive(true); + Map<String, String> animations = null; + try { + final URL url = IOUtils.getResource(collectedDirectory, animTreeFile); + try { + animations = loadAnimTree(url); + } catch (final IOException ex) { + errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, url + ": " + ex.getMessage()); + } + } catch (final IOException ex) { + errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, animTreeFile + ": " + ex.getMessage()); + } + loadAnimationsFromCollect(errorView, animations == null ? Collections.<String, String>emptyMap() : animations); + try { + final int archetypeCount = archetypeSet.getArchetypeCount(); + + final URL url = IOUtils.getResource(collectedDirectory, archetypesFile); + try { + final InputStream inputStream = url.openStream(); + try { + final Reader reader = new InputStreamReader(inputStream, IOUtils.MAP_ENCODING); + try { + final BufferedReader bufferedReader = new BufferedReader(reader); + try { + archetypeParser.parseArchetypeFromStream(bufferedReader, null, null, null, "default", "default", "", invObjects, new ErrorViewCollector(errorView, url)); + } finally { + bufferedReader.close(); + } + } finally { + reader.close(); + } + } finally { + inputStream.close(); + } + } catch (final IOException ex) { + errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, url + ": " + ex.getMessage()); + } + + if (log.isInfoEnabled()) { + log.info("Loaded " + (archetypeSet.getArchetypeCount() - archetypeCount) + " archetypes from '" + url + "'."); + } + } catch (final IOException ex) { + errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, archetypesFile + ": " + ex.getMessage()); + } + return faceObjects.loadFacesCollection(errorView, collectedDirectory); + } + +} // class AbstractCollectedResourcesReader Property changes on: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-12-15 18:47:32
|
Revision: 9114 http://gridarta.svn.sourceforge.net/gridarta/?rev=9114&view=rev Author: akirschbaum Date: 2011-12-15 18:47:26 +0000 (Thu, 15 Dec 2011) Log Message: ----------- Remove empty directory. Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-11-19 11:56:47
|
Revision: 9113 http://gridarta.svn.sourceforge.net/gridarta/?rev=9113&view=rev Author: akirschbaum Date: 2011-11-19 11:56:40 +0000 (Sat, 19 Nov 2011) Log Message: ----------- Include exit path name in invalid exit path map validator. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/validation/errors/ExitError.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/test-mapvalidator/crossfire/maps/Exit.expected Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/ExitError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/ExitError.java 2011-11-19 11:11:29 UTC (rev 9112) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/ExitError.java 2011-11-19 11:56:40 UTC (rev 9113) @@ -52,12 +52,17 @@ } /** - * Returns the exit path that was wrong. - * @return the exit path that was wrong + * {@inheritDoc} */ - @NotNull - public String getExitPath() { - return exitPath; + @Override + public String getParameter(final int id) { + switch (id) { + case 0: + return exitPath; + + default: + return null; + } } } // class ExitError Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2011-11-19 11:11:29 UTC (rev 9112) +++ trunk/src/app/net/sf/gridarta/messages.properties 2011-11-19 11:56:40 UTC (rev 9113) @@ -1387,7 +1387,7 @@ Validator.Exit.default=true Validator.Exit.title=Exit path invalid -Validator.Exit.msg=<html><h3>{0}</h3><p>This exit has an invalid path.<br>Change the path or create the missing map. +Validator.Exit.msg=<html><h3>{0}</h3><p>This exit has an invalid path {4}.<br>Change the path or create the missing map. Validator.MapCheckerScript.default=false Validator.MapCheckerScript.title=External validator script Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2011-11-19 11:11:29 UTC (rev 9112) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2011-11-19 11:56:40 UTC (rev 9113) @@ -1177,7 +1177,7 @@ Validator.EnvironmentSensorSlaying.msg=<html><h3>{0}</h3><p>Dieses Objekt besitzt einen ung\u00fcltigen Wert im Attribut "slaying".<br>Der Wert sollte entweder leer sein oder den Aufbau HH:MM-HH:MM haben.</p><p>Sie k\u00f6nnen:</p><ul><li>Das Attribut \u00e4ndern</li><li>Das Objekt l\u00f6schen</li></ul> Validator.Exit.title=Ung\u00fcltiger Kartenpfad -Validator.Exit.msg=<html><h3>{0}</h3><p>Dieser Ausgang besitzt einen ung\u00fcltigen Kartenpfad.<br>\u00c4ndern sie den Kartenpfad oder erstellen Sie die fehlende Karte. +Validator.Exit.msg=<html><h3>{0}</h3><p>Dieser Ausgang besitzt einen ung\u00fcltigen Kartenpfad {4}.<br>\u00c4ndern sie den Kartenpfad oder erstellen Sie die fehlende Karte. Validator.MapDifficulty.title=Ung\u00fcltige Schwierigkeit Validator.MapDifficulty.msg=<html><h3>{0}</h3>Die Karte besitzt eine ung\u00fcltige Schwierigkeit.<br>\u00c4ndern Sie die Schwierigkeit in den Karteneigenschaften. Modified: trunk/test-mapvalidator/crossfire/maps/Exit.expected =================================================================== --- trunk/test-mapvalidator/crossfire/maps/Exit.expected 2011-11-19 11:11:29 UTC (rev 9112) +++ trunk/test-mapvalidator/crossfire/maps/Exit.expected 2011-11-19 11:56:40 UTC (rev 9113) @@ -1,2 +1,2 @@ -[1|2] Exit path invalid [exit1] [exit1] -[1|4] Exit path invalid [exit1] [exit1] +[1|2] Exit path invalid [exit1] [exit1] [/nonexisting] +[1|4] Exit path invalid [exit1] [exit1] [nonexisting] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-11-19 11:11:37
|
Revision: 9112 http://gridarta.svn.sourceforge.net/gridarta/?rev=9112&view=rev Author: akirschbaum Date: 2011-11-19 11:11:29 +0000 (Sat, 19 Nov 2011) Log Message: ----------- Move MapLocation to model module. Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/gui/ trunk/model/src/app/net/sf/gridarta/gui/map/ trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/ trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java Copied: trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java (from rev 9110, trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java 2011-11-19 11:11:29 UTC (rev 9112) @@ -0,0 +1,254 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.map.mapactions; + +import java.awt.Point; +import java.io.File; +import java.util.regex.Pattern; +import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.utils.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a location on a map consisting of a map path and a map + * coordinate. + * @author Andreas Kirschbaum + */ +public class MapLocation implements Comparable<MapLocation> { + + /** + * The {@link Pattern} that matches end of lines in random map parameters. + */ + @NotNull + private static final Pattern PATTERN_END_OF_LINE = Pattern.compile("[\r\n]+"); + + /** + * The map path. + */ + @NotNull + private final String mapPath; + + /** + * The map coordinate. + */ + @NotNull + private final Point mapCoordinate; + + /** + * Creates a new instance. + * @param mapPath the map path + * @param mapXCoordinate the map x-coordinate + * @param mapYCoordinate the map y-coordinate + */ + private MapLocation(@NotNull final String mapPath, final int mapXCoordinate, final int mapYCoordinate) { + this.mapPath = mapPath; + mapCoordinate = new Point(mapXCoordinate, mapYCoordinate); + } + + /** + * Creates a new instance from a {@link BaseObject} instance. + * @param gameObject the game object + * @param allowRandomMapParameters whether random map parameters should be + * considered + * @throws NoExitPathException if the game object is not a valid exit + */ + public MapLocation(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException { + this(getMapPath(gameObject, allowRandomMapParameters), getMapX(gameObject), getMapY(gameObject)); + } + + /** + * Creates a new instance from a {@link BaseObject} instance. The new + * <code>MapLocation</code> instance includes an absolute map path. + * @param gameObject the game object + * @param allowRandomMapParameters whether random map parameters should be + * considered + * @param pathManager the path manager for converting relative path names + * @return the new map location instance + * @throws NoExitPathException if the game object is not a valid exit + */ + @NotNull + public static MapLocation newAbsoluteMapLocation(@NotNull final GameObject<?, ?, ?> gameObject, final boolean allowRandomMapParameters, @NotNull final PathManager pathManager) throws NoExitPathException { + final String mapPath = getMapPath(gameObject, allowRandomMapParameters); + if (mapPath.isEmpty()) { + throw new NoExitPathException(gameObject); + } + final String baseMapPath; + final MapSquare<?, ?, ?> mapSquare = gameObject.getMapSquare(); + if (mapSquare == null) { + baseMapPath = "/"; + } else { + final MapModel<?, ?, ?> mapModel = mapSquare.getMapModel(); + final File mapFile = mapModel.getMapFile(); + if (mapFile == null) { + baseMapPath = "/"; + } else { + baseMapPath = pathManager.getMapPath(mapFile); + } + } + final String canonicalMapPath = PathManager.relativeToAbsolute(baseMapPath, mapPath); + final int mapX = getMapX(gameObject); + final int mapY = getMapY(gameObject); + return new MapLocation(canonicalMapPath, mapX, mapY); + } + + /** + * Returns the map path. + * @return the map path + */ + @NotNull + public String getMapPath() { + return mapPath; + } + + /** + * Returns the map coordinate. + * @return the map coordinate + */ + @NotNull + public Point getMapCoordinate() { + return new Point(mapCoordinate); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(@Nullable final Object obj) { + if (obj == this) { + return true; + } + if (obj == null || obj.getClass() != getClass()) { + return false; + } + final MapLocation mapLocation = (MapLocation) obj; + return mapLocation.mapPath.equals(mapPath) && mapLocation.mapCoordinate.equals(mapCoordinate); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return mapPath.hashCode() ^ mapCoordinate.hashCode(); + } + + /** + * Returns the exit x coordinate of a {@link BaseObject}. + * @param gameObject the game object + * @return the exit x coordinate + */ + private static int getMapY(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { + return gameObject.getAttributeInt(BaseObject.SP); + } + + /** + * Returns the exit y coordinate of a {@link BaseObject}. + * @param gameObject the game object + * @return the exit y coordinate + */ + private static int getMapX(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { + return gameObject.getAttributeInt(BaseObject.HP); + } + + /** + * Returns the exit map path of a {@link BaseObject}. + * @param gameObject the game object + * @param allowRandomMapParameters whether random maps should be considered + * @return the exit map path + * @throws NoExitPathException if the game object is not a valid exit + */ + public static String getMapPath(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException { + String path = gameObject.getAttributeString(BaseObject.SLAYING); + if (allowRandomMapParameters && (path.equals("/!") || path.startsWith("/random/"))) { + // destination is a random map; extract the final non-random map + path = getRandomMapParameter(gameObject, "final_map"); + if (path == null) { + throw new NoExitPathException(gameObject); + } + } + + return path; + } + + /** + * Extracts a parameter value for an exit to a random map. + * @param gameObject the exit object containing the parameters + * @param parameterName the parameter name to use + * @return the value of the given parameter name, or <code>null</code> if + * the parameter does not exist + */ + @Nullable + private static String getRandomMapParameter(@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final String parameterName) { + final String msg = gameObject.getMsgText(); + if (msg == null) { + return null; + } + + final String[] lines = PATTERN_END_OF_LINE.split(msg); + for (final String line : lines) { + final String[] tmp = StringUtils.PATTERN_SPACES.split(line, 2); + if (tmp.length == 2 && tmp[0].equals(parameterName)) { + return tmp[1]; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String toString() { + return mapCoordinate.x + "/" + mapCoordinate.y + "@" + mapPath; + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("CompareToUsesNonFinalVariable") + public int compareTo(@NotNull final MapLocation o) { + final int cmp = mapPath.compareTo(o.mapPath); + if (cmp != 0) { + return cmp; + } + if (mapCoordinate.x < o.mapCoordinate.x) { + return -1; + } + if (mapCoordinate.x > o.mapCoordinate.x) { + return -1; + } + if (mapCoordinate.y < o.mapCoordinate.y) { + return -1; + } + if (mapCoordinate.y > o.mapCoordinate.y) { + return -1; + } + return 0; + } + +} // class MapLocation Property changes on: trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java (from rev 9110, trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java 2011-11-19 11:11:29 UTC (rev 9112) @@ -0,0 +1,45 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.map.mapactions; + +import net.sf.gridarta.model.baseobject.BaseObject; +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if a game object does not specify a valid exit path. + * @author Andreas Kirschbaum + */ +public class NoExitPathException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param baseObject the game object that does not specify a valid exit + * path + */ + public NoExitPathException(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { + super(baseObject.getBestName()); + } + +} // class NoExitPathException Property changes on: trunk/model/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Deleted: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java 2011-11-19 11:08:29 UTC (rev 9111) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java 2011-11-19 11:11:29 UTC (rev 9112) @@ -1,254 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.map.mapactions; - -import java.awt.Point; -import java.io.File; -import java.util.regex.Pattern; -import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.PathManager; -import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mapmodel.MapSquare; -import net.sf.gridarta.utils.StringUtils; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Represents a location on a map consisting of a map path and a map - * coordinate. - * @author Andreas Kirschbaum - */ -public class MapLocation implements Comparable<MapLocation> { - - /** - * The {@link Pattern} that matches end of lines in random map parameters. - */ - @NotNull - private static final Pattern PATTERN_END_OF_LINE = Pattern.compile("[\r\n]+"); - - /** - * The map path. - */ - @NotNull - private final String mapPath; - - /** - * The map coordinate. - */ - @NotNull - private final Point mapCoordinate; - - /** - * Creates a new instance. - * @param mapPath the map path - * @param mapXCoordinate the map x-coordinate - * @param mapYCoordinate the map y-coordinate - */ - private MapLocation(@NotNull final String mapPath, final int mapXCoordinate, final int mapYCoordinate) { - this.mapPath = mapPath; - mapCoordinate = new Point(mapXCoordinate, mapYCoordinate); - } - - /** - * Creates a new instance from a {@link BaseObject} instance. - * @param gameObject the game object - * @param allowRandomMapParameters whether random map parameters should be - * considered - * @throws NoExitPathException if the game object is not a valid exit - */ - public MapLocation(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException { - this(getMapPath(gameObject, allowRandomMapParameters), getMapX(gameObject), getMapY(gameObject)); - } - - /** - * Creates a new instance from a {@link BaseObject} instance. The new - * <code>MapLocation</code> instance includes an absolute map path. - * @param gameObject the game object - * @param allowRandomMapParameters whether random map parameters should be - * considered - * @param pathManager the path manager for converting relative path names - * @return the new map location instance - * @throws NoExitPathException if the game object is not a valid exit - */ - @NotNull - public static MapLocation newAbsoluteMapLocation(@NotNull final GameObject<?, ?, ?> gameObject, final boolean allowRandomMapParameters, @NotNull final PathManager pathManager) throws NoExitPathException { - final String mapPath = getMapPath(gameObject, allowRandomMapParameters); - if (mapPath.isEmpty()) { - throw new NoExitPathException(gameObject); - } - final String baseMapPath; - final MapSquare<?, ?, ?> mapSquare = gameObject.getMapSquare(); - if (mapSquare == null) { - baseMapPath = "/"; - } else { - final MapModel<?, ?, ?> mapModel = mapSquare.getMapModel(); - final File mapFile = mapModel.getMapFile(); - if (mapFile == null) { - baseMapPath = "/"; - } else { - baseMapPath = pathManager.getMapPath(mapFile); - } - } - final String canonicalMapPath = PathManager.relativeToAbsolute(baseMapPath, mapPath); - final int mapX = getMapX(gameObject); - final int mapY = getMapY(gameObject); - return new MapLocation(canonicalMapPath, mapX, mapY); - } - - /** - * Returns the map path. - * @return the map path - */ - @NotNull - public String getMapPath() { - return mapPath; - } - - /** - * Returns the map coordinate. - * @return the map coordinate - */ - @NotNull - public Point getMapCoordinate() { - return new Point(mapCoordinate); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(@Nullable final Object obj) { - if (obj == this) { - return true; - } - if (obj == null || obj.getClass() != getClass()) { - return false; - } - final MapLocation mapLocation = (MapLocation) obj; - return mapLocation.mapPath.equals(mapPath) && mapLocation.mapCoordinate.equals(mapCoordinate); - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return mapPath.hashCode() ^ mapCoordinate.hashCode(); - } - - /** - * Returns the exit x coordinate of a {@link BaseObject}. - * @param gameObject the game object - * @return the exit x coordinate - */ - private static int getMapY(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { - return gameObject.getAttributeInt(BaseObject.SP); - } - - /** - * Returns the exit y coordinate of a {@link BaseObject}. - * @param gameObject the game object - * @return the exit y coordinate - */ - private static int getMapX(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { - return gameObject.getAttributeInt(BaseObject.HP); - } - - /** - * Returns the exit map path of a {@link BaseObject}. - * @param gameObject the game object - * @param allowRandomMapParameters whether random maps should be considered - * @return the exit map path - * @throws NoExitPathException if the game object is not a valid exit - */ - public static String getMapPath(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException { - String path = gameObject.getAttributeString(BaseObject.SLAYING); - if (allowRandomMapParameters && (path.equals("/!") || path.startsWith("/random/"))) { - // destination is a random map; extract the final non-random map - path = getRandomMapParameter(gameObject, "final_map"); - if (path == null) { - throw new NoExitPathException(gameObject); - } - } - - return path; - } - - /** - * Extracts a parameter value for an exit to a random map. - * @param gameObject the exit object containing the parameters - * @param parameterName the parameter name to use - * @return the value of the given parameter name, or <code>null</code> if - * the parameter does not exist - */ - @Nullable - private static String getRandomMapParameter(@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final String parameterName) { - final String msg = gameObject.getMsgText(); - if (msg == null) { - return null; - } - - final String[] lines = PATTERN_END_OF_LINE.split(msg); - for (final String line : lines) { - final String[] tmp = StringUtils.PATTERN_SPACES.split(line, 2); - if (tmp.length == 2 && tmp[0].equals(parameterName)) { - return tmp[1]; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public String toString() { - return mapCoordinate.x + "/" + mapCoordinate.y + "@" + mapPath; - } - - /** - * {@inheritDoc} - */ - @Override - @SuppressWarnings("CompareToUsesNonFinalVariable") - public int compareTo(@NotNull final MapLocation o) { - final int cmp = mapPath.compareTo(o.mapPath); - if (cmp != 0) { - return cmp; - } - if (mapCoordinate.x < o.mapCoordinate.x) { - return -1; - } - if (mapCoordinate.x > o.mapCoordinate.x) { - return -1; - } - if (mapCoordinate.y < o.mapCoordinate.y) { - return -1; - } - if (mapCoordinate.y > o.mapCoordinate.y) { - return -1; - } - return 0; - } - -} // class MapLocation Deleted: trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java 2011-11-19 11:08:29 UTC (rev 9111) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java 2011-11-19 11:11:29 UTC (rev 9112) @@ -1,45 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.map.mapactions; - -import net.sf.gridarta.model.baseobject.BaseObject; -import org.jetbrains.annotations.NotNull; - -/** - * Exception thrown if a game object does not specify a valid exit path. - * @author Andreas Kirschbaum - */ -public class NoExitPathException extends Exception { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * Creates a new instance. - * @param baseObject the game object that does not specify a valid exit - * path - */ - public NoExitPathException(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { - super(baseObject.getBestName()); - } - -} // class NoExitPathException This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-11-19 11:08:36
|
Revision: 9111 http://gridarta.svn.sourceforge.net/gridarta/?rev=9111&view=rev Author: akirschbaum Date: 2011-11-19 11:08:29 +0000 (Sat, 19 Nov 2011) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java trunk/src/app/net/sf/gridarta/messages.properties Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2011-11-17 06:12:26 UTC (rev 9110) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2011-11-19 11:08:29 UTC (rev 9111) @@ -76,7 +76,7 @@ final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapSquare.getMapModel(); final MapArchObject mapArchObject = mapModel.getMapArchObject(); if (!mapArchObject.isUnique()) { - return; // not o a unique map => skip + return; // not on an unique map => skip } final String exitPath; Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2011-11-17 06:12:26 UTC (rev 9110) +++ trunk/src/app/net/sf/gridarta/messages.properties 2011-11-19 11:08:29 UTC (rev 9111) @@ -1193,31 +1193,31 @@ prefs.useImageSet=The image set to use. prefs.username=The user name to use for new maps. prefs.Validator.All=Whether the map validator is enabled. -prefs.Validator.AttributeRange=Whether this map validator check is is enabled. -prefs.Validator.BlockedMobOrSpawnPoint=Whether this map validator check is is enabled. -prefs.Validator.BlockedSpawnPoint=Whether this map validator check is is enabled. -prefs.Validator.BlockedSquare=Whether this map validator check is is enabled. -prefs.Validator.ConnectedInsideContainer=Whether this map validator check is is enabled. -prefs.Validator.ConnectedPickable=Whether this map validator check is is enabled. -prefs.Validator.Connection=Whether this map validator check is is enabled. +prefs.Validator.AttributeRange=Whether this map validator check is enabled. +prefs.Validator.BlockedMobOrSpawnPoint=Whether this map validator check is enabled. +prefs.Validator.BlockedSpawnPoint=Whether this map validator check is enabled. +prefs.Validator.BlockedSquare=Whether this map validator check is enabled. +prefs.Validator.ConnectedInsideContainer=Whether this map validator check is enabled. +prefs.Validator.ConnectedPickable=Whether this map validator check is enabled. +prefs.Validator.Connection=Whether this map validator check is enabled. prefs.Validator.CustomType=Whether this map validator check is enabled. -prefs.Validator.DoubleLayer=Whether this map validator check is is enabled. -prefs.Validator.DoubleType=Whether this map validator check is is enabled. -prefs.Validator.EmptySpawnPoint=Whether this map validator check is is enabled. -prefs.Validator.Environment=Whether this map validator check is is enabled. -prefs.Validator.Exit=Whether this map validator check is is enabled. -prefs.Validator.MapDifficulty=Whether this map validator check is is enabled. -prefs.Validator.MobOutsideSpawnPoint=Whether this map validator check is is enabled. -prefs.Validator.NonAbsoluteExitPath=Whether this map validator check is is enabled. -prefs.Validator.PaidItemShopSquare=Whether this map validator check is is enabled. -prefs.Validator.ShopSquare=Whether this map validator check is is enabled. -prefs.Validator.Slaying=Whether this map validator check is is enabled. -prefs.Validator.SquareWithoutFloor=Whether this map validator check is is enabled. -prefs.Validator.SysObjectNotOnLayerZero=Whether this map validator check is is enabled. -prefs.Validator.TilePaths=Whether this map validator check is is enabled. -prefs.Validator.UndefinedArchetype=Whether this map validator check is is enabled. -prefs.Validator.UndefinedFace=Whether this map validator check is is enabled. -prefs.Validator.UnsetSlaying=Whether this map validator check is is enabled. +prefs.Validator.DoubleLayer=Whether this map validator check is enabled. +prefs.Validator.DoubleType=Whether this map validator check is enabled. +prefs.Validator.EmptySpawnPoint=Whether this map validator check is enabled. +prefs.Validator.Environment=Whether this map validator check is enabled. +prefs.Validator.Exit=Whether this map validator check is enabled. +prefs.Validator.MapDifficulty=Whether this map validator check is enabled. +prefs.Validator.MobOutsideSpawnPoint=Whether this map validator check is enabled. +prefs.Validator.NonAbsoluteExitPath=Whether this map validator check is enabled. +prefs.Validator.PaidItemShopSquare=Whether this map validator check is enabled. +prefs.Validator.ShopSquare=Whether this map validator check is enabled. +prefs.Validator.Slaying=Whether this map validator check is enabled. +prefs.Validator.SquareWithoutFloor=Whether this map validator check is enabled. +prefs.Validator.SysObjectNotOnLayerZero=Whether this map validator check is enabled. +prefs.Validator.TilePaths=Whether this map validator check is enabled. +prefs.Validator.UndefinedArchetype=Whether this map validator check is enabled. +prefs.Validator.UndefinedFace=Whether this map validator check is enabled. +prefs.Validator.UnsetSlaying=Whether this map validator check is enabled. prefs.WindowState=Main windows''s state (maximized, iconized, etc.) prefs.appClient=Filename of client executable. prefs.appEditor=Filename of external editor executable. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |