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...> - 2010-10-06 21:03:05
|
Revision: 8685 http://gridarta.svn.sourceforge.net/gridarta/?rev=8685&view=rev Author: akirschbaum Date: 2010-10-06 21:02:59 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Simplify XML tag. Modified Paths: -------------- trunk/src/doc/dev/changelog.xslt Modified: trunk/src/doc/dev/changelog.xslt =================================================================== --- trunk/src/doc/dev/changelog.xslt 2010-10-06 20:58:44 UTC (rev 8684) +++ trunk/src/doc/dev/changelog.xslt 2010-10-06 21:02:59 UTC (rev 8685) @@ -85,7 +85,7 @@ <xsl:template match="path"> <li> <xsl:value-of select="@action"/> - <xsl:text></xsl:text> + <xsl:text/> <code> <a href="http://svn.sourceforge.net/viewcvs.cgi/gridarta/{URI:relativize(File:toURI(File:new(System:getProperty('user.dir'))),File:toURI(File:new(substring(., 2))))}"> <xsl:value-of select="."/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:58:52
|
Revision: 8684 http://gridarta.svn.sourceforge.net/gridarta/?rev=8684&view=rev Author: akirschbaum Date: 2010-10-06 20:58:44 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/atrinik/INSTALL.txt trunk/atrinik/README.txt trunk/atrinik/devlib/README.txt trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java trunk/daimonin/README.txt trunk/gridarta.ipr trunk/model/src/app/net/sf/gridarta/model/pickmapsettings/AbstractPickmapSettings.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java Modified: trunk/atrinik/INSTALL.txt =================================================================== --- trunk/atrinik/INSTALL.txt 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/atrinik/INSTALL.txt 2010-10-06 20:58:44 UTC (rev 8684) @@ -1,7 +1,7 @@ How to run the DaimoninEditor: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Simply run the jar file "AtrinikEditor.jar" in the main directory. -In Windows this is done by a doubleclick on "AtrinikEditor.jar". +In Windows this is done by a double click on "AtrinikEditor.jar". In Linux/Unix you type in the console: "java -jar AtrinikEditor.jar". The java runtime will be enough to run the client. Download it automatically Modified: trunk/atrinik/README.txt =================================================================== --- trunk/atrinik/README.txt 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/atrinik/README.txt 2010-10-06 20:58:44 UTC (rev 8684) @@ -14,7 +14,7 @@ </project> The third way probably is the preferred way by vi / vim users, because the -build.xml is searched in current file upwards path, not subdirectories. +build.xml is searched in current file upwards path, not sub-directories. developer.properties Modified: trunk/atrinik/devlib/README.txt =================================================================== --- trunk/atrinik/devlib/README.txt 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/atrinik/devlib/README.txt 2010-10-06 20:58:44 UTC (rev 8684) @@ -4,7 +4,7 @@ currently: * Checkstyle - Tool to veryify code conventions + Tool to verify code conventions http://checkstyle.sf.net/ * Jalopy Tool to beautify Java code, similar to indent for C @@ -19,5 +19,5 @@ If you are interested in using them, you could copy the checkstyle-3.5-all.jar file and jalopy directory here or create a user.properties file in the editor -base directory which overrides the default pahts from build.xml to point to the +base directory which overrides the default paths from build.xml to point to the location where these tools already are installed on your system. Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java 2010-10-06 20:58:44 UTC (rev 8684) @@ -60,7 +60,7 @@ */ String PICKMAP_DIR = "dev/editor/pickmaps"; - String ARCHDEF_FILE = "archdef.dat"; // position-data of multiparts + String ARCHDEF_FILE = "archdef.dat"; // position-data of multi-parts // name of the arch resource files (these get read and written in the arch dir) Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2010-10-06 20:58:44 UTC (rev 8684) @@ -330,7 +330,7 @@ * @param gameObjectFactory the game object factory for creating new game * object instances * @param gameObjectMatchers the game object matchers to use - * @param archetypeSet the archetype set for lookin up archetypes + * @param archetypeSet the archetype set for looking up archetypes */ public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { super(gameObjectFactory, gameObjectMatchers, archetypeSet); Modified: trunk/daimonin/README.txt =================================================================== --- trunk/daimonin/README.txt 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/daimonin/README.txt 2010-10-06 20:58:44 UTC (rev 8684) @@ -14,7 +14,7 @@ </project> The third way probably is the preferred way by vi / vim users, because the -build.xml is searched in current file upwards path, not subdirectories. +build.xml is searched in current file upwards path, not sub-directories. developer.properties Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/gridarta.ipr 2010-10-06 20:58:44 UTC (rev 8684) @@ -1190,6 +1190,7 @@ <w>conf</w> <w>covariant</w> <w>crossedit</w> + <w>ctags</w> <w>cvsroot</w> <w>daimonin</w> <w>daimonin's</w> @@ -1377,12 +1378,14 @@ <w>unsets</w> <w>unsynchronized</w> <w>unwielded</w> + <w>username</w> <w>validator's</w> <w>validator...</w> <w>variable's</w> <w>viegas</w> <w>viewcvs</w> <w>viewport</w> + <w>vogel</w> <w>vogl</w> <w>waypoint</w> <w>webstart</w> Modified: trunk/model/src/app/net/sf/gridarta/model/pickmapsettings/AbstractPickmapSettings.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/pickmapsettings/AbstractPickmapSettings.java 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/model/src/app/net/sf/gridarta/model/pickmapsettings/AbstractPickmapSettings.java 2010-10-06 20:58:44 UTC (rev 8684) @@ -78,7 +78,7 @@ } /** - * Informs all registered listeners that the immutrable state has changed. + * Informs all registered listeners that the immutable state has changed. */ private void fireLockedChanged() { for (final PickmapSettingsListener listener : listenerList.getListeners()) { Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java 2010-10-06 20:58:44 UTC (rev 8684) @@ -149,7 +149,7 @@ if (deselected == null) { deselected = archetypeType.getTypeName(); } - if (JOptionPane.showConfirmDialog(gameObjectAttributesDialog, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) { + if (JOptionPane.showConfirmDialog(gameObjectAttributesDialog, "Do you really want to change the type of this\n" + "object from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) { // change is confirmed, now get it on... archetypeType = newType; Modified: trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java 2010-10-06 20:58:44 UTC (rev 8684) @@ -124,7 +124,7 @@ } /** - * Registeres a {@link MapManager} to track. + * Registers a {@link MapManager} to track. * @param mapManager the map manager to track */ public void addMapManager(@NotNull final MapManager<G, A, R> mapManager) { Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2010-10-06 20:48:46 UTC (rev 8683) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2010-10-06 20:58:44 UTC (rev 8684) @@ -250,7 +250,7 @@ /** * Creates a new instance. - * @param mapModel the tracked map map mpdel + * @param mapModel the tracked map map model */ private PickmapChooserMapModelListener(@NotNull final MapModel<G, A, R> mapModel) { this.mapModel = mapModel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:48:53
|
Revision: 8683 http://gridarta.svn.sourceforge.net/gridarta/?rev=8683&view=rev Author: akirschbaum Date: 2010-10-06 20:48:46 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Fix unchecked cast. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-06 20:44:47 UTC (rev 8682) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-06 20:48:46 UTC (rev 8683) @@ -280,7 +280,14 @@ @NotNull @Override public G getTopContainer() { - return container != null && container instanceof GameObject ? ((GameObject<G, A, R>) container).getTopContainer() : getThis(); + if (container != null) { + final G gameObject = container.asGameObject(); + if (gameObject != null) { + return gameObject.getTopContainer(); + } + } + + return getThis(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:44:54
|
Revision: 8682 http://gridarta.svn.sourceforge.net/gridarta/?rev=8682&view=rev Author: akirschbaum Date: 2010-10-06 20:44:47 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Fix unchecked cast. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-06 20:29:25 UTC (rev 8681) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-06 20:44:47 UTC (rev 8682) @@ -175,6 +175,15 @@ /** * {@inheritDoc} */ + @Nullable + @Override + public G asGameObject() { + return null; + } + + /** + * {@inheritDoc} + */ @NotNull @Override public G newInstance(@NotNull final GameObjectFactory<G, A, R> gameObjectFactory) { Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-10-06 20:29:25 UTC (rev 8681) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-10-06 20:44:47 UTC (rev 8682) @@ -638,6 +638,14 @@ protected abstract void setThisContainer(@NotNull final G gameObject); /** + * Returns this instance as a {@link GameObject} or <code>null</code> if + * this instance is not a game object. + * @return this instance or <code>null</code> + */ + @Nullable + public abstract G asGameObject(); + + /** * An iterator for iterating over a list in reverse order. * @todo move this class to JAPI */ Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-06 20:29:25 UTC (rev 8681) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-06 20:44:47 UTC (rev 8682) @@ -119,6 +119,15 @@ */ @NotNull @Override + public G asGameObject() { + return getThis(); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override public G newInstance(@NotNull final GameObjectFactory<G, A, R> gameObjectFactory) { return gameObjectFactory.cloneGameObject(getThis()); } @@ -262,7 +271,7 @@ @Nullable @Override public G getContainerGameObject() { - return container != null && container instanceof GameObject ? (G) container : null; + return container == null ? null : container.asGameObject(); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java 2010-10-06 20:29:25 UTC (rev 8681) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java 2010-10-06 20:44:47 UTC (rev 8682) @@ -141,6 +141,15 @@ } /** + * {@inheritDoc} + */ + @Nullable + @Override + public G asGameObject() { + return null; + } + + /** * Returns the last occurrence of a matching game object. * @param gameObjectMatcher the matcher to use * @return the last match, or <code>null</code> if no such game object This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:29:32
|
Revision: 8681 http://gridarta.svn.sourceforge.net/gridarta/?rev=8681&view=rev Author: akirschbaum Date: 2010-10-06 20:29:25 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Rename CloseableTabbedPane.ClosingListener to ClosingListener. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/script/ClosingListener.java Modified: trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java 2010-10-06 20:25:18 UTC (rev 8680) +++ trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java 2010-10-06 20:29:25 UTC (rev 8681) @@ -47,8 +47,6 @@ package net.sf.gridarta.gui.script; import java.awt.Component; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; import javax.swing.ImageIcon; import javax.swing.JTabbedPane; import org.jetbrains.annotations.NotNull; @@ -71,7 +69,7 @@ public CloseableTabbedPane(@Nullable final ImageIcon closingIcon) { this.closingIcon = closingIcon; - addMouseListener(new ClosingListener()); + addMouseListener(new ClosingListener(this)); } public void addCloseableTab(@NotNull final String title, @NotNull final Component component, final boolean closeable) { @@ -88,29 +86,4 @@ addCloseableTab(title, component, true); } - private class ClosingListener extends MouseAdapter { - - /** - * {@inheritDoc} - * @noinspection RefusedBequest - */ - @Override - public void mouseReleased(@NotNull final MouseEvent e) { - final int i = getSelectedIndex(); - - // nothing selected - if (i == -1) { - return; - } - - final ClosingIcon icon = (ClosingIcon) getIconAt(i); - - // close tab, if icon was clicked - if (icon != null && icon.contains(e.getX(), e.getY())) { - removeTabAt(i); - } - } - - } // class ClosingListener - } // class CloseableTabbedPane Added: trunk/src/app/net/sf/gridarta/gui/script/ClosingListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ClosingListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/script/ClosingListener.java 2010-10-06 20:29:25 UTC (rev 8681) @@ -0,0 +1,64 @@ +/* + * 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.gui.script; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JTabbedPane; +import org.jetbrains.annotations.NotNull; + +public class ClosingListener extends MouseAdapter { + + /** + * The {@link JTabbedPane} to close. + */ + @NotNull + private final JTabbedPane tabbedPane; + + /** + * Creates a new instance. + * @param tabbedPane the tabbed pane to close + */ + public ClosingListener(@NotNull final JTabbedPane tabbedPane) { + this.tabbedPane = tabbedPane; + } + + /** + * {@inheritDoc} + * @noinspection RefusedBequest + */ + @Override + public void mouseReleased(@NotNull final MouseEvent e) { + final int i = tabbedPane.getSelectedIndex(); + + // nothing selected + if (i == -1) { + return; + } + + final ClosingIcon icon = (ClosingIcon) tabbedPane.getIconAt(i); + + // close tab, if icon was clicked + if (icon != null && icon.contains(e.getX(), e.getY())) { + tabbedPane.removeTabAt(i); + } + } + +} // class ClosingListener Property changes on: trunk/src/app/net/sf/gridarta/gui/script/ClosingListener.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...> - 2010-10-06 20:25:25
|
Revision: 8680 http://gridarta.svn.sourceforge.net/gridarta/?rev=8680&view=rev Author: akirschbaum Date: 2010-10-06 20:25:18 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Do not consider widening conversions as warnings. Modified Paths: -------------- trunk/gridarta.ipr Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-10-06 20:22:57 UTC (rev 8679) +++ trunk/gridarta.ipr 2010-10-06 20:25:18 UTC (rev 8680) @@ -312,7 +312,7 @@ </inspection_tool> <inspection_tool class="IfStatementWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="ImplicitNumericConversion" enabled="true" level="WARNING" enabled_by_default="true"> - <option name="ignoreWideningConversions" value="false" /> + <option name="ignoreWideningConversions" value="true" /> <option name="ignoreCharConversions" value="false" /> <option name="ignoreConstantConversions" value="false" /> </inspection_tool> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:23:04
|
Revision: 8679 http://gridarta.svn.sourceforge.net/gridarta/?rev=8679&view=rev Author: akirschbaum Date: 2010-10-06 20:22:57 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Remove unused class ErrorHandler. Removed Paths: ------------- trunk/src/app/net/sf/gridarta/validation/ErrorHandler.java Deleted: trunk/src/app/net/sf/gridarta/validation/ErrorHandler.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/ErrorHandler.java 2010-10-06 20:18:11 UTC (rev 8678) +++ trunk/src/app/net/sf/gridarta/validation/ErrorHandler.java 2010-10-06 20:22:57 UTC (rev 8679) @@ -1,40 +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.validation; - -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.validation.ErrorCollector; -import org.jetbrains.annotations.NotNull; - -/** - * Interface for classes that can handle map validation errors. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public interface ErrorHandler<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - - /** - * Set new errors to be handled. - * @param errors errors to be handled - */ - void setErrors(@NotNull ErrorCollector<G, A, R> errors); - -} // interface ErrorHandler This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:18:18
|
Revision: 8678 http://gridarta.svn.sourceforge.net/gridarta/?rev=8678&view=rev Author: akirschbaum Date: 2010-10-06 20:18:11 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Remove redundant declarations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java Modified: trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java 2010-10-06 20:16:38 UTC (rev 8677) +++ trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java 2010-10-06 20:18:11 UTC (rev 8678) @@ -118,12 +118,6 @@ /** * {@inheritDoc} */ - @Override - public abstract boolean setStringValue(@NotNull final String value); - - /** - * {@inheritDoc} - */ @NotNull @Override public Element toXML() { @@ -152,14 +146,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public abstract String getParameterType(); - - /** - * {@inheritDoc} - */ - @Override public void addChangeListener(@NotNull final ChangeListener listener) { listeners.add(listener); } @@ -179,10 +166,4 @@ } } - /** - * {@inheritDoc} - */ - @Override - public abstract void visit(@NotNull final PluginParameterVisitor<G, A, R> visitor); - } // class PluginParameter This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:16:47
|
Revision: 8677 http://gridarta.svn.sourceforge.net/gridarta/?rev=8677&view=rev Author: akirschbaum Date: 2010-10-06 20:16:38 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Fix some HTML issues. Modified Paths: -------------- trunk/atrinik/resource/resource/HelpFiles/tut_copypaste.html trunk/atrinik/resource/resource/HelpFiles/tut_map.html trunk/atrinik/resource/resource/HelpFiles/tut_mapattr.html trunk/atrinik/resource/resource/HelpFiles/tut_view.html trunk/crossfire/resource/resource/HelpFiles/faq.html trunk/crossfire/resource/resource/HelpFiles/map_otcs.html trunk/crossfire/resource/resource/HelpFiles/map_quests.html trunk/crossfire/resource/resource/HelpFiles/start.html trunk/crossfire/resource/resource/HelpFiles/treasure_one.html trunk/crossfire/resource/resource/HelpFiles/treasurelists.html trunk/crossfire/resource/resource/HelpFiles/tut_copypaste.html trunk/crossfire/resource/resource/HelpFiles/tut_map.html trunk/crossfire/resource/resource/HelpFiles/tut_pickmaps.html trunk/crossfire/resource/resource/HelpFiles/tut_view.html trunk/daimonin/resource/resource/HelpFiles/tut_copypaste.html trunk/daimonin/resource/resource/HelpFiles/tut_map.html trunk/daimonin/resource/resource/HelpFiles/tut_mapattr.html trunk/daimonin/resource/resource/HelpFiles/tut_view.html Modified: trunk/atrinik/resource/resource/HelpFiles/tut_copypaste.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_copypaste.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/atrinik/resource/resource/HelpFiles/tut_copypaste.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -77,7 +77,8 @@ not empty, the new arches will get inserted either above top (-> Fill Above), or below bottom (-> Fill below). </P> -<P>Both fill commands can be used in two different ways: +<P>Both fill commands can be used in two different ways:</P> + <ol> <LI> Select *one* empty square and hit fill: All empty squares adjacent to the selected one will get floodfilled. @@ -85,7 +86,6 @@ arch will be inserted on top of (or below) every square within the selected area. </ol> -</P> </BODY> </HTML> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_map.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_map.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/atrinik/resource/resource/HelpFiles/tut_map.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -30,17 +30,18 @@ <H1 align=center>Basics for Designing a Map</H1> <P>Once you have opened a map, you can start to shape and modify it. You can do - the following actions with your mouse: + the following actions with your mouse:</P> + <UL> <LI>left mouse button: select object(s) <LI>right mouse button: insert an object <LI>middle mouse button: delete an object </UL> -If your mouse has less than three buttons, you can simulate the missing buttons -by holding <shift> or <ctrl>: -<br> -right-click = "click & <shift>" and middle-click = "click & -<ctrl>".</P> +<P>If your mouse has less than three buttons, you can simulate the missing + buttons by holding <shift> or <ctrl>: + <br> + right-click = "click & <shift>" and middle-click = "click & <ctrl>". +</P> <P> To <B>select</B> an object, left click on it. You can do so either on the Modified: trunk/atrinik/resource/resource/HelpFiles/tut_mapattr.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_mapattr.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/atrinik/resource/resource/HelpFiles/tut_mapattr.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -120,7 +120,8 @@ <P> There are three flags for special death modes. (These flags are exclusive, - you should never set more than one): + you should never set more than one):</P> + <UL> <LI><B>Permanent Death</B>: When a player dies he stays dead. An indestructible corpse of his body remains on the ground though. When @@ -138,7 +139,6 @@ revived. </LI> </UL> -</P> </BODY> </HTML> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_view.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_view.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/atrinik/resource/resource/HelpFiles/tut_view.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -30,13 +30,13 @@ <H1 align=center>The View Settings</H1> <P> - Under the View-menu, you'll find three types of view settings: + Under the View-menu, you'll find three types of view settings:</P> + <ol> <LI>the layout settings <LI>an option to change font <LI>the map settings </ol> -</P> <P> With the <B>layout setting</B> (Metal/CDE/Windows) you can change the Modified: trunk/crossfire/resource/resource/HelpFiles/faq.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/faq.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/faq.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -75,7 +75,8 @@ <P>Add it to <A href="http://sourceforge.net/tracker/?group_id=166996&atid=841182">Gridarta's bug tracker</A> on the project homepage. To enable us to fix the bug, be - sure to at least + sure to at least</P> + <UL> <LI>set the Category to "crossfire editor", <LI>include the application version (as found in Help|About), @@ -83,7 +84,6 @@ behavior), and <LI>describe what we have to do to make the bug happen. </UL> -</P> <P><B>The editor is missing a useful feature. Can you add it?</B></P> Modified: trunk/crossfire/resource/resource/HelpFiles/map_otcs.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/map_otcs.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/map_otcs.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -43,6 +43,7 @@ <P>There are two "layers" for the Crossfire objects (see <A HREF="tut_objects.html">manipulating objects</A>):</P> + <ol> <LI><b>The archetype syntax</b> - plain and ugly <br> @@ -74,8 +75,9 @@ <IMG SRC="attrib_window.jpg" WIDTH="298" HEIGHT="352" ALIGN="CENTER"> </P> </ol> -Apart from that, I recommend you to look at existing maps. Look how it's done, -copy and experiment...</P> +<P>Apart from that, I recommend you to look at existing maps. Look how it's + done, copy and experiment...</P> + <br> </BODY> </HTML> Modified: trunk/crossfire/resource/resource/HelpFiles/map_quests.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/map_quests.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/map_quests.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -43,7 +43,6 @@ <P>The following chapters explain some of the key concepts for assembling really nice quests. (Unfortunately they are not yet written :-P)</P> -<P> <ol> <LI>Boss Monsters</LI> <LI>Reward</LI> @@ -53,7 +52,6 @@ <LI>Secrets</LI> <LI>Emphasize Team Play</LI> </ol> -</P> </BODY> </HTML> Modified: trunk/crossfire/resource/resource/HelpFiles/start.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/start.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/start.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -40,8 +40,6 @@ <LI><A HREF="credits.html">Credits</A> <LI><A HREF="faq.html">Crossfire Editor Help FAQ</A> <LI><A HREF="guide.html">General Guidelines for Map-making</A> - - <P> <LI>Tutorial: How to use the Editor <ol> <LI><A HREF="tut_loading.html">Loading archetypes and maps</A> @@ -55,7 +53,6 @@ <LI><A HREF="tut_view.html">The View settings</A> <LI><A HREF="treasurelists.html">Treasurelists</A> </ol> - </P> <LI>Guide: How to design Maps <ol> <LI><A HREF="map_start.html">Where should I start?</A> Modified: trunk/crossfire/resource/resource/HelpFiles/treasure_one.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/treasure_one.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/treasure_one.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -37,7 +37,6 @@ <h2>Examples for treasurelists producing one item</h2> -<p> <table border="1"> <tr> <td> @@ -48,7 +47,6 @@ </td> </tr> </table> -</p> <p>As you can see in the right hand side example, treasurelists may contain yet other treasurelists. If chosen, such sub-lists get processed in recursive Modified: trunk/crossfire/resource/resource/HelpFiles/treasurelists.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/treasurelists.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/treasurelists.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -43,13 +43,11 @@ <h2>Contents</h2> -<p> <ol> <li><a href="treasure_one.html">Treasurelists producing one item</a> <li><a href="treasure_multi.html">Treasurelists producing multiple items</a> <li><a href="treasure_special.html">Special treasurelists</a> </ol> -</p> <p>To read more, select one of the links above.</p> Modified: trunk/crossfire/resource/resource/HelpFiles/tut_copypaste.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_copypaste.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/tut_copypaste.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -82,7 +82,8 @@ <h2>Fill</h2> <p> - There are different fill commands: + There are different fill commands:</p> + <ul> <li>Fill Above: if the selected map square is not empty, insert the new game object above @@ -95,7 +96,6 @@ <li>Floodfill: if the cursor is on an empty map square, fills the cursor map square and all adjacent empty map squares </ul> -</p> </BODY> </HTML> Modified: trunk/crossfire/resource/resource/HelpFiles/tut_map.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_map.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/tut_map.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -30,13 +30,13 @@ <p> Once you have opened a map, you can start to shape and modify it. You can do - the following actions with your mouse: + the following actions with your mouse:</p> + <ul> <li>left mouse button: <a href="#select">select game object(s)</a> <li>right mouse button: <a href="#insert">insert an game object</a> <li>middle mouse button: <a href="#delete">delete an game object</a> </ul> -</p> <h2><a name="select">Selecting game object</a></h2> Modified: trunk/crossfire/resource/resource/HelpFiles/tut_pickmaps.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_pickmaps.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/tut_pickmaps.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -39,7 +39,8 @@ <h2>Selecting an game object to insert</h2> -<p>There are different ways to select game object(s) from pickmaps: +<p>There are different ways to select game object(s) from pickmaps:</p> + <ul> <li>Exactly one selected game object: inserts this game object <li>Multiple selected game objects: inserts a random game object from the @@ -47,7 +48,6 @@ <li>No selected game objects: inserts a random game object from all game objects in the pickmap </ul> -</p> <h2>Modifying a pickmap</h2> Modified: trunk/crossfire/resource/resource/HelpFiles/tut_view.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_view.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/crossfire/resource/resource/HelpFiles/tut_view.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -28,12 +28,12 @@ <h1>The view settings</h1> -<p>Under the View-menu, you'll find three types of view settings: +<p>Under the View-menu, you'll find three types of view settings:</p> + <ol> <li><a href="layout">the layout settings</a> <li><a href="view">the map view settings</a> </ol> -</p> <h2><a name="layout">The layout settings</a></h2> Modified: trunk/daimonin/resource/resource/HelpFiles/tut_copypaste.html =================================================================== --- trunk/daimonin/resource/resource/HelpFiles/tut_copypaste.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/daimonin/resource/resource/HelpFiles/tut_copypaste.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -77,7 +77,8 @@ not empty, the new arches will get inserted either above top (-> Fill Above), or below bottom (-> Fill below). </P> -<P>Both fill commands can be used in two different ways: +<P>Both fill commands can be used in two different ways:</P> + <ol> <LI> Select *one* empty square and hit fill: All empty squares adjacent to the selected one will get floodfilled. @@ -85,7 +86,6 @@ arch will be inserted on top of (or below) every square within the selected area. </ol> -</P> </BODY> </HTML> Modified: trunk/daimonin/resource/resource/HelpFiles/tut_map.html =================================================================== --- trunk/daimonin/resource/resource/HelpFiles/tut_map.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/daimonin/resource/resource/HelpFiles/tut_map.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -30,17 +30,18 @@ <H1 align=center>Basics for Designing a Map</H1> <P>Once you have opened a map, you can start to shape and modify it. You can do - the following actions with your mouse: + the following actions with your mouse:</P> + <UL> <LI>left mouse button: select object(s) <LI>right mouse button: insert an object <LI>middle mouse button: delete an object </UL> -If your mouse has less than three buttons, you can simulate the missing buttons -by holding <shift> or <ctrl>: -<br> -right-click = "click & <shift>" and middle-click = "click & -<ctrl>".</P> +<P>If your mouse has less than three buttons, you can simulate the missing + buttons by holding <shift> or <ctrl>: + <br> + right-click = "click & <shift>" and middle-click = "click & <ctrl>". +</P> <P> To <B>select</B> an object, left click on it. You can do so either on the Modified: trunk/daimonin/resource/resource/HelpFiles/tut_mapattr.html =================================================================== --- trunk/daimonin/resource/resource/HelpFiles/tut_mapattr.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/daimonin/resource/resource/HelpFiles/tut_mapattr.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -120,7 +120,8 @@ <P> There are three flags for special death modes. (These flags are exclusive, - you should never set more than one): + you should never set more than one):</P> + <UL> <LI><B>Permanent Death</B>: When a player dies he stays dead. An indestructible corpse of his body remains on the ground though. When @@ -138,7 +139,6 @@ revived. </LI> </UL> -</P> </BODY> </HTML> Modified: trunk/daimonin/resource/resource/HelpFiles/tut_view.html =================================================================== --- trunk/daimonin/resource/resource/HelpFiles/tut_view.html 2010-10-06 20:10:00 UTC (rev 8676) +++ trunk/daimonin/resource/resource/HelpFiles/tut_view.html 2010-10-06 20:16:38 UTC (rev 8677) @@ -30,13 +30,13 @@ <H1 align=center>The View Settings</H1> <P> - Under the View-menu, you'll find three types of view settings: + Under the View-menu, you'll find three types of view settings:</P> + <ol> <LI>the layout settings <LI>an option to change font <LI>the map settings </ol> -</P> <P> With the <B>layout setting</B> (Metal/CDE/Windows) you can change the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:10:07
|
Revision: 8676 http://gridarta.svn.sourceforge.net/gridarta/?rev=8676&view=rev Author: akirschbaum Date: 2010-10-06 20:10:00 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Rename TokenMarker.LineInfo to LineInfo. Modified Paths: -------------- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java Added Paths: ----------- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LineInfo.java Added: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LineInfo.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LineInfo.java (rev 0) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LineInfo.java 2010-10-06 20:10:00 UTC (rev 8676) @@ -0,0 +1,72 @@ +/* + * 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.textedit.textarea.tokenmarker; + +/** + * Stores information about tokenized lines. + * @author Slava Pestov + * @author Andreas Kirschbaum + */ +public class LineInfo { + + /** + * Creates a new LineInfo object with token = Token.NULL and obj = + * null. + */ + public LineInfo() { + } + + /** + * Creates a new LineInfo object with the specified parameters. + */ + public LineInfo(final byte token, final Object obj) { + this.token = token; + this.obj = obj; + } + + /** + * The id of the last token of the line. + */ + private byte token; + + /** + * This is for use by the token marker implementations themselves. It + * can be used to store anything that is an object and that needs to + * exist on a per-line basis. + */ + private Object obj; + + public byte getToken() { + return token; + } + + public void setToken(final byte token) { + this.token = token; + } + + public Object getObj() { + return obj; + } + + public void setObj(final Object obj) { + this.obj = obj; + } + +} // class LineInfo Property changes on: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LineInfo.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java 2010-10-06 20:06:48 UTC (rev 8675) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java 2010-10-06 20:10:00 UTC (rev 8676) @@ -239,54 +239,4 @@ tokens.add(new Token(length, id)); } - /** - * Inner class for storing information about tokenized lines. - */ - public static class LineInfo { - - /** - * Creates a new LineInfo object with token = Token.NULL and obj = - * null. - */ - public LineInfo() { - } - - /** - * Creates a new LineInfo object with the specified parameters. - */ - public LineInfo(final byte token, final Object obj) { - this.token = token; - this.obj = obj; - } - - /** - * The id of the last token of the line. - */ - private byte token; - - /** - * This is for use by the token marker implementations themselves. It - * can be used to store anything that is an object and that needs to - * exist on a per-line basis. - */ - private Object obj; - - public byte getToken() { - return token; - } - - public void setToken(final byte token) { - this.token = token; - } - - public Object getObj() { - return obj; - } - - public void setObj(final Object obj) { - this.obj = obj; - } - - } // class LineInfo - } // class TokenMarker This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:06:58
|
Revision: 8675 http://gridarta.svn.sourceforge.net/gridarta/?rev=8675&view=rev Author: akirschbaum Date: 2010-10-06 20:06:48 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Rename FindAgain.Type to FindType. Modified Paths: -------------- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Find.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindAgain.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java Added Paths: ----------- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindType.java Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Find.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Find.java 2010-10-06 20:04:25 UTC (rev 8674) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Find.java 2010-10-06 20:06:48 UTC (rev 8675) @@ -52,7 +52,7 @@ */ @Override public void actionPerformed(final ActionEvent e) { - Actions.FIND_AGAIN.setType(FindAgain.Type.FIND); + Actions.FIND_AGAIN.setType(FindType.FIND); final JEditTextArea textArea = InputHandler.getTextArea(e); final String selectedText = textArea.getSelectedText(); final String text = (String) JOptionPane.showInputDialog(textArea, ActionBuilderUtils.getString(ACTION_BUILDER, "scriptEdit.find.text"), ActionBuilderUtils.getString(ACTION_BUILDER, "scriptEdit.find.title"), JOptionPane.PLAIN_MESSAGE, null, null, selectedText != null ? selectedText : textToFind); Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindAgain.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindAgain.java 2010-10-06 20:04:25 UTC (rev 8674) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindAgain.java 2010-10-06 20:06:48 UTC (rev 8675) @@ -45,30 +45,9 @@ /** * The action to perform. */ - private Type type = Type.NONE; + private FindType type = FindType.NONE; /** - * The action to perform. - */ - public enum Type { - - /** - * No action. - */ - NONE, - - /** - * Find again. - */ - FIND, - - /** - * Replace again. - */ - REPLACE - } - - /** * Create a new instance. * @param find The <code>Find</code> instance to forward to. * @param replace The <code>Replace</code> instance to forward to. @@ -101,7 +80,7 @@ * Set the operation to perform. * @param type The operation to perform. */ - public void setType(final Type type) { + public void setType(final FindType type) { this.type = type; } Added: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindType.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindType.java (rev 0) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindType.java 2010-10-06 20:06:48 UTC (rev 8675) @@ -0,0 +1,43 @@ +/* + * 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.textedit.textarea.actions; + +/** + * The action to perform. + * @author Andreas Kirschbaum + */ +public enum FindType { + + /** + * No action. + */ + NONE, + + /** + * Find again. + */ + FIND, + + /** + * Replace again. + */ + REPLACE + +} // enum FindType Property changes on: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FindType.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java 2010-10-06 20:04:25 UTC (rev 8674) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java 2010-10-06 20:06:48 UTC (rev 8675) @@ -70,7 +70,7 @@ */ @Override public void actionPerformed(final ActionEvent e) { - Actions.FIND_AGAIN.setType(FindAgain.Type.REPLACE); + Actions.FIND_AGAIN.setType(FindType.REPLACE); final JEditTextArea textArea = InputHandler.getTextArea(e); final ReplaceDialog pane = new ReplaceDialog(textArea); pane.dialog = pane.createDialog(textArea, ActionBuilderUtils.getString(ACTION_BUILDER, "scriptEdit.replace.title")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:04:32
|
Revision: 8674 http://gridarta.svn.sourceforge.net/gridarta/?rev=8674&view=rev Author: akirschbaum Date: 2010-10-06 20:04:25 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Make field private. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-10-06 20:00:34 UTC (rev 8673) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-10-06 20:04:25 UTC (rev 8674) @@ -1008,7 +1008,7 @@ */ public final void buildAttribute() { tabbedPane.removeAll(); - final ArchetypeType archetypeType = typesBoxItemListener.archetypeType; + final ArchetypeType archetypeType = typesBoxItemListener.getArchetypeType(); for (int sectionId = 0; sectionId < archetypeType.getSectionNum(); sectionId++) { final Component panel = makeAttributePanel(sectionId); if (panel != null) { @@ -1035,7 +1035,7 @@ boolean hasBitmask = false; // true if this section contains a bitmask attribute // first we check how many attributes this section has - for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.archetypeType) { + for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.getArchetypeType()) { if (archetypeAttribute.getSectionId() == sectionId) { // count number of attributes if (!(archetypeAttribute instanceof ArchetypeAttributeFixed)) { @@ -1071,7 +1071,7 @@ boolean isText = false; // now add the entries, line by line - for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.archetypeType) { + for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.getArchetypeType()) { if (archetypeAttribute.getSectionId() == sectionId && !(archetypeAttribute instanceof ArchetypeAttributeFixed)) { final AbstractButton helpButton = new JButton("?"); helpButton.setMargin(new Insets(0, 5, 0, 5)); @@ -1132,7 +1132,7 @@ */ @ActionMethod public void attribHelp() { - final ArchetypeType archetypeType = typesBoxItemListener.archetypeType; + final ArchetypeType archetypeType = typesBoxItemListener.getArchetypeType(); final String helpText = ACTION_BUILDER.format("arcDoc.htmlText", archetypeType.getTypeName(), archetypeType.getDescription(), archetypeType.getUse()); new Help(/* XXX */ parent, helpText).setVisible(true); } @@ -1239,7 +1239,7 @@ } // Also write all the 'fixed' attributes into the archetype text - for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.archetypeType) { + for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.getArchetypeType()) { // ### TODO: for changed types, copy fixed attributes over default arches ### if (archetypeAttribute instanceof ArchetypeAttributeFixed) { final String defaultValue = archetype.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java 2010-10-06 20:00:34 UTC (rev 8673) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java 2010-10-06 20:04:25 UTC (rev 8674) @@ -83,7 +83,7 @@ * @serial */ @NotNull - public ArchetypeType archetypeType; + private ArchetypeType archetypeType; /** * The latest deselected item. @@ -174,4 +174,13 @@ } } + /** + * Returns a reference to the type data. + * @return the reference + */ + @NotNull + public ArchetypeType getArchetypeType() { + return archetypeType; + } + } // class TypesBoxItemListener This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:00:42
|
Revision: 8673 http://gridarta.svn.sourceforge.net/gridarta/?rev=8673&view=rev Author: akirschbaum Date: 2010-10-06 20:00:34 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-10-06 19:53:05 UTC (rev 8672) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-10-06 20:00:34 UTC (rev 8673) @@ -1008,10 +1008,11 @@ */ public final void buildAttribute() { tabbedPane.removeAll(); - for (int sectionId = 0; sectionId < typesBoxItemListener.archetypeType.getSectionNum(); sectionId++) { + final ArchetypeType archetypeType = typesBoxItemListener.archetypeType; + for (int sectionId = 0; sectionId < archetypeType.getSectionNum(); sectionId++) { final Component panel = makeAttributePanel(sectionId); if (panel != null) { - final String sectionName = typesBoxItemListener.archetypeType.getSectionName(sectionId); + final String sectionName = archetypeType.getSectionName(sectionId); tabbedPane.addTab(sectionName, null, panel); } } @@ -1131,7 +1132,8 @@ */ @ActionMethod public void attribHelp() { - final String helpText = ACTION_BUILDER.format("arcDoc.htmlText", typesBoxItemListener.archetypeType.getTypeName(), typesBoxItemListener.archetypeType.getDescription(), typesBoxItemListener.archetypeType.getUse()); + final ArchetypeType archetypeType = typesBoxItemListener.archetypeType; + final String helpText = ACTION_BUILDER.format("arcDoc.htmlText", archetypeType.getTypeName(), archetypeType.getDescription(), archetypeType.getUse()); new Help(/* XXX */ parent, helpText).setVisible(true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 19:53:12
|
Revision: 8672 http://gridarta.svn.sourceforge.net/gridarta/?rev=8672&view=rev Author: akirschbaum Date: 2010-10-06 19:53:05 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Make field private. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-10-06 19:17:06 UTC (rev 8671) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-10-06 19:53:05 UTC (rev 8672) @@ -115,7 +115,7 @@ * The JTextFields with the tile paths. */ @NotNull - public final MapTilePanel[] tilePaths; + private final MapTilePanel[] tilePaths; @NotNull private final AttachTiledMaps<G, A, R> attachTiledMaps; @@ -293,4 +293,14 @@ } } + /** + * Returns one tile path. + * @param direction the direction + * @return the tile path + */ + @NotNull + public MapTilePanel getTilePath(final int direction) { + return tilePaths[direction]; + } + } // class AbstractMapTilePane Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-10-06 19:17:06 UTC (rev 8671) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-10-06 19:53:05 UTC (rev 8672) @@ -58,7 +58,7 @@ @Override public void actionPerformed(@NotNull final ActionEvent e) { tilePanel.updateRAState(); - ((AbstractMapTilePane<?, ?, ?>) tilePanel.getParent().getParent()).tilePaths[nextFocus[direction]].tilePanel.activateTextField(); + ((AbstractMapTilePane<?, ?, ?>) tilePanel.getParent().getParent()).getTilePath(nextFocus[direction]).tilePanel.activateTextField(); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 19:17:12
|
Revision: 8671 http://gridarta.svn.sourceforge.net/gridarta/?rev=8671&view=rev Author: akirschbaum Date: 2010-10-06 19:17:06 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Make field private. Modified Paths: -------------- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2010-10-06 19:11:18 UTC (rev 8670) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2010-10-06 19:17:06 UTC (rev 8671) @@ -156,8 +156,7 @@ } if ((modifiers & ~InputEvent.SHIFT_MASK) != 0 || e.isActionKey() || keyCode == KeyEvent.VK_BACK_SPACE || keyCode == KeyEvent.VK_DELETE || keyCode == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ESCAPE) { - if (grabAction != null) { - handleGrabAction(e); + if (handleGrabAction(e)) { return; } @@ -188,8 +187,7 @@ return; } - if (grabAction != null) { - handleGrabAction(e); + if (handleGrabAction(e)) { return; } Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java 2010-10-06 19:11:18 UTC (rev 8670) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java 2010-10-06 19:17:06 UTC (rev 8671) @@ -40,7 +40,7 @@ private static final Category log = Logger.getLogger(InputHandler.class); @Nullable - protected ActionListener grabAction = null; + private ActionListener grabAction = null; private boolean repeat = false; @@ -196,13 +196,19 @@ * appropriate key event. It executes the grab action with the typed * character as the parameter. * @param evt The KeyEvent the key should be grabbed of + * @return whether a grab action was active */ - protected void handleGrabAction(final KeyEvent evt) { + protected boolean handleGrabAction(final KeyEvent evt) { + if (grabAction == null) { + return false; + } + // Clear it *before* it is executed so that executeAction() // resets the repeat count final ActionListener grabAction2 = grabAction; grabAction = null; executeAction(grabAction2, evt.getSource(), String.valueOf(evt.getKeyChar())); + return true; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 19:11:27
|
Revision: 8670 http://gridarta.svn.sourceforge.net/gridarta/?rev=8670&view=rev Author: akirschbaum Date: 2010-10-06 19:11:18 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Remove nested assignments. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/updater/Updater.java trunk/src/doc/dev/SafeCopy.java trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Paste.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/HTMLTokenMarker.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LuaTokenMarker.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/PythonTokenMarker.java Modified: trunk/src/app/net/sf/gridarta/updater/Updater.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/Updater.java 2010-10-06 18:55:04 UTC (rev 8669) +++ trunk/src/app/net/sf/gridarta/updater/Updater.java 2010-10-06 19:11:18 UTC (rev 8670) @@ -205,7 +205,12 @@ final OutputStream out = new FileOutputStream(download); try { final byte[] buf = new byte[BUF_SIZE]; - for (int bytesRead; (bytesRead = in.read(buf)) != -1; out.write(buf, 0, bytesRead)) { + for (; ;) { + final int bytesRead = in.read(buf); + if (bytesRead == -1) { + break; + } + out.write(buf, 0, bytesRead); } out.close(); if (/* !backup.delete() || */ !orig.renameTo(backup)) { Modified: trunk/src/doc/dev/SafeCopy.java =================================================================== --- trunk/src/doc/dev/SafeCopy.java 2010-10-06 18:55:04 UTC (rev 8669) +++ trunk/src/doc/dev/SafeCopy.java 2010-10-06 19:11:18 UTC (rev 8670) @@ -13,7 +13,11 @@ final OutputStream out = new FileOutputStream(args[1]); try { final byte[] buf = new byte[4096]; - for (int bytesRead; (bytesRead = in.read(buf)) != -1;) { + for (; ;) { + final int bytesRead = in.read(buf); + if (bytesRead == -1) { + break; + } out.write(buf, 0, bytesRead); } } finally { Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2010-10-06 18:55:04 UTC (rev 8669) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2010-10-06 19:11:18 UTC (rev 8670) @@ -229,8 +229,11 @@ try { boolean firstLine = true; final StringBuilder buff = new StringBuilder(""); - String line; - while ((line = in.readLine()) != null) { + for (; ;) { + final String line = in.readLine(); + if (line == null) { + break; + } if (firstLine) { firstLine = false; } else { Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Paste.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Paste.java 2010-10-06 18:55:04 UTC (rev 8669) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Paste.java 2010-10-06 19:11:18 UTC (rev 8670) @@ -53,8 +53,11 @@ try { // read everything into the buffer 'buff' boolean start = true; - String line; - while ((line = bufferedReader.readLine()) != null) { + for (; ;) { + final String line = bufferedReader.readLine(); + if (line == null) { + break; + } if (start) { start = false; } else { Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/HTMLTokenMarker.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/HTMLTokenMarker.java 2010-10-06 18:55:04 UTC (rev 8669) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/HTMLTokenMarker.java 2010-10-06 19:11:18 UTC (rev 8670) @@ -212,7 +212,8 @@ case Token.COMMENT2: // Inside a JavaScript comment backslash = false; if (c == '*' && length - i > 1 && array[i1] == '/') { - addToken((i += 2) - lastOffset, Token.COMMENT2); + i += 2; + addToken(i - lastOffset, Token.COMMENT2); lastOffset = i; lastKeyword = i; currentToken = JAVASCRIPT; Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LuaTokenMarker.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LuaTokenMarker.java 2010-10-06 18:55:04 UTC (rev 8669) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LuaTokenMarker.java 2010-10-06 19:11:18 UTC (rev 8670) @@ -76,11 +76,13 @@ addToken(i - lastOffset, currentToken); if (i < length - 2 && SyntaxUtilities.regionMatches(false, line, i + 2, "[[")) { currentToken = MULTI_COMMENT; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; i += 3; } else { addToken(length - i, Token.COMMENT1); - lastOffset = lastKeyword = length; + lastOffset = length; + lastKeyword = length; break loop; } } @@ -90,20 +92,24 @@ doKeyword(line, i); addToken(i - lastOffset, currentToken); currentToken = MULTI_LITERAL; - lastOffset = lastKeyword = i++; + lastOffset = i; + lastKeyword = i; + i++; } break; case '"': doKeyword(line, i); addToken(i - lastOffset, currentToken); currentToken = DOUBLE_QUOTE; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; break; case '\'': doKeyword(line, i); addToken(i - lastOffset, currentToken); currentToken = SINGLE_QUOTE; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; break; default: if (!Character.isLetterOrDigit(c) && c != '_') { @@ -118,7 +124,8 @@ } else if (c == '\'') { addToken(i1 - lastOffset, Token.LITERAL1); currentToken = Token.NULL; - lastOffset = lastKeyword = i1; + lastOffset = i1; + lastKeyword = i1; } break; case DOUBLE_QUOTE: @@ -127,7 +134,8 @@ } else if (c == '"') { addToken(i1 - lastOffset, Token.LITERAL1); currentToken = Token.NULL; - lastOffset = lastKeyword = i1; + lastOffset = i1; + lastKeyword = i1; } break; case MULTI_COMMENT: @@ -135,9 +143,11 @@ backslash = false; } if (SyntaxUtilities.regionMatches(false, line, i, "]]")) { - addToken((i += 2) - lastOffset, Token.COMMENT1); + i += 2; + addToken(i - lastOffset, Token.COMMENT1); currentToken = Token.NULL; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; } break; case MULTI_LITERAL: @@ -145,9 +155,11 @@ backslash = false; } if (SyntaxUtilities.regionMatches(false, line, i, "]]")) { - addToken((i += 2) - lastOffset, Token.LITERAL1); + i += 2; + addToken(i - lastOffset, Token.LITERAL1); currentToken = Token.NULL; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; } break; default: Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/PythonTokenMarker.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/PythonTokenMarker.java 2010-10-06 18:55:04 UTC (rev 8669) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/PythonTokenMarker.java 2010-10-06 19:11:18 UTC (rev 8670) @@ -67,7 +67,8 @@ doKeyword(line, i); addToken(i - lastOffset, currentToken); addToken(length - i, Token.COMMENT1); - lastOffset = lastKeyword = length; + lastOffset = length; + lastKeyword = length; break loop; } break; @@ -83,7 +84,8 @@ } else { currentToken = Token.LITERAL1; } - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; } break; @@ -98,7 +100,8 @@ } else { currentToken = Token.LITERAL2; } - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; } break; @@ -117,7 +120,8 @@ } else if (c == '"') { addToken(i1 - lastOffset, currentToken); currentToken = Token.NULL; - lastOffset = lastKeyword = i1; + lastOffset = i1; + lastKeyword = i1; } break; @@ -127,7 +131,8 @@ } else if (c == '\'') { addToken(i1 - lastOffset, Token.LITERAL1); currentToken = Token.NULL; - lastOffset = lastKeyword = i1; + lastOffset = i1; + lastKeyword = i1; } break; @@ -135,9 +140,11 @@ if (backslash) { backslash = false; } else if (SyntaxUtilities.regionMatches(false, line, i, "\"\"\"")) { - addToken((i += 4) - lastOffset, Token.LITERAL1); + i += 4; + addToken(i - lastOffset, Token.LITERAL1); currentToken = Token.NULL; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; } break; @@ -145,9 +152,11 @@ if (backslash) { backslash = false; } else if (SyntaxUtilities.regionMatches(false, line, i, "'''")) { - addToken((i += 4) - lastOffset, Token.LITERAL1); + i += 4; + addToken(i - lastOffset, Token.LITERAL1); currentToken = Token.NULL; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 18:55:11
|
Revision: 8669 http://gridarta.svn.sourceforge.net/gridarta/?rev=8669&view=rev Author: akirschbaum Date: 2010-10-06 18:55:04 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Weaken type. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-10-06 18:39:14 UTC (rev 8668) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-10-06 18:55:04 UTC (rev 8669) @@ -34,7 +34,7 @@ private final JComponent value; @NotNull - private final JPanel config = new JPanel(); + private final JComponent config = new JPanel(); public FilterParameterView(@NotNull final FilterParameter<G, A, R> param) { value = new MenuItemCreator(param.getValue()).getMenuItem(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 18:39:23
|
Revision: 8668 http://gridarta.svn.sourceforge.net/gridarta/?rev=8668&view=rev Author: akirschbaum Date: 2010-10-06 18:39:14 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Define and configure validators from "valdator.*" entries in messages.properties. Document available validators in validators.xhtml. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties trunk/daimonin/ChangeLog trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/messages.properties trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCategory.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java trunk/src/app/net/sf/gridarta/validation/checks/SquareWithoutFloorChecker.java Added Paths: ----------- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java trunk/src/app/net/sf/gridarta/validation/NoSuchValidatorException.java trunk/src/app/net/sf/gridarta/validation/ValidatorFactory.java trunk/src/doc/ref/validators.xhtml trunk/src/test/net/sf/gridarta/validation/ValidationUtils.java trunk/src/test/net/sf/gridarta/validation/ValidatorFactoryTest.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/atrinik/ChangeLog 2010-10-06 18:39:14 UTC (rev 8668) @@ -1,3 +1,9 @@ +2010-10-06 Andreas Kirschbaum + + * Define and configure validators from "valdator.*" entries in + messages.properties. Document available validators in + validators.xhtml. + 2010-10-05 Andreas Kirschbaum * Use the def_arch's archetype name as the artifact's name for 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 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -101,20 +101,7 @@ import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker; -import net.sf.gridarta.validation.checks.BlockedSpawnPointChecker; -import net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker; -import net.sf.gridarta.validation.checks.ConnectedPickableChecker; -import net.sf.gridarta.validation.checks.DoubleLayerChecker; -import net.sf.gridarta.validation.checks.EmptySpawnPointChecker; -import net.sf.gridarta.validation.checks.ExitChecker; import net.sf.gridarta.validation.checks.InvalidCheckException; -import net.sf.gridarta.validation.checks.MapDifficultyChecker; -import net.sf.gridarta.validation.checks.MobOutsideSpawnPointChecker; -import net.sf.gridarta.validation.checks.TilePathsChecker; -import net.sf.gridarta.validation.checks.UndefinedArchetypeChecker; -import net.sf.gridarta.validation.checks.UndefinedFaceChecker; -import net.sf.gridarta.validation.checks.UnsetSlayingChecker; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.atrinik.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -363,7 +350,6 @@ addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_paralyze", "paralyze (effect)", Integer.MIN_VALUE, 100); addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_snare", "snare (effect)", Integer.MIN_VALUE, 100); } - mapValidators.addValidators(new BlockedSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new BlockedMobOrSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), attributeRangeChecker, new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new ExitChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new TilePathsChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER)); } private static void addAttributeRangeChecker(@NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final GameObjectMatcher matcher, @NotNull final String name, @NotNull final String displayName, final int minValue, final int maxValue) { Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties 2010-10-06 18:39:14 UTC (rev 8668) @@ -154,3 +154,21 @@ # Actions not to be shown in Configure Shortcuts shortcutsIgnoreActions=smoothing \ scriptEditClose scriptEditCloseAll scriptEditCopy scriptEditCut scriptEditFind scriptEditFindAgain scriptEditNewScript scriptEditOpen scriptEditPaste scriptEditRedo scriptEditReplace scriptEditSave scriptEditSaveAs scriptEditUndo + + +########################### +# Map Validator definitions +validator.0=net.sf.gridarta.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 +validator.1=net.sf.gridarta.validation.checks.BlockedSpawnPointChecker 81 +validator.2=net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker 80 +validator.3=net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker +validator.4=net.sf.gridarta.validation.checks.ConnectedPickableChecker +validator.5=net.sf.gridarta.validation.checks.DoubleLayerChecker +validator.6=net.sf.gridarta.validation.checks.EmptySpawnPointChecker 81 +validator.7=net.sf.gridarta.validation.checks.ExitChecker 66 +validator.8=net.sf.gridarta.validation.checks.MapDifficultyChecker +validator.9=net.sf.gridarta.validation.checks.MobOutsideSpawnPointChecker 80 +validator.10=net.sf.gridarta.validation.checks.TilePathsChecker 8 +validator.11=net.sf.gridarta.validation.checks.UndefinedArchetypeChecker +validator.12=net.sf.gridarta.validation.checks.UndefinedFaceChecker +validator.13=net.sf.gridarta.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/crossfire/ChangeLog 2010-10-06 18:39:14 UTC (rev 8668) @@ -1,3 +1,9 @@ +2010-10-06 Andreas Kirschbaum + + * Define and configure validators from "valdator.*" entries in + messages.properties. Document available validators in + validators.xhtml. + 2010-09-25 Andreas Kirschbaum * Correctly update archetypes when undoing/redoing operations 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 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -96,16 +96,7 @@ import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker; -import net.sf.gridarta.validation.checks.ConnectedPickableChecker; -import net.sf.gridarta.validation.checks.CustomTypeChecker; -import net.sf.gridarta.validation.checks.ExitChecker; import net.sf.gridarta.validation.checks.InvalidCheckException; -import net.sf.gridarta.validation.checks.MapDifficultyChecker; -import net.sf.gridarta.validation.checks.TilePathsChecker; -import net.sf.gridarta.validation.checks.UndefinedArchetypeChecker; -import net.sf.gridarta.validation.checks.UndefinedFaceChecker; -import net.sf.gridarta.validation.checks.UnsetSlayingChecker; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.crossfire.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -125,7 +116,6 @@ import net.sf.gridarta.var.crossfire.model.settings.DefaultGlobalSettings; import net.sf.gridarta.var.crossfire.model.smoothface.SmoothFaces; import net.sf.gridarta.var.crossfire.resource.DefaultResources; -import net.sf.gridarta.var.crossfire.validation.checks.NonAbsoluteExitPathChecker; import net.sf.japi.swing.prefs.PreferencesGroup; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -276,16 +266,6 @@ log.warn(ex.getMessage() + " for monster checker"); } } - final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); - customTypeChecker.addIgnore(Archetype.TYPE_MISC, Archetype.TYPE_WALL); - customTypeChecker.addIgnore(Archetype.TYPE_MISC, Archetype.TYPE_FLOOR); - final UnsetSlayingChecker<GameObject, MapArchObject, Archetype> unsetSlayingChecker = new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER); - unsetSlayingChecker.addAllowedValue("player"); - mapValidators.addValidators(attributeRangeChecker, new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), customTypeChecker, new ExitChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new TilePathsChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, 4), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), unsetSlayingChecker); - final GameObjectMatcher exitMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_exit"); - if (exitMatcher != null) { - mapValidators.addValidator(new NonAbsoluteExitPathChecker(validatorPreferences, exitMatcher)); - } } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties 2010-10-06 18:39:14 UTC (rev 8668) @@ -135,3 +135,18 @@ # Actions not to be shown in Configure Shortcuts shortcutsIgnoreActions=doubleFaces cleanCompletelyBlockedSquares collectSpells \ scriptEditClose scriptEditCloseAll scriptEditCopy scriptEditCut scriptEditFind scriptEditFindAgain scriptEditNewScript scriptEditOpen scriptEditPaste scriptEditRedo scriptEditReplace scriptEditSave scriptEditSaveAs scriptEditUndo + + +########################### +# Map Validator definitions +validator.0=net.sf.gridarta.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 +validator.1=net.sf.gridarta.var.crossfire.validation.checks.NonAbsoluteExitPathChecker system_exit +validator.2=net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker +validator.3=net.sf.gridarta.validation.checks.ConnectedPickableChecker +validator.4=net.sf.gridarta.validation.checks.ExitChecker 66 +validator.5=net.sf.gridarta.validation.checks.MapDifficultyChecker +validator.6=net.sf.gridarta.validation.checks.TilePathsChecker 4 +validator.7=net.sf.gridarta.validation.checks.UndefinedFaceChecker +validator.8=net.sf.gridarta.validation.checks.UndefinedArchetypeChecker +validator.9=net.sf.gridarta.validation.checks.UnsetSlayingChecker 20,21,51,52,55,64,122 player +validator.10=net.sf.gridarta.validation.checks.CustomTypeChecker 0,71 0,77 Added: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java (rev 0) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -0,0 +1,43 @@ +/* + * 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.validation.checks; + +import net.sf.gridarta.validation.NoSuchValidatorException; +import net.sf.gridarta.validation.ValidationUtils; +import net.sf.gridarta.validation.ValidatorFactory; +import org.junit.Test; + +/** + * Regression tests for {@link ValidatorFactory} to create Crossfire specific + * validators. + * @author Andreas Kirschbaum + */ +public class ValidatorFactoryTest { + + /** + * Checks that {@link NonAbsoluteExitPathChecker} can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewNonAbsoluteExitPathChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.var.crossfire.validation.checks.NonAbsoluteExitPathChecker matcher"); + } + +} // class ValidatorFactoryTest Property changes on: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/daimonin/ChangeLog 2010-10-06 18:39:14 UTC (rev 8668) @@ -1,3 +1,9 @@ +2010-10-06 Andreas Kirschbaum + + * Define and configure validators from "valdator.*" entries in + messages.properties. Document available validators in + validators.xhtml. + 2010-10-05 Andreas Kirschbaum * Use the def_arch's archetype name as the artifact's name for 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 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -22,7 +22,6 @@ import java.awt.Component; import java.io.IOException; import java.net.URL; -import java.util.regex.Pattern; import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.io.GuiFileFilters; import net.sf.gridarta.gui.map.mapview.DefaultMapViewFactory; @@ -102,26 +101,7 @@ import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker; -import net.sf.gridarta.validation.checks.BlockedSpawnPointChecker; -import net.sf.gridarta.validation.checks.BlockedSquareChecker; -import net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker; -import net.sf.gridarta.validation.checks.ConnectedPickableChecker; -import net.sf.gridarta.validation.checks.CustomTypeChecker; -import net.sf.gridarta.validation.checks.DoubleLayerChecker; -import net.sf.gridarta.validation.checks.DoubleTypeChecker; -import net.sf.gridarta.validation.checks.EmptySpawnPointChecker; -import net.sf.gridarta.validation.checks.ExitChecker; import net.sf.gridarta.validation.checks.InvalidCheckException; -import net.sf.gridarta.validation.checks.MapDifficultyChecker; -import net.sf.gridarta.validation.checks.MobOutsideSpawnPointChecker; -import net.sf.gridarta.validation.checks.SlayingChecker; -import net.sf.gridarta.validation.checks.SquareWithoutFloorChecker; -import net.sf.gridarta.validation.checks.SysObjectNotOnLayerZeroChecker; -import net.sf.gridarta.validation.checks.TilePathsChecker; -import net.sf.gridarta.validation.checks.UndefinedArchetypeChecker; -import net.sf.gridarta.validation.checks.UndefinedFaceChecker; -import net.sf.gridarta.validation.checks.UnsetSlayingChecker; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -370,14 +350,6 @@ addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_paralyze", "paralyze (effect)", Integer.MIN_VALUE, 100); addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_snare", "snare (effect)", Integer.MIN_VALUE, 100); } - final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); - customTypeChecker.addIgnore(Archetype.TYPE_MOB, Archetype.TYPE_SPAWN_POINT_MOB, Archetype.TYPE_SPAWN_POINT); - final SlayingChecker<GameObject, MapArchObject, Archetype> slayingChecker = new SlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Pattern.compile("^[a-zA-Z_0-9/.]*$")); - final GameObjectMatcher environmentSensorMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_environment_sensor"); - if (environmentSensorMatcher != null) { - slayingChecker.addMatcher(environmentSensorMatcher, Pattern.compile("|([0-1][0-9]|2[0-3]):[0-5][0-9]-([0-1][0-9]|2[0-3]):[0-5][0-9]")); - } - mapValidators.addValidators(new BlockedSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new BlockedMobOrSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new BlockedSquareChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), attributeRangeChecker, customTypeChecker, new DoubleTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new ExitChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new SquareWithoutFloorChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_FLOOR, Archetype.TYPE_SHOP_FLOOR), slayingChecker, new SysObjectNotOnLayerZeroChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new TilePathsChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER)); } private static void addAttributeRangeChecker(@NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final GameObjectMatcher matcher, @NotNull final String name, @NotNull final String displayName, final int minValue, final int maxValue) { Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/messages.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/messages.properties 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/messages.properties 2010-10-06 18:39:14 UTC (rev 8668) @@ -154,3 +154,27 @@ # Actions not to be shown in Configure Shortcuts shortcutsIgnoreActions=smoothing \ scriptEditClose scriptEditCloseAll scriptEditCopy scriptEditCut scriptEditFind scriptEditFindAgain scriptEditNewScript scriptEditOpen scriptEditPaste scriptEditRedo scriptEditReplace scriptEditSave scriptEditSaveAs scriptEditUndo + + +########################### +# Map Validator definitions +validator.0=net.sf.gridarta.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 +validator.1=net.sf.gridarta.validation.checks.BlockedSpawnPointChecker 81 +validator.2=net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker 80 +validator.3=net.sf.gridarta.validation.checks.BlockedSquareChecker +validator.4=net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker +validator.5=net.sf.gridarta.validation.checks.ConnectedPickableChecker +validator.6=net.sf.gridarta.validation.checks.DoubleTypeChecker +validator.7=net.sf.gridarta.validation.checks.DoubleLayerChecker +validator.8=net.sf.gridarta.validation.checks.EmptySpawnPointChecker 81 +validator.9=net.sf.gridarta.validation.checks.ExitChecker 66 +validator.10=net.sf.gridarta.validation.checks.MapDifficultyChecker +validator.11=net.sf.gridarta.validation.checks.MobOutsideSpawnPointChecker 80 +validator.12=net.sf.gridarta.validation.checks.SquareWithoutFloorChecker 71,68 +validator.13=net.sf.gridarta.validation.checks.SysObjectNotOnLayerZeroChecker +validator.14=net.sf.gridarta.validation.checks.TilePathsChecker 8 +validator.15=net.sf.gridarta.validation.checks.UndefinedArchetypeChecker +validator.16=net.sf.gridarta.validation.checks.UndefinedFaceChecker +validator.17=net.sf.gridarta.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 +validator.18=net.sf.gridarta.validation.checks.CustomTypeChecker 80,83,81 +validator.19=net.sf.gridarta.validation.checks.SlayingChecker ^[a-zA-Z_0-9/.]*$ system_environment_sensor,|([0-1][0-9]|2[0-3]):[0-5][0-9]-([0-1][0-9]|2[0-3]):[0-5][0-9] Modified: trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCategory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCategory.java 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCategory.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -69,6 +69,8 @@ GAMEOBJECTMATCHERS_FILE_INVALID("Game object matcher definitions file cannot be read"), + MAP_VALIDATOR_ENTRY_INVALID("Invalid map validator"), + PICKMAPS_DIR_INVALID("Invalid pickmaps directory"), PICKMAPS_FILE_INVALID("Pickmap file cannot be read"), Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -100,11 +100,14 @@ import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.utils.XmlHelper; import net.sf.gridarta.validation.DelegatingMapValidator; +import net.sf.gridarta.validation.NoSuchValidatorException; +import net.sf.gridarta.validation.ValidatorFactory; import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.validation.checks.ConnectionChecker; import net.sf.gridarta.validation.checks.PaidItemShopSquareChecker; import net.sf.gridarta.validation.checks.ShopSquareChecker; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -192,17 +195,11 @@ } catch (final IOException ex) { gameObjectMatchersErrorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, ex.getMessage()); } + + final ValidatorFactory validatorFactory = new ValidatorFactory(validatorPreferences, gameObjectMatchers, globalSettings); + loadValidators(validators, validatorFactory, errorView); editorFactory.initMapValidators(validators, gameObjectMatchersErrorViewCollector, globalSettings, gameObjectMatchers, attributeRangeChecker, validatorPreferences); - final GameObjectMatcher connectionSourceMatcher = gameObjectMatchers.getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_connection_source"); - if (connectionSourceMatcher != null) { - final GameObjectMatcher connectionSinkMatcher = gameObjectMatchers.getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_connection_sink"); - if (connectionSinkMatcher != null) { - final GameObjectMatcher connectionSink2Matcher = gameObjectMatchers.getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_connection_sink2"); - if (connectionSink2Matcher != null) { - validators.addValidator(new ConnectionChecker<G, A, R>(validatorPreferences, connectionSourceMatcher, connectionSinkMatcher, connectionSink2Matcher)); - } - } - } + validators.addValidator(attributeRangeChecker); } catch (final FileNotFoundException ex) { errorView.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, "GameObjectMatchers.xml: " + ex.getMessage()); } @@ -306,6 +303,33 @@ } /** + * Creates map validators from preferences. + * @param validators the validators to add the newly created validators to + * @param validatorFactory the validator factory for creating new + * validators + * @param errorView the error view to add error messages to + */ + private void loadValidators(@NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ValidatorFactory validatorFactory, @NotNull final ErrorView errorView) { + final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + int id = 0; + for (; ;) { + final String spec = actionBuilder.getString("validator." + id); + if (spec == null) { + break; + } + try { + validators.addValidator(validatorFactory.newValidator(spec)); + } catch (final NoSuchValidatorException ex) { + errorView.addWarning(ErrorViewCategory.MAP_VALIDATOR_ENTRY_INVALID, id, ex.getMessage()); + } + id++; + } + if (log.isInfoEnabled()) { + log.info("Loaded " + id + " map validators."); + } + } + + /** * Creates a new {@link GUIMainControl} instance. * @param scriptFileFilter the file filter for script files * @param scriptExtension the file extension for script files Modified: trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -145,17 +145,6 @@ } /** - * Add Validators that might to be queried. Convenience method to loop - * around {@link #addValidator(Validator)}. - * @param validators map validators to add - */ - public void addValidators(@NotNull final Validator... validators) { - for (final Validator validator : validators) { - addValidator(validator); - } - } - - /** * {@inheritDoc} */ @NotNull Added: trunk/src/app/net/sf/gridarta/validation/NoSuchValidatorException.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/NoSuchValidatorException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/validation/NoSuchValidatorException.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -0,0 +1,52 @@ +/* + * 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.validation; + +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if a map validator cannot be created. + * @author Andreas Kirschbaum + */ +public class NoSuchValidatorException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param reason the reason why the map validator could not be created + */ + public NoSuchValidatorException(@NotNull final String reason) { + super(reason); + } + + /** + * Creates a new instance. + * @param reason the reason why the map validator could not be created + * @param cause the cause + */ + public NoSuchValidatorException(@NotNull final String reason, final Throwable cause) { + super(reason, cause); + } + +} // class NoSuchValidatorException Property changes on: trunk/src/app/net/sf/gridarta/validation/NoSuchValidatorException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/validation/ValidatorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/ValidatorFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/validation/ValidatorFactory.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -0,0 +1,281 @@ +/* + * 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.validation; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; +import net.sf.gridarta.model.match.GameObjectMatcher; +import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.utils.StringUtils; +import net.sf.gridarta.validation.checks.CustomTypeChecker; +import net.sf.gridarta.validation.checks.SlayingChecker; +import net.sf.gridarta.validation.checks.UnsetSlayingChecker; +import org.jetbrains.annotations.NotNull; + +/** + * A factory for creating {@link Validator} instances from string + * representation. The string representation consists of a class name (which + * must implement {@link Validator}) and optional constructor arguments. + * @author Andreas Kirschbaum + */ +public class ValidatorFactory { + + /** + * The {@link ValidatorPreferences} to pass to the newly created {@link + * Validator} instances. + */ + @NotNull + private final ValidatorPreferences validatorPreferences; + + /** + * The {@link GameObjectMatchers} for looking up {@link GameObjectMatcher} + * instances from string representation. + */ + @NotNull + private final GameObjectMatchers gameObjectMatchers; + + /** + * The {@link GlobalSettings} to pass to the newly created {@link Validator} + * instances. + */ + @NotNull + private final GlobalSettings globalSettings; + + /** + * Creates a new instance. + * @param validatorPreferences the validator preferences to pass to the + * newly created validator instances + * @param gameObjectMatchers the game object matchers for looking up game + * object matcher instances from string representation + * @param globalSettings the global settings to pass to the newly created + * validator instances + */ + public ValidatorFactory(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings) { + this.validatorPreferences = validatorPreferences; + this.gameObjectMatchers = gameObjectMatchers; + this.globalSettings = globalSettings; + } + + /** + * Creates a new {@link Validator} instance from string representation. + * @param spec the string representation + * @return the validator instance + * @throws NoSuchValidatorException if the validator cannot be created + */ + @NotNull + public Validator newValidator(@NotNull final String spec) throws NoSuchValidatorException { + final String[] args = StringUtils.PATTERN_WHITESPACE.split(spec); + final Class<?> tmpClass; + //noinspection ErrorNotRethrown + try { + tmpClass = Class.forName(args[0]); + } catch (final ClassNotFoundException ex) { + throw new NoSuchValidatorException("class " + args[0] + " does not exist", ex); + } catch (final ExceptionInInitializerError ex) { + throw new NoSuchValidatorException("class " + args[0] + " does not exist", ex); + } catch (final LinkageError ex) { + throw new NoSuchValidatorException("class " + args[0] + " does not exist", ex); + } + final Class<? extends Validator> classValidator; + try { + classValidator = tmpClass.asSubclass(Validator.class); + } catch (final ClassCastException ex) { + throw new NoSuchValidatorException("class " + args[0] + " does not exist", ex); + } + final Constructor<?>[] constructors = classValidator.getConstructors(); + if (constructors.length == 0) { + throw new NoSuchValidatorException("class " + args[0] + " has no public constructors"); + } else if (constructors.length > 1) { + throw new NoSuchValidatorException("class " + args[0] + " has more than one public constructor"); + } + @SuppressWarnings({ "unchecked" }) final Constructor<? extends Validator> constructor = (Constructor<? extends Validator>) constructors[0]; + final Class<?>[] constructorParameterTypes = constructor.getParameterTypes(); + final Object[] constructorArguments = new Object[constructorParameterTypes.length]; + int pos = 1; + for (int i = 0; i < constructorParameterTypes.length; i++) { + final Class<?> constructorParameterType = constructorParameterTypes[i]; + if (constructorParameterType == ValidatorPreferences.class) { + constructorArguments[i] = validatorPreferences; + } else if (constructorParameterType == GlobalSettings.class) { + constructorArguments[i] = globalSettings; + } else { + if (pos >= args.length) { + throw new NoSuchValidatorException("missing argument in '" + spec + "'"); + } + final String arg = args[pos++]; + if (constructorParameterType == Integer[].class) { + constructorArguments[i] = createIntegerArray(arg); + } else if (constructorParameterType == GameObjectMatcher.class) { + constructorArguments[i] = createGameObjectMatcher(arg); + } else if (constructorParameterType == int.class) { + constructorArguments[i] = createInteger(arg); + } else if (constructorParameterType == Pattern.class) { + constructorArguments[i] = createPattern(arg); + } else { + throw new NoSuchValidatorException("class " + args[0] + "'s constructor requires a parameter of type " + constructorParameterType.getName() + "; this type is not supported"); + } + } + } + final Validator validator; + //noinspection ErrorNotRethrown + try { + validator = constructor.newInstance(constructorArguments); + } catch (final ExceptionInInitializerError ex) { + throw new NoSuchValidatorException("cannot initialize class " + args[0], ex); + } catch (final InstantiationException ex) { + throw new NoSuchValidatorException("class " + args[0] + " is abstract", ex); + } catch (final IllegalAccessException ex) { + throw new AssertionError(ex); + } catch (final IllegalArgumentException ex) { + throw new AssertionError(ex); + } catch (final InvocationTargetException ex) { + throw new NoSuchValidatorException("cannot instantiate class " + args[0], ex); + } + if (pos < args.length) { + if (classValidator == UnsetSlayingChecker.class) { + final UnsetSlayingChecker<?, ?, ?> unsetSlayingChecker = (UnsetSlayingChecker<?, ?, ?>) validator; + do { + unsetSlayingChecker.addAllowedValue(args[pos]); + pos++; + } while (pos < args.length); + } else if (classValidator == CustomTypeChecker.class) { + final CustomTypeChecker<?, ?, ?> customTypeChecker = (CustomTypeChecker<?, ?, ?>) validator; + do { + final String[] tmp = args[pos].split(",", -1); + if (tmp.length != 2 && tmp.length != 3) { + throw new NoSuchValidatorException("invalid from,to or from,to,env type: " + args[pos]); + } + final int fromType; + try { + fromType = Integer.parseInt(tmp[0]); + } catch (final NumberFormatException ex) { + throw new NoSuchValidatorException("invalid from type: " + args[pos], ex); + } + final int toType; + try { + toType = Integer.parseInt(tmp[1]); + } catch (final NumberFormatException ex) { + throw new NoSuchValidatorException("invalid to type: " + args[pos], ex); + } + if (tmp.length == 2) { + customTypeChecker.addIgnore(fromType, toType); + } else { + final int envType; + try { + envType = Integer.parseInt(tmp[1]); + } catch (final NumberFormatException ex) { + throw new NoSuchValidatorException("invalid env type: " + args[pos], ex); + } + customTypeChecker.addIgnore(fromType, toType, envType); + } + pos++; + } while (pos < args.length); + } else if (classValidator == SlayingChecker.class) { + final SlayingChecker<?, ?, ?> slayingChecker = (SlayingChecker<?, ?, ?>) validator; + do { + final String[] tmp = args[pos].split(",", 2); + if (tmp.length != 2) { + throw new NoSuchValidatorException("invalid matcher,pattern: " + args[pos]); + } + final GameObjectMatcher matcher = createGameObjectMatcher(tmp[0]); + final Pattern pattern = createPattern(tmp[1]); + slayingChecker.addMatcher(matcher, pattern); + pos++; + } while (pos < args.length); + } else { + throw new NoSuchValidatorException("excess arguments for '" + spec + "'"); + } + } + return validator; + } + + /** + * Creates an <code>Integer[]</code> instance from string representation. + * @param arg the string representation + * @return the integer array instance + * @throws NoSuchValidatorException if the string representation is + * incorrect + */ + @NotNull + private static Integer[] createIntegerArray(@NotNull final String arg) throws NoSuchValidatorException { + final String[] tmp = arg.split(",", -1); + final Integer[] result = new Integer[tmp.length]; + for (int i = 0; i < tmp.length; i++) { + try { + result[i] = Integer.parseInt(tmp[i]); + } catch (final NumberFormatException ex) { + throw new NoSuchValidatorException("not a number: " + tmp[i], ex); + } + } + return result; + } + + /** + * Creates a {@link GameObjectMatcher} instance from string representation. + * @param arg the string representation + * @return the game object matcher instance + * @throws NoSuchValidatorException if the string representation is + * incorrect + */ + @NotNull + private GameObjectMatcher createGameObjectMatcher(@NotNull final String arg) throws NoSuchValidatorException { + final GameObjectMatcher gameObjectMatcher = gameObjectMatchers.getMatcher(arg); + if (gameObjectMatcher == null) { + throw new NoSuchValidatorException("undefined game object matcher: " + arg); + } + return gameObjectMatcher; + } + + /** + * Creates an <code>Integer</code> instance from string representation. + * @param arg the string representation + * @return the integer instance + * @throws NoSuchValidatorException if the string representation is + * incorrect + */ + @NotNull + private static Integer createInteger(@NotNull final String arg) throws NoSuchValidatorException { + try { + return Integer.parseInt(arg); + } catch (final NumberFormatException ex) { + throw new NoSuchValidatorException("invalid number: " + arg, ex); + } + } + + /** + * Creates an <code>Integer</code> instance from string representation. + * @param arg the string representation + * @return the integer instance + * @throws NoSuchValidatorException if the string representation is + * incorrect + */ + @NotNull + private static Pattern createPattern(@NotNull final String arg) throws NoSuchValidatorException { + try { + return Pattern.compile(arg); + } catch (final PatternSyntaxException ex) { + throw new NoSuchValidatorException("invalid pattern: " + arg, ex); + } + } + +} // class ValidatorFactory Property changes on: trunk/src/app/net/sf/gridarta/validation/ValidatorFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -32,8 +32,7 @@ /** * A {@link net.sf.gridarta.validation.MapValidator} to detect shop squares - * which allow magic or prayers, or which have adjacent squares that allow magic - * or prayers. + * which allow magic or prayers. * @author Andreas Kirschbaum */ public class ShopSquareChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractShopSquareChecker<G, A, R> { Modified: trunk/src/app/net/sf/gridarta/validation/checks/SquareWithoutFloorChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/SquareWithoutFloorChecker.java 2010-10-05 18:26:18 UTC (rev 8667) +++ trunk/src/app/net/sf/gridarta/validation/checks/SquareWithoutFloorChecker.java 2010-10-06 18:39:14 UTC (rev 8668) @@ -61,16 +61,13 @@ */ @Override public void validateSquare(@NotNull final MapSquare<G, A, R> mapSquare, @NotNull final ErrorCollector<G, A, R> errorCollector) { - boolean floorFound = false; for (final BaseObject<G, A, R, ?> gameObject : mapSquare) { if (typeNumbers.contains(gameObject.getTypeNo())) { - floorFound = true; - break; + return; } } - if (!floorFound) { - errorCollector.collect(new SquareWithoutFloorError<G, A, R>(mapSquare)); - } + + errorCollector.collect(new SquareWithoutFloorError<G, A, R>(mapSquare)); } } // class SquareWithoutFloorChecker Added: trunk/src/doc/ref/validators.xhtml =================================================================== --- trunk/src/doc/ref/validators.xhtml (rev 0) +++ trunk/src/doc/ref/validators.xhtml 2010-10-06 18:39:14 UTC (rev 8668) @@ -0,0 +1,299 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ 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. + --> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> +<head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/> + <meta name="Date" content="$Date$"/> + <title>Validators</title> +</head> +<body> +<h1>Overview</h1> + +<p>This page explains "validators". Validators check for problems in + maps. There are three types of validators:</p> + +<ul> + <li>game object validators: these validators check single game objects.</li> + <li>square validators: these validators check problems related to a single + map square. They process all game objects on the map square. + </li> + <li>map validators: these validators check problems related to game objects + located on different map squares (on a single map) or related to map + attributes. + </li> +</ul> + +<h1>Reference</h1> + +<p>Map validators are defined in the editor specific messages.properties + file.</p> + +<p>A validator is defined by the key "validator.<id>". The first + validator uses <id> 0; all following validators use increasing + numbers. Duplicate numbers are invalid (but not detected and therefore no + warning message occurs; one of these definitions is ignored). Definitions + following a missing are ignored (and also not detected).</p> + +<p>The value for the keys are: <code><class name> <optional parameters></code>. +</p> + +<p><class name> is the Java class name that implements the validator; it + must be a subclass of <code>net.sf.gridarta.validation.Validator</code>.</p> + +<p><optional parameters" are parameters for the validator. Acceptable + values depend on the class name.</p> + +<p>The following sections describe all validators defined by Gridarta.</p> + +<h2>net.sf.gridarta.validation.checks.AttributeRangeChecker</h2> + +<p>This game object validator is used internally by Gridarta. Explicit + instantiation is not useful.</p> + +<h2>net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker type...</h2> + +<p>This square validator checks that mobs or spawn points aren't on blocked + squares. "type..." is a comma separated list of game object types + to check.</p> + +<p>A square is considered blocked if at least one game object on that square as + the attribute "no_pass" set to a non-zero value.</p> + +<h2>net.sf.gridarta.validation.checks.BlockedSpawnPointChecker type...</h2> + +<p>This map validator checks that spawn points aren't completely blocked. "type..." + is a comma separated list of game object types to check.</p> + +<p>A spawn point (an object that has one of the given types) may place a new mob + on some map squares around itself. The number of map squares to check is + given in the spawn point's "last_heal" attribute. The value zero + means only the spawn point's square. The value 1 means the spawn point and + the map square directly north of it. Higher values add more map squares + clockwise.</p> + +<p>A square is considered blocked if at least one game object on that square as + the attribute "no_pass" set to a non-zero value.</p> + +<h2>net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker</h2> + +<p>A game object validator that checks for game objects having a non-empty + "connected" attribute and that are in the inventory of another + game object.</p> + +<h2>net.sf.gridarta.validation.checks.ConnectedPickableChecker</h2> + +<p>A game object validator that checks for game objects having a non-empty + "connected" attribute and that are "no_pick 0".</p> + +<h2>net.sf.gridarta.validation.checks.ConnectionChecker source_matcher + sink_matcher sink2_matcher</h2> + +<p>A map validator that checks for valid "connected" attributes:</p> + +<ul> + <li>A game object defines the "connected" attribute but is not + supposed to do so. + </li> + <li>A specific " connected" value appears only in connection + sources but in no connection sinks. These connections are not useful + because they have no effect when triggered. + </li> + <li>A specific " connected" value appears only in connection sinks + but in no connection sources. These connections are not useful because + they cannot be triggered. + </li> +</ul> + +<p>A game object is considered a connection source if the game object matcher + "source_matcher" matches the game object.</p> + +<p>A game object is considered a connection sink if either of the game object + matchers "sink_matcher" or "sink2_matcher" matches the + game object.</p> + +<p>A game object is not supposed to define a "connected" attribute if + it is neither a connection source nor a connection sink.</p> + +<h2>net.sf.gridarta.validation.checks.CustomTypeChecker from,to[,env]</h2> + +<p>A game object validator that checks that the "type" attribute is + not changed from the archetype's default value.</p> + +<p>The parameters "from,to" or "from,to.env" define allowed + exceptions: a change from archetype's type "from" to game object's + type "to" is allowed. The form "from,to,env" restricts + the allowed change for game objects in the inventory of game objects with + type "env".</p> + +<h2>net.sf.gridarta.validation.checks.DoubleLayerChecker</h2> + +<p>A square validator that checks that no layer within a given map square + contains more than one game object. The layer of a game object is given by + its "layer" attribute. The layer 0 is ignored; no warnings are + reported for game objects on layer 0.</p> + +<h2>net.sf.gridarta.validation.checks.DoubleTypeChecker</h2> + +<p>A square validator that checks that a given map square does not contain two + or more game objects having the same "type" attribute value.</p> + +<h2>net.sf.gridarta.validation.checks.EmptySpawnPointChecker type...</h2> + +<p>A game object validator that checks that spawn points are not empty. A spawn + point is a game object having one of the given types. "type..." is + a comma separated list.</p> + +<h2>net.sf.gridarta.validation.checks.ExitChecker type</h2> + +<p>A game object validator that checks for exit game objects having an invalid + "slaying" attribute. An exit is a game object having the given + type.</p> + +<p>A "slaying" attribute is considered valid if</p> + +<ul> + <li>it is empty or</li> + <li>it contains the value "/!" or</li> + <li>it references to an existing file in the maps directory (and that file + is not a directory) + </li> +</ul> + +<p>Note: relative "slaying" paths are not checked if the map has not + yet been saved. In this case there exists no base path to resolve the + relative path against.</p> + +<h2>net.sf.gridarta.validation.checks.MapDifficultyChecker</h2> + +<p>A map validator that checks for valid "difficulty" map attributes. + The map attribute is considered invalid if it is less than 1.</p> + +<h2>net.sf.gridarta.validation.checks.MobOutsideSpawnPointChecker type...</h2> + +<p>A game object validator that checks that mobs are not outside spawn points. A + mob is any game object that is placed directly on a map (but not in an + inventory) and has one of the given types. "type..." is a comma + separated list.</p> + +<h2>net.sf.gridarta.validation.checks.PaidItemShopSquareChecker shop_matcher + paid_item_matcher</h2> + +<p>A map validator that checks for shop squares that contain paid items.</p> + +<p>A map square is considered a shop square if at least one of the contained + game objects matches the game object matcher "shop_matcher".</p> + +<p>A paid game object is a game object that matches the game object matcher + "paid_item_matcher".</p> + +<p>Note: game object within inventories are not checked.</p> + +<h2>net.sf.gridarta.validation.checks.ShopSquareChecker shop_matcher + no_spells_matcher</h2> + +<p>A map validator that checks for shop squares which allow magic or + prayers.</p> + +<p>A map square is considered a shop square if at least one of the contained + game objects matches the game object matcher "shop_matcher".</p> + +<p>A map square is considered to block spells if at least one of the contained + game objects matches the game object matcher + "no_spells_matcher".</p> + +<p>Note: game object within inventories are not checked.</p> + +<h2>net.sf.gridarta.validation.checks.SlayingChecker pattern + matcher,pattern</h2> + +<h2>net.sf.gridarta.validation.checks.SquareWithoutFloorChecker type...</h2> + +<p>A square validator that checks that all squares include a floor game object. + A game object is considered a floor game object if it has one of the given + types. "type..." is a comma separated list.</p> + +<h2>net.sf.gridarta.validation.checks.SysObjectNotOnLayerZeroChecker</h2> + +<p>A game object validator that checks that system objects are placed on layer + zero. A game object is a system object if it has "sys_object 1". A + game object's layer is defined by the "layer" attribute.</p> + +<h2>net.sf.gridarta.validation.checks.TilePathsChecker number</h2> + +<p>A map validator that checks for valid tile paths. The parameter "number" + defines how many tile paths are checked. Typically this is either 4 (north,... [truncated message content] |
From: <aki...@us...> - 2010-10-05 18:26:25
|
Revision: 8667 http://gridarta.svn.sourceforge.net/gridarta/?rev=8667&view=rev Author: akirschbaum Date: 2010-10-05 18:26:18 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Create AttributeRangeChecker instance more local. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/build.xml 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/DefaultMainControl.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 2010-10-05 17:24:59 UTC (rev 8666) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-10-05 18:26:18 UTC (rev 8667) @@ -191,8 +191,8 @@ */ @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 ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @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 AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences) { - 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, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory, validatorPreferences); + 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 ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @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) { + 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, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences); } /** Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-10-05 17:24:59 UTC (rev 8666) +++ trunk/build.xml 2010-10-05 18:26:18 UTC (rev 8667) @@ -282,6 +282,7 @@ <fileset dir="lib" includes="junit-4.2.jar"/> <pathelement location="dest/crossfire/app"/> <pathelement location="dest/gridarta/app"/> + <pathelement location="dest/gridarta/test"/> <pathelement location="dest/model/app"/> <pathelement location="dest/model/test"/> <pathelement location="dest/utils/app"/> @@ -885,6 +886,7 @@ <pathelement location="dest/crossfire/app"/> <pathelement location="dest/crossfire/test"/> <pathelement location="dest/gridarta/app"/> + <pathelement location="dest/gridarta/test"/> <pathelement location="dest/model/app"/> <pathelement location="dest/model/test"/> <pathelement location="dest/utils/app"/> 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 2010-10-05 17:24:59 UTC (rev 8666) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-10-05 18:26:18 UTC (rev 8667) @@ -159,8 +159,8 @@ */ @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 ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @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 AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences) { - 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, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory, validatorPreferences); + 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 ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @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) { + 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, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences); } /** 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 2010-10-05 17:24:59 UTC (rev 8666) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-10-05 18:26:18 UTC (rev 8667) @@ -198,8 +198,8 @@ */ @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 ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @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 AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences) { - 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, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory, validatorPreferences); + 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 ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @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) { + 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, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences); } /** Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-05 17:24:59 UTC (rev 8666) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-05 18:26:18 UTC (rev 8667) @@ -170,11 +170,10 @@ * @param resources the resources * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use - * @param attributeRangeChecker the attribute range checker to use * @param pluginParameterFactory the plugin parameter factory to use * @param validatorPreferences the validator preferences to use */ - public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, @NotNull final String scriptsDir, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences) { + public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, @NotNull final String scriptsDir, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences) { final XmlHelper xmlHelper; try { xmlHelper = new XmlHelper(); @@ -183,6 +182,7 @@ //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } + final AttributeRangeChecker<G, A, R> attributeRangeChecker = new AttributeRangeChecker<G, A, R>(validatorPreferences); final GameObjectMatchersParser gameObjectMatchersParser = new GameObjectMatchersParser(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), "GameObjectMatchers.xml"); Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-10-05 17:24:59 UTC (rev 8666) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-10-05 18:26:18 UTC (rev 8667) @@ -110,13 +110,12 @@ * @param resources the resources * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use - * @param attributeRangeChecker the attribute range checker to use * @param pluginParameterFactory the plugin parameter factory to use * @param validatorPreferences the validator preferences to use * @return the new instance */ @NotNull - DefaultMainControl<G, A, R> newMainControl(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull GlobalSettings globalSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AutojoinLists<G, A, R> autojoinLists, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences); + DefaultMainControl<G, A, R> newMainControl(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull GlobalSettings globalSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AutojoinLists<G, A, R> autojoinLists, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences); /** * Returns the offset for drawing double faces. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-10-05 17:24:59 UTC (rev 8666) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-10-05 18:26:18 UTC (rev 8667) @@ -100,7 +100,6 @@ import net.sf.gridarta.validation.DefaultValidatorPreferences; import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.gridarta.validation.ValidatorPreferences; -import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.apache.log4j.Category; @@ -271,9 +270,8 @@ 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>>(); - final AttributeRangeChecker<G, A, R> attributeRangeChecker = new AttributeRangeChecker<G, A, R>(validatorPreferences); final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList); - final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(mode == GridartaRunMode.COLLECT_ARCHES, errorView, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory, validatorPreferences); + final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(mode == GridartaRunMode.COLLECT_ARCHES, errorView, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences); final NamedFilter defaultNamedFilterList = new NamedFilter(gameObjectMatchers.getFilters()); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-05 17:25:06
|
Revision: 8666 http://gridarta.svn.sourceforge.net/gridarta/?rev=8666&view=rev Author: akirschbaum Date: 2010-10-05 17:24:59 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Remove dependency GameObjectMatchers -> GameObjectMatchersParser. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java Modified: trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java 2010-10-05 07:15:19 UTC (rev 8665) +++ trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java 2010-10-05 17:24:59 UTC (rev 8666) @@ -19,16 +19,12 @@ package net.sf.gridarta.model.match; -import java.io.IOException; import java.io.Serializable; -import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.xpath.XPath; import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -63,19 +59,6 @@ private final Collection<NamedGameObjectMatcher> gameObjectMatchers = new ArrayList<NamedGameObjectMatcher>(); /** - * Parses a .xml file defining game object matchers. - * @param documentBuilder the <code>DocumentBuilder</code> to use for - * parsing XML - * @param xpath XPath to use for applying for XPath expressions. - * @param url the URL to parse - * @param errorViewCollector the error view collector to use - * @throws IOException if the file cannot be parsed - */ - public void readGameObjectMatchers(@NotNull final DocumentBuilder documentBuilder, @NotNull final XPath xpath, @NotNull final URL url, @NotNull final ErrorViewCollector errorViewCollector) throws IOException { - new GameObjectMatchersParser(documentBuilder, xpath).readGameObjectMatchers(url, gameObjectMatchers, gameObjectMatchersByIds, errorViewCollector); - } - - /** * Returns a matcher by id; returns <code>null</code> if the matcher does * not exist. * @param ids the ids to find @@ -158,4 +141,13 @@ return editType; } + /** + * Adds a new {@link GameObjectMatcher}. + * @param gameObjectMatcher the game object matcher to add + */ + public void addGameObjectMatcher(@NotNull final NamedGameObjectMatcher gameObjectMatcher) { + gameObjectMatchers.add(gameObjectMatcher); + gameObjectMatchersByIds.put(gameObjectMatcher.getID(), gameObjectMatcher); + } + } // class GameObjectMatchers Modified: trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java 2010-10-05 07:15:19 UTC (rev 8665) +++ trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java 2010-10-05 17:24:59 UTC (rev 8666) @@ -21,9 +21,7 @@ import java.io.IOException; import java.net.URL; -import java.util.Collection; import java.util.Iterator; -import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.xpath.XPath; import net.sf.gridarta.model.errorview.ErrorViewCategory; @@ -76,12 +74,10 @@ * Parses a .xml file defining game object matchers. * @param url the URL to parse * @param gameObjectMatchers the game object matchers to update - * @param gameObjectMatchersByIds the numbered game object matchers to - * update * @param errorViewCollector the error view collector to use * @throws IOException if the file cannot be parsed */ - public void readGameObjectMatchers(@NotNull final URL url, @NotNull final Collection<NamedGameObjectMatcher> gameObjectMatchers, @NotNull final Map<String, NamedGameObjectMatcher> gameObjectMatchersByIds, @NotNull final ErrorViewCollector errorViewCollector) throws IOException { + public void readGameObjectMatchers(@NotNull final URL url, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorViewCollector errorViewCollector) throws IOException { final GameObjectMatcherParser aom = new GameObjectMatcherParser(xpath); final Document doc; try { @@ -89,6 +85,7 @@ } catch (final SAXException ex) { throw new IOException("sax exception: " + ex.getMessage(), ex); } + int count = 0; int editType = 1; final Iterator<Element> it = new NodeListIterator<Element>(doc.getElementsByTagName("GameObjectMatcher")); while (it.hasNext()) { @@ -100,8 +97,8 @@ errorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_ENTRY_INVALID, node.getAttribute("id") + ": " + ex.getMessage()); continue; } - gameObjectMatchers.add(archObjectMatcher); - gameObjectMatchersByIds.put(archObjectMatcher.getID(), archObjectMatcher); + gameObjectMatchers.addGameObjectMatcher(archObjectMatcher); + count++; if (editType != 0 && !archObjectMatcher.isSystemMatcher()) { editType <<= 1; if (editType == 0) { @@ -110,7 +107,7 @@ } } if (log.isInfoEnabled()) { - log.info("Loaded " + gameObjectMatchers.size() + " GameObjectMatchers from '" + url + "'."); + log.info("Loaded " + count + " GameObjectMatchers from '" + url + "'."); } } Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-05 07:15:19 UTC (rev 8665) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-05 17:24:59 UTC (rev 8666) @@ -74,6 +74,7 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.match.GameObjectMatchersParser; import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchUtils; @@ -182,11 +183,12 @@ //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } + final GameObjectMatchersParser gameObjectMatchersParser = new GameObjectMatchersParser(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), "GameObjectMatchers.xml"); final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, url); try { - gameObjectMatchers.readGameObjectMatchers(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath(), url, gameObjectMatchersErrorViewCollector); + gameObjectMatchersParser.readGameObjectMatchers(url, gameObjectMatchers, gameObjectMatchersErrorViewCollector); } catch (final IOException ex) { gameObjectMatchersErrorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, ex.getMessage()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-05 07:15:26
|
Revision: 8665 http://gridarta.svn.sourceforge.net/gridarta/?rev=8665&view=rev Author: akirschbaum Date: 2010-10-05 07:15:19 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Use the def_arch's archetype name as the artifact's name for artifacts that do not specify a name attribute in def_arch or in the artifact definition. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java Added Paths: ----------- trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-10-04 20:18:20 UTC (rev 8664) +++ trunk/atrinik/ChangeLog 2010-10-05 07:15:19 UTC (rev 8665) @@ -1,3 +1,9 @@ +2010-10-05 Andreas Kirschbaum + + * Use the def_arch's archetype name as the artifact's name for + artifacts that do not specify a "name" attribute in def_arch or in + the artifact definition. + 2010-09-29 Alex Tokar * Update default path to client executable on GNU/Linux. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-10-04 20:18:20 UTC (rev 8664) +++ trunk/daimonin/ChangeLog 2010-10-05 07:15:19 UTC (rev 8665) @@ -1,3 +1,9 @@ +2010-10-05 Andreas Kirschbaum + + * Use the def_arch's archetype name as the artifact's name for + artifacts that do not specify a "name" attribute in def_arch or in + the artifact definition. + 2010-09-25 Andreas Kirschbaum * Correctly update archetypes when undoing/redoing operations Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2010-10-04 20:18:20 UTC (rev 8664) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2010-10-05 07:15:19 UTC (rev 8665) @@ -25,6 +25,7 @@ import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.DuplicateAnimationException; import net.sf.gridarta.model.anim.IllegalAnimationException; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.gameobject.GameObject; @@ -138,6 +139,9 @@ final String archetypeName = archName != null ? archName : thisLine2.trim().substring(7); archetypeBuilder.reInit(archetypeName); + if (prototype != null && prototype.getAttributeString(BaseObject.NAME).isEmpty()) { + archetypeBuilder.addObjectText(BaseObject.NAME + " " + prototype.getArchetypeName()); + } if (!archMore) { if (firstArch != null) { finishParseArchetype(firstArch); Modified: trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2010-10-04 20:18:20 UTC (rev 8664) +++ trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2010-10-05 07:15:19 UTC (rev 8665) @@ -19,34 +19,14 @@ package net.sf.gridarta.model.artifact; -import java.io.BufferedReader; -import java.io.File; import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; -import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.TestAnimationObjects; -import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.DuplicateArchetypeException; import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.archetype.TestArchetypeBuilder; -import net.sf.gridarta.model.archetype.TestArchetypeFactory; -import net.sf.gridarta.model.archetype.TestArchetypeParser; -import net.sf.gridarta.model.archetype.TestArchetypeSet; import net.sf.gridarta.model.archetype.UndefinedArchetypeException; -import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.errorview.TestErrorView; -import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.utils.GUIUtils; -import net.sf.gridarta.utils.SystemIcons; import org.junit.Assert; import org.junit.Test; @@ -64,36 +44,75 @@ */ @Test public void testMissingObject() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { - final TestArchetypeFactory archetypeFactory = new TestArchetypeFactory(); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final TestArchetypeSet archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes", faceObjectProviders); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); - final TestArchetype baseArchetype = new TestArchetype("base", faceObjectProviders, animationObjects); - baseArchetype.setObjectText("sp 2\n"); - archetypeSet.addArchetype(baseArchetype); - final File file = new File("*string*"); final TestErrorView errorView = new TestErrorView(); - final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, file); - final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); - 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>(); - final ArtifactParser<TestGameObject, TestMapArchObject, TestArchetype> artifactParser = new ArtifactParser<TestGameObject, TestMapArchObject, TestArchetype>(archetypeSet, errorView, archetypeParser, invObjects); - final Reader reader = new StringReader("artifact art\n" + "def_arch base\nObject obj\nsp 3\n" + "end\n"); - final BufferedReader bufferedReader = new BufferedReader(reader); - try { - artifactParser.loadArtifact(bufferedReader, errorViewCollector, "", "panel", "folder"); - } finally { - bufferedReader.close(); - } + final TestParser parser = new TestParser(errorView); + parser.addArchetype("base", "sp 2"); + parser.parseArtifacts("artifact art\n" + "def_arch base\nObject obj\nsp 3\n" + "end\n"); Assert.assertFalse(errorView.hasWarnings()); Assert.assertFalse(errorView.hasErrors()); - Assert.assertEquals(2, archetypeSet.getArchetypeCount()); - final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype = archetypeSet.getArchetype("art"); - Assert.assertEquals("sp 3\n", archetype.getObjectText()); + Assert.assertEquals(2, parser.getArchetypeCount()); + final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype = parser.getArchetype("art"); + Assert.assertEquals("name base\nsp 3\n", archetype.getObjectText()); } + /** + * Checks that an artifact definition inherits the def_arch archetype's name + * by default. + * @throws DuplicateArchetypeException if the test fails + * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails + */ + @Test + public void testDefaultName1() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { + final TestParser parser = new TestParser(); + parser.addArchetype("horn"); + parser.parseArtifacts("artifact horn_fools\n" + "def_arch horn\n" + "Object obj\n" + "title of fools\n" + "end\n"); + Assert.assertEquals("horn of fools", parser.getArchetype("horn_fools").getBestName()); + } + + /** + * Checks that an artifact definition inherits the def_arch archetype's name + * by default. + * @throws DuplicateArchetypeException if the test fails + * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails + */ + @Test + public void testDefaultName2() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { + final TestParser parser = new TestParser(); + parser.addArchetype("horn", "name horn2"); + parser.parseArtifacts("artifact horn_fools\n" + "def_arch horn\n" + "Object obj\n" + "title of fools\n" + "end\n"); + Assert.assertEquals("horn2 of fools", parser.getArchetype("horn_fools").getBestName()); + } + + /** + * Checks that an artifact definition inherits the def_arch archetype's name + * by default. + * @throws DuplicateArchetypeException if the test fails + * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails + */ + @Test + public void testDefaultName3() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { + final TestParser parser = new TestParser(); + parser.addArchetype("horn", "name base_horn"); + parser.parseArtifacts("artifact horn_fools\n" + "def_arch horn\n" + "Object obj\n" + "title of fools\n" + "end\n"); + Assert.assertEquals("base_horn of fools", parser.getArchetype("horn_fools").getBestName()); + } + + /** + * Checks that an artifact definition inherits the def_arch archetype's name + * by default. + * @throws DuplicateArchetypeException if the test fails + * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails + */ + @Test + public void testDefaultName4() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { + final TestParser parser = new TestParser(); + parser.addArchetype("horn", "name base_horn"); + parser.parseArtifacts("artifact horn_fools\n" + "def_arch horn\n" + "Object obj\n" + "name special_horn\n" + "title of fools\n" + "end\n"); + Assert.assertEquals("special_horn of fools", parser.getArchetype("horn_fools").getBestName()); + } + } // class ArtifactParserTest Added: trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.java 2010-10-05 07:15:19 UTC (rev 8665) @@ -0,0 +1,166 @@ +/* + * 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.artifact; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; +import net.sf.gridarta.model.anim.AnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; +import net.sf.gridarta.model.archetype.AbstractArchetypeParser; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetype.DuplicateArchetypeException; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.archetype.TestArchetypeBuilder; +import net.sf.gridarta.model.archetype.TestArchetypeFactory; +import net.sf.gridarta.model.archetype.TestArchetypeParser; +import net.sf.gridarta.model.archetype.TestArchetypeSet; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; +import net.sf.gridarta.model.errorview.ErrorViewCollector; +import net.sf.gridarta.model.errorview.TestErrorView; +import net.sf.gridarta.model.face.FaceObjectProviders; +import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.gameobject.TestGameObjectFactory; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.SystemIcons; +import org.jetbrains.annotations.NotNull; + +/** + * Parser for artifacts definitions. + * @author Andreas Kirschbaum + */ +public class TestParser { + + /** + * The {@link FaceObjectProviders} instance. + */ + @NotNull + private final FaceObjectProviders faceObjectProviders; + + /** + * The {@link TestArchetypeSet} instance. + */ + @NotNull + private final TestArchetypeSet archetypeSet; + + /** + * The {@link AnimationObjects} instance. + */ + @NotNull + private final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); + + /** + * The {@link ErrorViewCollector} instance. + */ + @NotNull + private final ErrorViewCollector errorViewCollector; + + /** + * The {@link ArtifactParser} instance. + */ + @NotNull + private final ArtifactParser<TestGameObject, TestMapArchObject, TestArchetype> artifactParser; + + /** + * Creates a new instance. + */ + public TestParser() { + this(new TestErrorView()); + } + + /** + * Creates a new instance. + * @param errorView the error view to use for parsing + */ + public TestParser(@NotNull final TestErrorView errorView) { + final GUIUtils guiUtils = new GUIUtils(); + final SystemIcons systemIcons = new SystemIcons(guiUtils); + final TestArchetypeFactory archetypeFactory = new TestArchetypeFactory(); + final File file = new File("*string*"); + errorViewCollector = new ErrorViewCollector(errorView, file); + 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); + 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>(); + artifactParser = new ArtifactParser<TestGameObject, TestMapArchObject, TestArchetype>(archetypeSet, errorView, archetypeParser, invObjects); + } + + /** + * Adds a new archetype. + * @param archetypeName the archetype name + * @param attributes the archetype's attributes; may be empty + * @throws DuplicateArchetypeException if the archetype name is not unique + */ + public void addArchetype(@NotNull final String archetypeName, @NotNull final String... attributes) throws DuplicateArchetypeException { + final TestArchetype baseArchetype = new TestArchetype(archetypeName, faceObjectProviders, animationObjects); + final StringBuilder objectText = new StringBuilder(); + for (final String attribute : attributes) { + objectText.append(attribute); + objectText.append('\n'); + } + baseArchetype.setObjectText(objectText.toString()); + archetypeSet.addArchetype(baseArchetype); + } + + /** + * Parses artifacts definitions. + * @param artifacts the artifacts definitions + * @throws IOException if parsing fails + */ + public void parseArtifacts(@NotNull final String artifacts) throws IOException { + final Reader reader = new StringReader(artifacts); + final BufferedReader bufferedReader = new BufferedReader(reader); + try { + artifactParser.loadArtifact(bufferedReader, errorViewCollector, "", "panel", "folder"); + } finally { + bufferedReader.close(); + } + } + + /** + * Returns an {@link Archetype} by name. + * @param archetypeName the archetype name + * @return the archetype + * @throws UndefinedArchetypeException if the archetype name is undefined + */ + @NotNull + public Archetype<TestGameObject, TestMapArchObject, TestArchetype> getArchetype(@NotNull final String archetypeName) throws UndefinedArchetypeException { + return archetypeSet.getArchetype(archetypeName); + } + + /** + * Returns the number of defined archetypes. + * @return the number of defined archetypes + */ + public int getArchetypeCount() { + return archetypeSet.getArchetypeCount(); + } + +} // class TestParser Property changes on: trunk/model/src/test/net/sf/gridarta/model/artifact/TestParser.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...> - 2010-10-04 20:18:26
|
Revision: 8664 http://gridarta.svn.sourceforge.net/gridarta/?rev=8664&view=rev Author: akirschbaum Date: 2010-10-04 20:18:20 +0000 (Mon, 04 Oct 2010) Log Message: ----------- Improve error messages about incorrect 'name' or 'def_arch' entries in artifact definitions. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java Modified: trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java 2010-10-03 09:46:13 UTC (rev 8663) +++ trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java 2010-10-04 20:18:20 UTC (rev 8664) @@ -231,9 +231,13 @@ // TODO: Allow not having a def arch // at this point we MUST have a legal name and def arch if (defArchName == null) { - errorViewCollector.addWarning(ErrorViewCategory.ARTIFACT_ENTRY_INVALID, "line " + lineCount + ", Object '" + defArchName + "' / '" + name + "' / '" + objTitle + "' has missing defArch"); - } else if (name == null || name.length() == 0 || defArchName.length() == 0) { + errorViewCollector.addWarning(ErrorViewCategory.ARTIFACT_ENTRY_INVALID, "line " + lineCount + ", Object '" + defArchName + "' / '" + name + "' / '" + objTitle + "' has missing def_arch"); + } else if (defArchName.isEmpty()) { + errorViewCollector.addWarning(ErrorViewCategory.ARTIFACT_ENTRY_INVALID, "line " + lineCount + ", Object '" + defArchName + "' / '" + name + "' / '" + objTitle + "' has empty def_arch"); + } else if (name == null) { errorViewCollector.addWarning(ErrorViewCategory.ARTIFACT_ENTRY_INVALID, "line " + lineCount + ", Object '" + defArchName + "' / '" + name + "' / '" + objTitle + "' has missing name"); + } else if (name.isEmpty()) { + errorViewCollector.addWarning(ErrorViewCategory.ARTIFACT_ENTRY_INVALID, "line " + lineCount + ", Object '" + defArchName + "' / '" + name + "' / '" + objTitle + "' has empty name"); } else { try { final R archetype = archetypeSet.getArchetype(defArchName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ryo...@us...> - 2010-10-03 09:46:20
|
Revision: 8663 http://gridarta.svn.sourceforge.net/gridarta/?rev=8663&view=rev Author: ryo_saeba Date: 2010-10-03 09:46:13 +0000 (Sun, 03 Oct 2010) Log Message: ----------- Add 'player' type. Modified Paths: -------------- trunk/crossfire/resource/resource/conf/types.xml Modified: trunk/crossfire/resource/resource/conf/types.xml =================================================================== --- trunk/crossfire/resource/resource/conf/types.xml 2010-09-29 21:23:24 UTC (rev 8662) +++ trunk/crossfire/resource/resource/conf/types.xml 2010-10-03 09:46:13 UTC (rev 8663) @@ -3715,6 +3715,13 @@ </type> <!--####################################################################--> + <type number="1" name="Player"> + <description><![CDATA[ + This type of objects must not be used on a map. They will be ignored during map load by server.]]> + </description> + </type> + + <!--####################################################################--> <type number="7" name="Poison Food"> <description><![CDATA[ When eating, the player's stomach is drained by 1/4 of food. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-09-29 21:23:30
|
Revision: 8662 http://gridarta.svn.sourceforge.net/gridarta/?rev=8662&view=rev Author: akirschbaum Date: 2010-09-29 21:23:24 +0000 (Wed, 29 Sep 2010) Log Message: ----------- Update default path to client executable on GNU/Linux. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-09-29 21:20:00 UTC (rev 8661) +++ trunk/atrinik/ChangeLog 2010-09-29 21:23:24 UTC (rev 8662) @@ -1,5 +1,7 @@ 2010-09-29 Alex Tokar + * Update default path to client executable on GNU/Linux. + * Remove unnecessary map validators. 2010-09-25 Andreas Kirschbaum 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 2010-09-29 21:20:00 UTC (rev 8661) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-09-29 21:23:24 UTC (rev 8662) @@ -448,7 +448,7 @@ @NotNull @Override public AppPreferencesModel createAppPreferencesModel() { - return new AppPreferencesModel("../server/atrinik_server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/atrinik.exe" : "../client-0.1/atrinik", "vim"); + return new AppPreferencesModel("../server/atrinik_server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/atrinik.exe" : "../client-1.1.1/atrinik-client", "vim"); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-09-29 21:20:06
|
Revision: 8661 http://gridarta.svn.sourceforge.net/gridarta/?rev=8661&view=rev Author: akirschbaum Date: 2010-09-29 21:20:00 +0000 (Wed, 29 Sep 2010) Log Message: ----------- Remove unnecessary map validators. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-09-25 21:44:59 UTC (rev 8660) +++ trunk/atrinik/ChangeLog 2010-09-29 21:20:00 UTC (rev 8661) @@ -1,3 +1,7 @@ +2010-09-29 Alex Tokar + + * Remove unnecessary map validators. + 2010-09-25 Andreas Kirschbaum * Correctly update archetypes when undoing/redoing operations 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 2010-09-25 21:44:59 UTC (rev 8660) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-09-29 21:20:00 UTC (rev 8661) @@ -22,7 +22,6 @@ import java.awt.Component; import java.io.IOException; import java.net.URL; -import java.util.regex.Pattern; import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.io.GuiFileFilters; import net.sf.gridarta.gui.map.mapview.DefaultMapViewFactory; @@ -104,19 +103,14 @@ import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker; import net.sf.gridarta.validation.checks.BlockedSpawnPointChecker; -import net.sf.gridarta.validation.checks.BlockedSquareChecker; import net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker; import net.sf.gridarta.validation.checks.ConnectedPickableChecker; -import net.sf.gridarta.validation.checks.CustomTypeChecker; import net.sf.gridarta.validation.checks.DoubleLayerChecker; -import net.sf.gridarta.validation.checks.DoubleTypeChecker; import net.sf.gridarta.validation.checks.EmptySpawnPointChecker; import net.sf.gridarta.validation.checks.ExitChecker; import net.sf.gridarta.validation.checks.InvalidCheckException; import net.sf.gridarta.validation.checks.MapDifficultyChecker; import net.sf.gridarta.validation.checks.MobOutsideSpawnPointChecker; -import net.sf.gridarta.validation.checks.SlayingChecker; -import net.sf.gridarta.validation.checks.SquareWithoutFloorChecker; import net.sf.gridarta.validation.checks.TilePathsChecker; import net.sf.gridarta.validation.checks.UndefinedArchetypeChecker; import net.sf.gridarta.validation.checks.UndefinedFaceChecker; @@ -369,14 +363,7 @@ addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_paralyze", "paralyze (effect)", Integer.MIN_VALUE, 100); addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_snare", "snare (effect)", Integer.MIN_VALUE, 100); } - final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); - customTypeChecker.addIgnore(Archetype.TYPE_MOB, Archetype.TYPE_SPAWN_POINT_MOB, Archetype.TYPE_SPAWN_POINT); - final SlayingChecker<GameObject, MapArchObject, Archetype> slayingChecker = new SlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Pattern.compile("^[a-zA-Z_0-9/.]*$")); - final GameObjectMatcher environmentSensorMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_environment_sensor"); - if (environmentSensorMatcher != null) { - slayingChecker.addMatcher(environmentSensorMatcher, Pattern.compile("|([0-1][0-9]|2[0-3]):[0-5][0-9]-([0-1][0-9]|2[0-3]):[0-5][0-9]")); - } - mapValidators.addValidators(new BlockedSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new BlockedMobOrSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new BlockedSquareChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), attributeRangeChecker, customTypeChecker, new DoubleTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new ExitChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new SquareWithoutFloorChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_FLOOR, Archetype.TYPE_SHOP_FLOOR), slayingChecker, new TilePathsChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER)); + mapValidators.addValidators(new BlockedSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new BlockedMobOrSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), attributeRangeChecker, new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new ExitChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new TilePathsChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER)); } private static void addAttributeRangeChecker(@NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final GameObjectMatcher matcher, @NotNull final String name, @NotNull final String displayName, final int minValue, final int maxValue) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |