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: <chr...@us...> - 2006-07-05 22:06:03
|
Revision: 234 Author: christianhujer Date: 2006-07-05 15:05:43 -0700 (Wed, 05 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=234&view=rev Log Message: ----------- Added validator for map difficulty. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/map/MapArchObject.java trunk/daimonin/src/daieditor/messages.properties Added Paths: ----------- trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyError.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-07-03 21:21:15 UTC (rev 233) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-07-05 22:05:43 UTC (rev 234) @@ -69,6 +69,7 @@ import daieditor.map.validation.checks.SquareWithoutFloorChecker; import daieditor.map.validation.checks.SysObjectOnLayerZeroChecker; import daieditor.map.validation.checks.TilePathsChecker; +import daieditor.map.validation.checks.MapDifficultyChecker; import daieditor.textedit.scripteditor.ScriptEditControl; import java.awt.Image; import java.awt.Point; @@ -339,6 +340,7 @@ new DoubleLayerChecker(), new EmptySpawnPointChecker(), new ExitChecker(), + new MapDifficultyChecker(), new MobOutsideSpawnPointChecker(), new SquareWithoutFloorChecker(), new SlayingChecker(), Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-07-03 21:21:15 UTC (rev 233) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-07-05 22:05:43 UTC (rev 234) @@ -403,6 +403,9 @@ swapTime = parseProperty(fieldSwapTime.getText(), "Swap Time"); resetTimeout = parseProperty(fieldResetTimeout.getText(), "Reset Timeout"); difficulty = parseProperty(fieldDifficulty.getText(), "Difficulty"); + if (difficulty < 1) { + throw new IllegalArgumentException("Difficulty must be > 0"); // TODO: i18n/l10n + } darkness = parseProperty(fieldDarkness.getText(), "Darkness"); // Now do some sanity checks: Modified: trunk/daimonin/src/daieditor/map/MapArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-07-03 21:21:15 UTC (rev 233) +++ trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-07-05 22:05:43 UTC (rev 234) @@ -276,7 +276,7 @@ } public void setDifficulty(final int difficulty) { - this.difficulty = difficulty; + this.difficulty = difficulty < 1 ? 1 : difficulty; } public boolean isFixedReset() { @@ -472,7 +472,7 @@ } else if (line.startsWith("swap_time ")) { swapTime = getLineValue(line); } else if (line.startsWith("difficulty ")) { - difficulty = getLineValue(line); + setDifficulty(getLineValue(line)); } else if (line.startsWith("darkness ")) { darkness = getLineValue(line); } else if (line.startsWith("fixed_resettime ")) { Added: trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java =================================================================== --- trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java (rev 0) +++ trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java 2006-07-05 22:05:43 UTC (rev 234) @@ -0,0 +1,30 @@ +package daieditor.map.validation.checks; + +import daieditor.map.MapModel; +import daieditor.map.MapArchObject; +import daieditor.map.validation.AbstractValidator; +import daieditor.map.validation.ErrorCollector; +import daieditor.map.validation.MapValidator; + +/** + * Validator that checks whether the map has a valid difficulty. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class MapDifficultyChecker extends AbstractValidator implements MapValidator { + + /** + * Create a MapDifficultyChecker. + */ + public MapDifficultyChecker() { + } + + /** {@inheritDoc} */ + public void validate(final MapModel mapModel, final ErrorCollector errorCollector) { + final MapArchObject mapArch = mapModel.getMapArch(); + final int difficulty = mapArch.getDifficulty(); + if (difficulty < 1) { + errorCollector.collect(new MapDifficultyError(mapModel, difficulty)); + } + } + +} // class TilePathsChecker Property changes on: trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyError.java =================================================================== --- trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyError.java (rev 0) +++ trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyError.java 2006-07-05 22:05:43 UTC (rev 234) @@ -0,0 +1,33 @@ +package daieditor.map.validation.checks; + +import daieditor.map.MapModel; +import daieditor.map.validation.MapValidationError; + +/** + * Validation error that's used when a map has wrong tile paths. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class MapDifficultyError extends MapValidationError { + + /** The difficulty that was wrong. */ + private final int difficulty; + + /** + * Create a MapDifficultyError + * @param mapModel the map on which the error occurred + * @param difficulty difficulty which was wrong + */ + public MapDifficultyError(final MapModel mapModel, final int difficulty) { + super(mapModel); + this.difficulty = difficulty; + } + + /** + * Returns the difficulty that was wrong. + * @return the difficulty that was wrong. + */ + public int getDifficulty() { + return difficulty; + } + +} // class MapDifficultyError Property changes on: trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyError.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-07-03 21:21:15 UTC (rev 233) +++ trunk/daimonin/src/daieditor/messages.properties 2006-07-05 22:05:43 UTC (rev 234) @@ -914,6 +914,9 @@ Validator.Exit.title=Exit path invalid Validator.Exit.msg=<html><h3>{0}</h3><p>This exit has an invalid path.<br>Change the path or create the missing map. +Validator.MapDifficulty.title=Map difficulty invalid +Validator.MapDifficulty.msg=<html><h3>{0}</h3>This map has an invalid difficulty.<br>Go to the map properties dialog and change the difficulty setting. + Validator.MobOutsideSpawnPoint.title=Mob outside spawn point Validator.MobOutsideSpawnPoint.msg=<html><h3>{0}</h3><p>On this square there is a mob outside a spawn point.<br>Mobs outside spawn points are okay, but you should perhaps still put the mob inside a spawn point.</p><p>You could:</p><ul><li>Ignore this</li><li>Create a spawn point for this mob</li></ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-03 21:21:31
|
Revision: 233 Author: christianhujer Date: 2006-07-03 14:21:15 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=233&view=rev Log Message: ----------- Some unification of ArchObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/daimonin/src/daieditor/arch/ArchObject.java Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-07-03 21:04:56 UTC (rev 232) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-07-03 21:21:15 UTC (rev 233) @@ -183,7 +183,7 @@ if (replaceArch != null) { colonLabel = new JLabel(":"); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(replaceArch.getFaceNr())); - rfArchName = new JLabel(" " + replaceArch.getBestName(replaceArch.getDefaultArch())); + rfArchName = new JLabel(" " + replaceArch.getBestName()); } else { colonLabel = new JLabel(""); rfArchName = new JLabel(""); @@ -233,7 +233,7 @@ } else { replaceWithBox.setSelectedIndex(0); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(replaceArch.getFaceNr())); - rfArchName.setText(" " + replaceArch.getBestName(replaceArch.getDefaultArch())); + rfArchName.setText(" " + replaceArch.getBestName()); colonLabel.setText(":"); } @@ -263,7 +263,7 @@ final Icon oldIcon = iconLabel.getIcon(); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(newArch.getFaceNr())); - rfArchName.setText(" " + newArch.getBestName(newArch.getDefaultArch())); + rfArchName.setText(" " + newArch.getBestName()); colonLabel.setText(":"); // pack frame only if height of icon changed @@ -332,7 +332,7 @@ ((matchCriteria == MATCH_ARCH_NAME && node.getArchName() != null && node.getArchName().equalsIgnoreCase(matchString)) || (matchCriteria == MATCH_OBJ_NAME && - node.getBestName(node.getDefaultArch()).equalsIgnoreCase(matchString)))) { + node.getBestName().equalsIgnoreCase(matchString)))) { // first, delete the old arch final ArchObject prevArch = node.getPrev(); it.remove(); Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-07-03 21:04:56 UTC (rev 232) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-07-03 21:21:15 UTC (rev 233) @@ -373,7 +373,7 @@ * @param panelList JList from the MapArchPanel (script tab) which displays the events */ public void addEventScript(final JList panelList, final ArchObject arch) { - final String archName = arch.getBestName(arch.getDefaultArch()); + final String archName = arch.getBestName(); // create a reasonable default script name for lazy users :-) final String defScriptName = chooseDefaultScriptName(archName); Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-03 21:04:56 UTC (rev 232) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-03 21:21:15 UTC (rev 233) @@ -132,7 +132,7 @@ private boolean editflag; // if true, object is in a editor // for example in the map arch panel - private boolean artifactsFlag; // if set, this is not a "real" arch + private boolean artifact; // if set, this is not a "real" arch // It will NOT be included in the arch collection private ArchObject next; // to chain ArchObjects in maps @@ -175,7 +175,7 @@ objName = null; noface = true; // this sucker has no face - artifactsFlag = false; // will be true for arches from the artifacts file + artifact = false; // will be true for arches from the artifacts file faceName = null; // if there is a face cmd, this is the face name facenr = -1; // if we have a face AND we have loaded the face, this is his number. // if faceName != null and facenr == -1, we haven't loaded the face @@ -452,6 +452,23 @@ this.editType = editType; } + /** {@inheritDoc} */ + public ArchObject getContainer() { + return env; + } + + /** {@inheritDoc} */ + public ArchObject getTopContainer() { + ArchObject tmpArch; + + for (tmpArch = this; tmpArch.getContainer() != null; + tmpArch = tmpArch.getContainer()) { + ; + } + + return tmpArch; + } + /** * Set the String of an arch attribute in the archText. * @param attr search for "attr <string>" @@ -557,31 +574,29 @@ myId = num; } - /** {@inheritDoc} */ - public ArchObject getContainer() { - return env; + /** + * Sets if this flag is set, the arch is not a "real" arch but comes from + * the artifacts file. Such ArchObject instances are not included in the + * arch collection, since the artifacts file is the same for editor and + * server. + * @param artifact if this flag is set, the arch is not a "real" arch but comes from the artifacts file. + */ + public void setArtifact(final boolean artifact) { + this.artifact = artifact; } - /** {@inheritDoc} */ - public ArchObject getTopContainer() { - ArchObject tmpArch; - - for (tmpArch = this; tmpArch.getContainer() != null; - tmpArch = tmpArch.getContainer()) { - ; - } - - return tmpArch; + /** + * Returns if this flag is set, the arch is not a "real" arch but comes + * from the artifacts file. Such ArchObject instances are not included in + * the arch collection, since the artifacts file is the same for editor and + * server. + * @return if this flag is set, the arch is not a "real" arch but comes + * from the artifacts file. + */ + public boolean isArtifact() { + return artifact; } - public void setArtifactFlag(final boolean aflag) { - artifactsFlag = aflag; - } - - public boolean getArtifactFlag() { - return artifactsFlag; - } - /** * The given <code>ArchObject</code> 'arch' is placed as inventory * into 'this' <code>ArchObject</code>. (Keep in mind that 'arch' @@ -714,8 +729,7 @@ } public boolean isReferenced() { - return multi != null ? multi.isReferenced() : false; - + return multi != null && multi.isReferenced(); } // this chained multi tiles on map for fast access. better then number and search trash @@ -978,11 +992,10 @@ /** * Name which is best appropriate to describe this arch. (This can be - * arch/object name or default arch/object name) - * @param defaultArch the default arch (if available, faster to use it than look it up again) + * arch/object name or default arch/object name) * @return best suitable descriptive name */ - public String getBestName(final ArchObject defaultArch) { + public String getBestName() { if (objName != null && objName.length() > 0) { return objName; } else if (defaultArch != null && defaultArch.objName != null && defaultArch.objName.length() > 0) { @@ -1050,12 +1063,13 @@ } /** - * Get all entries from the given archtext 'atxt' that don't exist - * in 'this' archtext. - * @param atxt archtext to compare 'this'-arch with - * @param ignoreValues if true: the values in the archtext-entries - * are ignored at the comparison + * Get all entries from the given archtext 'atxt' that don't exist in + * 'this' archtext. + * @param atxt archtext to compare 'this'-arch with + * @param ignoreValues if true: the values in the archtext-entries are + * ignored at the comparison * @return all lines from 'atxt' that don't occur in 'this' arch + * @todo this method is too slow - find a faster way */ public String diffArchText(String atxt, final boolean ignoreValues) { int j; Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-07-03 21:04:56 UTC (rev 232) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-07-03 21:21:15 UTC (rev 233) @@ -357,7 +357,7 @@ // if this arch was from Artifacts file - return here: if (archName != null) { - arch.setArtifactFlag(true); + arch.setArtifact(true); // here we add all unchanged arch text lines from def_arch back to arch arch.addArchText(arch.diffArchText(defArch.getArchText(), true)); return arch; Modified: trunk/crossfire/src/cfeditor/filter/AttributeFilter.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-07-03 21:04:56 UTC (rev 232) +++ trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-07-03 21:21:15 UTC (rev 233) @@ -73,7 +73,7 @@ if (matchType >= 0) { hasChecked = true; if (LOG.isDebugEnabled()) { - LOG.debug("checking type for " + object.getBestName(object.getDefaultArch())); + LOG.debug("checking type for " + object.getBestName()); LOG.debug("o.getArchTypNr() != matchType: " + object.getArchTypNr() + " != " + matchType); } if (object.getArchTypNr() != matchType) { Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-03 21:04:56 UTC (rev 232) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-03 21:21:15 UTC (rev 233) @@ -434,6 +434,16 @@ this.editType = editType; } + /** {@inheritDoc} */ + public ArchObjectContainer getContainer() { + return container; + } + + /** {@inheritDoc} */ + public ArchObject getTopContainer() { + return isInContainer() ? ((ArchObject) container).getTopContainer() : this; + } + /** * Sets container of this ArchObject. * There are two possibilities for the container: @@ -447,11 +457,6 @@ this.container = container; } - /** {@inheritDoc} */ - public ArchObjectContainer getContainer() { - return container; - } - /** * Check whether this ArchObject is in a Container (in Daimonin sense, * which means being in a MapSquare isn't, but being in an ArchObject is). @@ -464,11 +469,6 @@ } /** {@inheritDoc} */ - public ArchObject getTopContainer() { - return isInContainer() ? ((ArchObject) container).getTopContainer() : this; - } - - /** {@inheritDoc} */ @Override public MapSquare getMapSquare() { return container != null ? container.getMapSquare() : null; } @@ -628,11 +628,7 @@ } public boolean isReferenced() { - if (multi != null) { - return multi.isReferenced(); - } - - return false; + return multi != null && multi.isReferenced(); } // this chained multi tiles on map for fast access. better then number and search trash @@ -970,7 +966,45 @@ return archText.toString(); } + /** Clears the arch text of this arch. */ + public void resetArchText() { + archText.delete(0, archText.length()); + } + /** + * Get all entries from the given archtext 'atxt' that don't exist in + * 'this' archtext. + * @param atxt archtext to compare 'this'-arch with + * @param ignoreValues if true: the values in the archtext-entries are + * ignored at the comparison + * @return all lines from 'atxt' that don't occur in 'this' arch + * @todo this method is too slow - find a faster way + */ + public String diffArchText(final String atxt, final boolean ignoreValues) { + final StringBuilder result = new StringBuilder(); + for (String line : atxt.split("\\s*\n")) { + if (ignoreValues) { + final int spaceIndex = line.indexOf(" "); + if (line.length() > 0 && spaceIndex > 0 && diffTextString(getArchText(), line.substring(0, spaceIndex + 1), ignoreValues) == null) { + result.append(line).append('\n'); + } + } else { + try { + final String test = diffTextString(getArchText(), line, ignoreValues); + char c = '\n'; + if (test != null) { + c = test.charAt(0); + } + if (line.length() > 0 && (test == null || c == '\n')) { + result.append(line).append('\n'); + } + } catch (final StringIndexOutOfBoundsException e) { /* ignore */ } + } + } + return result.toString(); + } + + /** * Set The "face >name>" field of a object. We need this for fast * access. We set here the string name, the face number and we will handle * invalid/double names including comparing with a default arch. @@ -1099,44 +1133,6 @@ return null; } - /** Clears the arch text of this arch. */ - public void resetArchText() { - archText.delete(0, archText.length()); - } - - /** - * Get all entries from the given archtext 'atxt' that don't exist in - * 'this' archtext. - * @param atxt archtext to compare 'this'-arch with - * @param ignoreValues if true: the values in the archtext-entries are - * ignored at the comparison - * @return all lines from 'atxt' that don't occur in 'this' arch - * @todo this method is too slow - find a faster way - */ - public String diffArchText(final String atxt, final boolean ignoreValues) { - final StringBuilder result = new StringBuilder(); - for (String line : atxt.split("\\s*\n")) { - if (ignoreValues) { - final int spaceIndex = line.indexOf(" "); - if (line.length() > 0 && spaceIndex > 0 && diffTextString(getArchText(), line.substring(0, spaceIndex + 1), ignoreValues) == null) { - result.append(line).append('\n'); - } - } else { - try { - final String test = diffTextString(getArchText(), line, ignoreValues); - char c = '\n'; - if (test != null) { - c = test.charAt(0); - } - if (line.length() > 0 && (test == null || c == '\n')) { - result.append(line).append('\n'); - } - } catch (final StringIndexOutOfBoundsException e) { /* ignore */ } - } - } - return result.toString(); - } - /** Delete message text by nullification. */ public void deleteMsgText() { msgText = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-03 21:05:19
|
Revision: 232 Author: christianhujer Date: 2006-07-03 14:04:56 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=232&view=rev Log Message: ----------- Some unification of ArchObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/CMapFileEncode.java trunk/daimonin/src/daieditor/arch/ArchObject.java trunk/src/app/net/sf/gridarta/arch/ArchObject.java Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-07-03 20:36:22 UTC (rev 231) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-07-03 21:04:56 UTC (rev 232) @@ -146,20 +146,11 @@ /** * Walk through the inventory of an arch and write everything into the file. * @param start the container arch whose inventory is to be written - * @return true if all writing actions successful */ - public boolean browseInvObjects(final ArchObject start) { - // cycle throught the whole inventory list: - final Iterator it = start.getInventory(); - while (it.hasNext()) { - final ArchObject arch = (ArchObject) it.next(); - // write the inventory arch (recursion possible here) - if (!writeMapArch(arch, true)) { - return false; - } + private void browseInvObjects(final ArchObject start) { + for (final ArchObject arch : start) { + writeMapArch(arch, true); } - - return true; // all ok } /** Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-07-03 20:36:22 UTC (rev 231) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-07-03 21:04:56 UTC (rev 232) @@ -373,16 +373,16 @@ // if this is a multi-tile, we want to show the head's inventory final Iterator it; if (node.isReferenced() && node.getMapMultiHead() != null) { - final Iterator it2 = node.getMapMultiHead().getInventory(); // we go to heads inv. + final Iterator it2 = node.getMapMultiHead().iterator(); // we go to heads inv. if (it2.hasNext()) { final ArchObject arch = (ArchObject) it2.next(); x = Integer.toString(arch.getMapX()); y = Integer.toString(arch.getMapY()); } - it = node.getMapMultiHead().getInventory(); // we go to heads inv. + it = node.getMapMultiHead().iterator(); // we go to heads inv. } else { - it = node.getInventory(); // we go to our own inv. start + it = node.iterator(); // we go to our own inv. start } final String indentStr = Integer.toString(indent); Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-03 20:36:22 UTC (rev 231) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-03 21:04:56 UTC (rev 232) @@ -39,7 +39,6 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.ListIterator; import javax.swing.JList; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -419,15 +418,7 @@ return getAttributeLong(attr, useDefArch ? defaultArch : null); } - /** - * Get the value of an arch attribute from the archText both of the arch - * itself and eventually its default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. - * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this - * arch is a default arch or the default arch should be ignored - * @return <value>, zero if not found - */ + /** {@inheritDoc} */ public double getAttributeDouble(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { String aText = archText.toString(); // Add all attributes from defarch that don't already exist in aText @@ -448,15 +439,7 @@ return result; } - /** - * Get the value of an arch attribute from the archText both of the arch - * itself and eventually its default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. - * @param attr search for "attr <value>" - * @param useDefArch <code>true</code> if the default arch of this - * ArchObject should be queried as well, <code>false</code> to ignore it - * @return <value>, zero if not found - */ + /** {@inheritDoc} */ public double getAttributeDouble(final String attr, final boolean useDefArch) { return getAttributeDouble(attr, useDefArch ? defaultArch : null); } @@ -574,14 +557,12 @@ myId = num; } + /** {@inheritDoc} */ public ArchObject getContainer() { return env; } - /** - * Get the topmost container of this ArchObject. - * @return the topmost container - */ + /** {@inheritDoc} */ public ArchObject getTopContainer() { ArchObject tmpArch; @@ -601,11 +582,6 @@ return artifactsFlag; } - /** Return a ListIterator for all inventory {@link ArchObject}s. */ - public ListIterator getInventory() { - return Collections.unmodifiableList(inv).listIterator(); - } - /** * The given <code>ArchObject</code> 'arch' is placed as inventory * into 'this' <code>ArchObject</code>. (Keep in mind that 'arch' @@ -1317,10 +1293,8 @@ // If 'this' arch is a container, we have to create clones // of the whole inventory (recursively) and link them in: - final Iterator<ArchObject> it = inv.iterator(); - while (it.hasNext()) { - final ArchObject tmp = it.next(); - clone.addInvObj(tmp.createClone(posx, posy)); + for (final ArchObject invItem : inv) { + clone.addInvObj(invItem.createClone(posx, posy)); } return clone; Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-07-03 20:36:22 UTC (rev 231) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-07-03 21:04:56 UTC (rev 232) @@ -41,6 +41,7 @@ import net.sf.gridarta.Size2D; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * The level model that represents a level. @@ -124,7 +125,7 @@ /** * Place a list of arches onto the map. - * @param arch the head of the arches list; may be null to insert nothing + * @param objects the heads of the arches list; may be null to insert nothing */ private void addArchListToMap(final List<ArchObject> objects) { if (objects == null) { @@ -726,21 +727,16 @@ * @param id ID number of arch (-> <code>arch.getMyID()</code>) * @return the specified arch, or null if not found */ - @Nullable public ArchObject findInvObject(final ArchObject node, final int id) { - final Iterator it = node.getInventory(); - while (it.hasNext()) { - final ArchObject arch = (ArchObject) it.next(); - + @Nullable public ArchObject findInvObject(@NotNull final ArchObject node, final int id) { + for (final ArchObject arch : node) { if (arch.getMyID() == id) { return arch; } - final ArchObject temp = findInvObject(arch, id); if (temp != null) { return temp; } } - return null; } Modified: trunk/daimonin/src/daieditor/CMapFileEncode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-07-03 20:36:22 UTC (rev 231) +++ trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-07-03 21:04:56 UTC (rev 232) @@ -125,9 +125,7 @@ * @throws IOException in case of I/O problems */ private void browseInvObjects(final ArchObject start) throws IOException { - // cycle throught the whole inventory list: - for (ArchObject arch : start) { - // write the inventory arch (recursion possible here) + for (final ArchObject arch : start) { writeMapArch(arch, true); } } Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-03 20:36:22 UTC (rev 231) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-03 21:04:56 UTC (rev 232) @@ -139,7 +139,15 @@ private ArchObject prev; // same - private ArchObjectContainer container; // we are in this container + /** + * Container of this ArchObject. + * There are two possibilities for the container: + * <ul> + * <li>Another ArchObject, which means this object is in the inventory of that ArchObject.</li> + * <li>A MapSquare, which means that this ArchObject is top level on that MapSquare.</li> + * </ul> + */ + private ArchObjectContainer container; private int archType; // CF object type of the arch @@ -392,15 +400,7 @@ return getAttributeLong(attr, useDefArch ? defaultArch : null); } - /** - * Get the value of an arch attribute from the archText both of the arch - * itself and eventually its default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. - * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this - * arch is a default arch or the default arch should be ignored - * @return <value>, zero if not found - */ + /** {@inheritDoc} */ public double getAttributeDouble(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { String aText = archText.toString(); // Add all attributes from defarch that don't already exist in aText @@ -421,15 +421,7 @@ return result; } - /** - * Get the value of an arch attribute from the archText both of the arch - * itself and eventually its default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. - * @param attr search for "attr <value>" - * @param useDefArch <code>true</code> if the default arch of this - * ArchObject should be queried as well, <code>false</code> to ignore it - * @return <value>, zero if not found - */ + /** {@inheritDoc} */ public double getAttributeDouble(final String attr, final boolean useDefArch) { return getAttributeDouble(attr, useDefArch ? defaultArch : null); } @@ -442,10 +434,20 @@ this.editType = editType; } + /** + * Sets container of this ArchObject. + * There are two possibilities for the container: + * <ul> + * <li>Another ArchObject, which means this object is in the inventory of that ArchObject.</li> + * <li>A MapSquare, which means that this ArchObject is top level on that MapSquare.</li> + * </ul> + * @param container container of this ArchObject. + */ public void setContainer(final ArchObjectContainer container) { this.container = container; } + /** {@inheritDoc} */ public ArchObjectContainer getContainer() { return container; } @@ -461,11 +463,7 @@ return container != null && container instanceof ArchObject; } - /** - * Get the topmost container of this ArchObject (in Daimonin sense, which - * means being in a MapSquare isn't, but being in an ArchObject is). - * @return the topmost container but always ArchObject, never MapSquare - */ + /** {@inheritDoc} */ public ArchObject getTopContainer() { return isInContainer() ? ((ArchObject) container).getTopContainer() : this; } Modified: trunk/src/app/net/sf/gridarta/arch/ArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-07-03 20:36:22 UTC (rev 231) +++ trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-07-03 21:04:56 UTC (rev 232) @@ -116,4 +116,22 @@ */ double getAttributeDouble(String attr, boolean useDefArch); + /** + * Returns container of this ArchObject. + * There are two possibilities for the container: + * <ul> + * <li>Another ArchObject, which means this object is in the inventory of that ArchObject.</li> + * <li>A MapSquare, which means that this ArchObject is top level on that MapSquare.</li> + * </ul> + * @return container of this ArchObject. + */ + Object getContainer(); // todo: change return type to something more specific. + + /** + * Get the topmost container of this ArchObject (in Game sense, which + * means being in a MapSquare isn't, but being in an ArchObject is). + * @return the topmost container but always ArchObject, never MapSquare + */ + ArchObject getTopContainer(); + } // interface ArchObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-03 20:36:51
|
Revision: 231 Author: christianhujer Date: 2006-07-03 13:36:22 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=231&view=rev Log Message: ----------- Some unification of ArchObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/arch/ArchObject.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java trunk/src/app/net/sf/gridarta/arch/ArchObject.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-07-03 20:36:22 UTC (rev 231) @@ -376,7 +376,7 @@ private JComboBox buildSpellBox(final CFArchAttrib attr) { // first parse the spell-number value from arch - int spnum = arch.getAttributeValue(attr.getNameOld(), defarch); // spell number + int spnum = arch.getAttributeInt(attr.getNameOld(), defarch); // spell number if (spnum < 0 || spnum >= typelist.getSpellNum().length - 1) { spnum = 0; // undefined spellnumbers be zero @@ -419,7 +419,7 @@ // build the array of list-items final String []array = new String[(int) (listData.size() / 2.)]; boolean hasSelection = false; - int active = arch.getAttributeValue(attr.getNameOld(), defarch); + int active = arch.getAttributeInt(attr.getNameOld(), defarch); for (int i = 0; i < array.length; i++) { array[i] = (String) listData.elementAt(i * 2 + 1); // put string to array @@ -454,7 +454,7 @@ */ private void buildBitmask(final CFArchAttrib attr, final BitmaskAttrib guiAttr, final CAttribBitmask bitmask, final JPanel mainPanel) { // initialize bitmask value - guiAttr.setValue(arch.getAttributeValue(attr.getNameOld(), defarch)); + guiAttr.setValue(arch.getAttributeInt(attr.getNameOld(), defarch)); guiAttr.bitmask = bitmask; // add button @@ -684,7 +684,7 @@ final JCheckBox input; if (dType == CFArchAttrib.T_BOOL) { // normal bool - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeValue(type.getAttr()[i].getNameOld(), defarch) == 1)); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeInt(type.getAttr()[i].getNameOld(), defarch) == 1)); } else { // parse values for customized bool final String trueVal = type.getAttr()[i].getMisc()[0]; @@ -725,7 +725,7 @@ // parse value from arch final int fieldLength = (type.getAttr()[i].getInputLength() == 0 ? textFieldColumns : type.getAttr()[i].getInputLength()); - final int attrval = arch.getAttributeValue(type.getAttr()[i].getNameOld(), defarch); + final int attrval = arch.getAttributeInt(type.getAttr()[i].getNameOld(), defarch); if (attrval != 0) { input = new JTextField(String.valueOf(attrval), fieldLength); } else { @@ -1199,7 +1199,7 @@ if (dType == CFArchAttrib.T_BOOL) { // a boolean attribute (flag) if (((BoolAttrib) attr).input.isSelected() != - (defarch.getAttributeValue(attr.ref.getNameOld(), null) == 1)) { + (defarch.getAttributeInt(attr.ref.getNameOld(), null) == 1)) { newArchText = newArchText + attr.ref.getNameOld() + " " + (((BoolAttrib) attr).input.isSelected() ? 1 : 0) + "\n"; } @@ -1219,7 +1219,7 @@ dType == CFArchAttrib.T_FLOAT) { // an int attribute if (dType == CFArchAttrib.T_INT && ((IntAttrib) attr).input.getText().trim().length() == 0) { - if (defarch.getAttributeValue(attr.ref.getNameOld(), null) != 0) { + if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } } else if (dType == CFArchAttrib.T_FLOAT && ((FloatAttrib) attr).input.getText().trim().length() == 0) { @@ -1230,7 +1230,7 @@ try { if (dType == CFArchAttrib.T_INT) { final int value = Integer.parseInt(((IntAttrib) attr).input.getText().trim()); - if (defarch.getAttributeValue(attr.ref.getNameOld(), null) != value) { + if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else { @@ -1308,19 +1308,19 @@ if (attrVal == -1 || (attrVal == 0 && dType != CFArchAttrib.T_SPELL && dType != CFArchAttrib.T_ZSPELL)) { - if (defarch.getAttributeValue(attr.ref.getNameOld(), null) != 0) { + if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } } else if (attrVal == 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; - } else if (defarch.getAttributeValue(attr.ref.getNameOld(), null) != attrVal) { + } else if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != attrVal) { newArchText = newArchText + attr.ref.getNameOld() + " " + attrVal + "\n"; } } else if (dType == CFArchAttrib.T_BITMASK) { // a bitmask attribute (similar to integer, but easier because no parsing needed) final int value = ((BitmaskAttrib) attr).getValue(); // get bitmask value - if (defarch.getAttributeValue(attr.ref.getNameOld(), null) != value) { + if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else if (dType == CFArchAttrib.T_TREASURE) { Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-07-03 20:36:22 UTC (rev 231) @@ -1316,8 +1316,8 @@ final String path = exit.getAttributeString("slaying", getArch(exit.getNodeNr())); final Point exitPos = new Point(); - exitPos.x = exit.getAttributeValue("hp", getArch(exit.getNodeNr())); - exitPos.y = exit.getAttributeValue("sp", getArch(exit.getNodeNr())); + exitPos.x = exit.getAttributeInt("hp", getArch(exit.getNodeNr())); + exitPos.y = exit.getAttributeInt("sp", getArch(exit.getNodeNr())); if (path.length() == 0 || (currentMap.getMapFile() != null && path.equals(currentMap.getMapFile().getName()))) { Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-07-03 20:36:22 UTC (rev 231) @@ -428,7 +428,7 @@ // we look for 'type' in the ArchText. In future maybe type should get // a seperate textfield if (arch.getAttributeString("type", null).length() > 0) { - arch.setArchTypNr(arch.getAttributeValue("type", null)); // specified type + arch.setArchTypNr(arch.getAttributeInt("type", null)); // specified type } // Recalculate the editType value. It shall stay 100% accurate ;) Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-03 20:36:22 UTC (rev 231) @@ -49,7 +49,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class ArchObject implements Cloneable, net.sf.gridarta.arch.ArchObject { +public class ArchObject implements Cloneable, net.sf.gridarta.arch.ArchObject, Iterable<ArchObject> { private static final Logger LOG = Logger.getLogger(ArchObject.class); @@ -71,6 +71,7 @@ private String archName; // arch Name + /** The name of this object. */ private String objName; /** @@ -104,6 +105,9 @@ private int nodenr; // we are (internal) arch nr in node list // the nodenr determines the (default) archetype + /** The default arch. */ + private ArchObject defaultArch; + /** Map x position if on map. */ private int mapx; @@ -213,7 +217,7 @@ * @return the default <code>ArchObject</code> for this arch */ public ArchObject getDefaultArch() { - return archstack.getArch(nodenr); + return defaultArch; } /** @@ -222,7 +226,7 @@ * the {@link ArchObjectStack}), otherwise <code>false</code> */ public boolean isDefaultArch() { - return archstack.getArch(nodenr) == this; + return defaultArch == this; } /** @@ -232,12 +236,11 @@ * @return new editType for this arch */ public int calculateEditType(final int checkType) { - final ArchObject defarch = getDefaultArch(); // default arch - + // ATTENTION! BE VERY CAREFUL WHEN YOU TRY TO UNIFY MORE OF THIS WITH DAIMONIN! /* if one of the types in checkType already is in editType, // we exclude that one - if ((checkType&editType) != 0) { - checkType -= (checkType&editType); + if ((checkType & editType) != 0) { + checkType -= (checkType & editType); } */ @@ -254,25 +257,25 @@ } if ((checkType & IGUIConstants.TILE_EDIT_BACKGROUND) != 0 - && getAttributeValue("is_floor", defarch) == 1 - && getAttributeValue("no_pick", defarch) == 1) { + && getAttributeInt("is_floor", true) == 1 + && getAttributeInt("no_pick", true) == 1) { // Backgroud: floors editType |= IGUIConstants.TILE_EDIT_BACKGROUND; } if ((checkType & IGUIConstants.TILE_EDIT_MONSTER) != 0 - && getAttributeValue("alive", defarch) == 1 - && (getAttributeValue("monster", defarch) == 1 || getAttributeValue("generator", defarch) == 1)) { + && getAttributeInt("alive", true) == 1 + && (getAttributeInt("monster", true) == 1 || getAttributeInt("generator", true) == 1)) { // Monster: monsters/npcs/generators editType |= IGUIConstants.TILE_EDIT_MONSTER; } if ((checkType & IGUIConstants.TILE_EDIT_WALL) != 0 && archType == 0 - && getAttributeValue("no_pass", defarch) == 1) { + && getAttributeInt("no_pass", true) == 1) { // Walls editType |= IGUIConstants.TILE_EDIT_WALL; } if ((checkType & IGUIConstants.TILE_EDIT_CONNECTED) != 0 - && getAttributeValue("connected", defarch) != 0) { + && getAttributeInt("connected", true) != 0) { // Connected Objects editType |= IGUIConstants.TILE_EDIT_CONNECTED; } @@ -282,7 +285,7 @@ editType |= IGUIConstants.TILE_EDIT_EXIT; } if ((checkType & IGUIConstants.TILE_EDIT_TREASURE) != 0 - && getAttributeValue("no_pick", defarch) == 0 + && getAttributeInt("no_pick", true) == 0 && (archType == 4 || archType == 5 || archType == 36 || archType == 60 || archType == 85 || archType == 111 || archType == 123 || archType == 124 || archType == 130)) { // Treasure: randomtreasure/money/gems/potions/spellbooks/scrolls editType |= IGUIConstants.TILE_EDIT_TREASURE; @@ -293,8 +296,8 @@ editType |= IGUIConstants.TILE_EDIT_DOOR; } if ((checkType & IGUIConstants.TILE_EDIT_EQUIP) != 0 - && getAttributeValue("no_pick", defarch) == 0 - && ((archType >= 13 && archType <= 16) || archType == 33 || archType == 34 || archType == 35 || archType == 39 || archType == 70 || archType == 87 || archType == 99 || archType == 100 || archType == 104 || archType == 109 || archType == 113 || archType == 122 || archType == 3)) { + && getAttributeInt("no_pick", true) == 0 + && (archType >= 13 && archType <= 16 || archType == 33 || archType == 34 || archType == 35 || archType == 39 || archType == 70 || archType == 87 || archType == 99 || archType == 100 || archType == 104 || archType == 109 || archType == 113 || archType == 122 || archType == 3)) { // Equipment: weapons/armour/wands/rods editType |= IGUIConstants.TILE_EDIT_EQUIP; } @@ -303,52 +306,6 @@ } /** - * Get the value of an arch attribute from the archText both of the arch - * itself and if n.e. in it's default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. - * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this - * arch is a default arch or the default arch should be ignored - * @return <value>, zero if not found - */ - public int getAttributeValue(String attr, final ArchObject defarch) { - String aText = archText.toString(); // The "real" Archtext from arch & defarch - int j; - - // Add all attributes from defarch that don't already exist in aText - if (defarch != null) { - aText = aText + diffArchText(defarch.getArchText(), true); - } - - if (!aText.endsWith("\n")) { - aText = aText.concat("\n"); // string should end with '\n', see below - } - - attr = attr.trim() + " "; // attr must be followed by space - - // Check line by line for the string 'attr' - int i; - int result = 0; - for (i = 0, j = 0; i < aText.length(); i++) { - if (aText.charAt(i) == '\n') { - final String line = aText.substring(j, i).trim(); - - try { - // try to read the value behind 'attr' - if (line.startsWith(attr)) { - result = Integer.parseInt(line.substring(attr.length()).trim()); - } - } catch (NumberFormatException e) { - result = 0; - } - - j = i + 1; - } - } - return result; - } - - /** * Get the String of an arch attribute from the archText both of the arch * itself and if n.e. in it's default arch. If the attribute doesn't exist * in either one, an empty String "" is returned. @@ -357,7 +314,7 @@ * arch is a default arch or the default arch should be ignored * @return <string>, "" if not found */ - public String getAttributeString(String attr, @Nullable final ArchObject defarch) { + public String getAttributeString(String attr, @Nullable final net.sf.gridarta.arch.ArchObject defarch) { String aText = archText.toString(); // The "real" Archtext from arch & defarch int j; attr = attr.trim() + " "; // attr must be followed by space @@ -401,7 +358,7 @@ /** {@inheritDoc} */ public String getAttributeString(final String attr, final boolean useDefArch) { - return getAttributeString(attr, useDefArch ? getDefaultArch() : null); + return getAttributeString(attr, useDefArch ? defaultArch : null); } /** {@inheritDoc} */ @@ -409,7 +366,110 @@ return getAttributeString(attr, true); } + /** {@inheritDoc} */ + public int getAttributeInt(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { + String aText = archText.toString(); // The "real" Archtext from arch & defarch + // Add all attributes from defarch that don't already exist in aText + if (defarch != null) { + aText += diffArchText(defarch.getArchText(), true); + } + assert aText.endsWith("\n"); + final String attr2 = attr.trim() + ' '; + int result = 0; + for (final String line : aText.split("\\s*\n")) { + if (line.startsWith(attr2)) { + try { + result = Integer.parseInt(line.substring(attr2.length()).trim()); + } catch (final NumberFormatException e) { + result = 0; + } + } + } + return result; + } + + /** {@inheritDoc} */ + public int getAttributeInt(final String attr, final boolean useDefArch) { + return getAttributeInt(attr, useDefArch ? defaultArch : null); + } + + /** {@inheritDoc} */ + public long getAttributeLong(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { + String aText = archText.toString(); + // Add all attributes from defarch that don't already exist in aText + if (defarch != null) { + aText += diffArchText(defarch.getArchText(), true); + } + final String attr2 = attr.trim() + ' '; + long result = 0; + for (final String line : aText.split("\\s*\n")) { + if (line.startsWith(attr2)) { + try { + result = Long.parseLong(line.substring(attr2.length())); + } catch (final NumberFormatException e) { + result = 0; + } + } + } + return result; + } + + /** {@inheritDoc} */ + public long getAttributeLong(final String attr, final boolean useDefArch) { + return getAttributeLong(attr, useDefArch ? defaultArch : null); + } + /** + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. + * @param attr search for "attr <value>" + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored + * @return <value>, zero if not found + */ + public double getAttributeDouble(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { + String aText = archText.toString(); + // Add all attributes from defarch that don't already exist in aText + if (defarch != null) { + aText += diffArchText(defarch.getArchText(), true); + } + final String attr2 = attr.trim() + ' '; + double result = 0; + for (String line : aText.split("\\s*\n")) { + if (line.startsWith(attr2)) { + try { + result = Double.parseDouble(line.substring(attr2.length())); + } catch (final NumberFormatException e) { + result = 0; + } + } + } + return result; + } + + /** + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. + * @param attr search for "attr <value>" + * @param useDefArch <code>true</code> if the default arch of this + * ArchObject should be queried as well, <code>false</code> to ignore it + * @return <value>, zero if not found + */ + public double getAttributeDouble(final String attr, final boolean useDefArch) { + return getAttributeDouble(attr, useDefArch ? defaultArch : null); + } + + /** + * Sets edit Type. + * @param editType edit Type. + */ + public void setEditType(final int editType) { + this.editType = editType; + } + + /** * Set the String of an arch attribute in the archText. * @param attr search for "attr <string>" * @param value value to set @@ -506,10 +566,6 @@ } } - public void setEditType(final int t) { - editType = t; - } - public int getMyID() { return myId; } @@ -604,14 +660,12 @@ } } - /** - * browse through the inventory tree and count all elements - * @return number of objects in the inventory - */ + /** {@inheritDoc} */ public int countInvObjects() { - int count = inv.size(); - for (final ArchObject anInv : inv) { - count += anInv.countInvObjects(); + int count = 0; + for (final ArchObject arch : this) { + count++; + count += arch.countInvObjects(); } return count; } @@ -922,6 +976,7 @@ /* Set Node number. Node number is the index of the default arch node list */ public void setNodeNr(final int nr) { nodenr = nr; + defaultArch = archstack.getArch(nodenr); } /* Get Node number. Node number is the index of the default arch node list */ @@ -952,24 +1007,31 @@ * @return best suitable descriptive name */ public String getBestName(final ArchObject defaultArch) { - if (getObjName() != null && getObjName().length() > 0) { - return getObjName(); - } else if (defaultArch != null && defaultArch.getObjName() != null && defaultArch.getObjName().length() > 0) { - return defaultArch.getObjName(); - } else if (getArchName() != null && getArchName().length() > 0) { - return getArchName(); - } else if (defaultArch != null && defaultArch.getArchName() != null) { - return defaultArch.getArchName(); + if (objName != null && objName.length() > 0) { + return objName; + } else if (defaultArch != null && defaultArch.objName != null && defaultArch.objName.length() > 0) { + return defaultArch.objName; + } else if (archName != null && archName.length() > 0) { + return archName; + } else if (defaultArch != null && defaultArch.archName != null) { + return defaultArch.archName; } return "???"; // this case should actually never happen } - // Obj name + /** + * Sets the name of this object. + * @param objName the name of this object. + */ public void setObjName(final String objName) { this.objName = objName != null ? objName.intern() : null; } + /** + * Returns the name of this object. + * @return the name of this object. + */ public String getObjName() { return objName; } @@ -1001,10 +1063,7 @@ clearCachedAttributeValue(); } - /** - * Returns the arch text of this arch as String. - * @return the arch text - */ + /** {@inheritDoc} */ public String getArchText() { return archText.toString(); } @@ -1243,6 +1302,7 @@ } clone.nodenr = nodenr; // node of the default arch + clone.defaultArch = defaultArch; // default arch clone.noface = noface; // if true, arch has no face as default clone.facenr = facenr; // the index of faceImages[] @@ -1498,4 +1558,9 @@ return (String) cachedAttribute.get(name); } + /** {@inheritDoc} */ + public Iterator<ArchObject> iterator() { + return inv.iterator(); + } + } // class ArchObject Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-07-03 20:36:22 UTC (rev 231) @@ -431,7 +431,6 @@ mapFileDecoder = new CMapFileDecode(); mapFileEncoder = new CMapFileEncode(); - ArchObject.setMControl(this); // our global object parser archObjectParser = new ArchObjectParser(this); animationObjects = new AnimationObjects(ACTION_FACTORY.getString("nameOfAnimationObject")); Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-03 20:36:22 UTC (rev 231) @@ -36,8 +36,7 @@ import daieditor.arch.anim.AnimationObjects; import daieditor.arch.face.FaceObject; import daieditor.map.MapSquare; -import java.lang.ref.SoftReference; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JList; @@ -57,18 +56,12 @@ */ public final class ArchObject /*extends NamedObject*/ extends ArchObjectContainer implements Cloneable, net.sf.gridarta.arch.ArchObject { - /** Reference to main control. */ - private static CMainControl mainControl; - /** Special constant that's used if an arch has no arch type set. */ public static final int TYPE_UNSET = -666; /** Static reference to the typeList (find syntax errors). */ private static CFArchTypeList typeList; - /** Collection with all ArchObjects. */ - private static List<SoftReference<ArchObject>> allObjects = new ArrayList<SoftReference<ArchObject>>(); - /** Face name, can be from animation or face. */ private String faceObjName; @@ -81,7 +74,7 @@ /** Arch name. */ private String archName; - /** TODO. */ + /** The name of this object. */ private String objName; /** Object animation <code>animation <var>animName</var></code>. */ @@ -162,7 +155,6 @@ /** The transparent face. */ private ImageIcon transFace; - private static final List<ArchObject> emptyList = new ArrayList<ArchObject>(); /** Create an ArchObject. */ public ArchObject() { @@ -170,22 +162,12 @@ faceobjdesc = FaceDesc.FACE_NOT_FOUND; archType = TYPE_UNSET; // type must be set script = new ScriptArchData(this); - allObjects.add(new SoftReference<ArchObject>(this)); } - /** Clear the faces of all ArchObjects. */ - public static void clear() { - // TODO - } - public static void setTypeList(final CFArchTypeList tlist) { typeList = tlist; } - public static void setMControl(final CMainControl mainControl) { - ArchObject.mainControl = mainControl; - } - /** * Returns edit Type. * @return edit Type @@ -254,6 +236,7 @@ * @todo use arch object matchers, eventually deprecated this method and remove it */ public int calculateEditType(final int checkType) { + // ATTENTION! BE VERY CAREFUL WHEN YOU TRY TO UNIFY MORE OF THIS WITH CROSSFIRE! /* if one of the types in checkType already is in editType, // we exclude that one if ((checkType & editType) != 0) { @@ -322,26 +305,54 @@ } /** - * Get the value of an arch attribute from the archText both of the arch + * Get the String of an arch attribute from the archText both of the arch * itself and if n.e. in it's default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. + * in either one, an empty String "" is returned. * @param attr search for "attr <value>" * @param defarch default arch of this arch, or <code>null</code> if this * arch is a default arch or the default arch should be ignored - * @return <value>, zero if not found + * @return <string>, "" if not found */ - public int getAttributeInt(final String attr, final ArchObject defarch) { + public String getAttributeString(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { String aText = archText.toString(); // The "real" Archtext from arch & defarch // Add all attributes from defarch that don't already exist in aText if (defarch != null) { aText += diffArchText(defarch.getArchText(), true); } + final String attr2 = attr.trim() + ' '; // attr must be followed by space + String result = ""; // returned String + for (final String line : aText.split("\\s*\n")) { + if (line.startsWith(attr2)) { + result = line.substring(attr2.length()); + } + } + return result; + } + + /** {@inheritDoc} */ + public String getAttributeString(final String attr, final boolean useDefArch) { + return getAttributeString(attr, useDefArch ? defaultArch : null); + } + + /** {@inheritDoc} */ + public String getAttributeString(final String attr) { + return getAttributeString(attr, true); + } + + /** {@inheritDoc} */ + public int getAttributeInt(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { + String aText = archText.toString(); // The "real" Archtext from arch & defarch + // Add all attributes from defarch that don't already exist in aText + if (defarch != null) { + aText += diffArchText(defarch.getArchText(), true); + } + assert aText.endsWith("\n"); final String attr2 = attr.trim() + ' '; - int result = 0; // returned value + int result = 0; for (final String line : aText.split("\\s*\n")) { if (line.startsWith(attr2)) { try { - result = Integer.parseInt(line.substring(attr2.length())); + result = Integer.parseInt(line.substring(attr2.length()).trim()); } catch (final NumberFormatException e) { result = 0; } @@ -350,29 +361,13 @@ return result; } - /** - * Get the value of an arch attribute from the archText both of the arch - * itself and if n.e. in it's default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. - * @param attr search for "attr <value>" - * @param useDefArch <code>true</code> if the default arch of this - * ArchObject should be queried as well, <code>false</code> to ignore it - * @return <value>, zero if not found - */ + /** {@inheritDoc} */ public int getAttributeInt(final String attr, final boolean useDefArch) { return getAttributeInt(attr, useDefArch ? defaultArch : null); } - /** - * Get the value of an arch attribute from the archText both of the arch - * itself and eventually its default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. - * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this - * arch is a default arch or the default arch should be ignored - * @return <value>, zero if not found - */ - public long getAttributeLong(final String attr, final ArchObject defarch) { + /** {@inheritDoc} */ + public long getAttributeLong(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { String aText = archText.toString(); // Add all attributes from defarch that don't already exist in aText if (defarch != null) { @@ -392,15 +387,7 @@ return result; } - /** - * Get the value of an arch attribute from the archText both of the arch - * itself and eventually its default arch. If the attribute doesn't exist - * in either one, or the value is not a number, zero is returned. - * @param attr search for "attr <value>" - * @param useDefArch <code>true</code> if the default arch of this - * ArchObject should be queried as well, <code>false</code> to ignore it - * @return <value>, zero if not found - */ + /** {@inheritDoc} */ public long getAttributeLong(final String attr, final boolean useDefArch) { return getAttributeLong(attr, useDefArch ? defaultArch : null); } @@ -414,7 +401,7 @@ * arch is a default arch or the default arch should be ignored * @return <value>, zero if not found */ - public double getAttributeDouble(final String attr, final ArchObject defarch) { + public double getAttributeDouble(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { String aText = archText.toString(); // Add all attributes from defarch that don't already exist in aText if (defarch != null) { @@ -448,47 +435,11 @@ } /** - * Get the String of an arch attribute from the archText both of the arch - * itself and if n.e. in it's default arch. If the attribute doesn't exist - * in either one, an empty String "" is returned. - * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this - * arch is a default arch or the default arch should be ignored - * @return <string>, "" if not found - */ - public String getAttributeString(final String attr, final ArchObject defarch) { - String aText = archText.toString(); // The "real" Archtext from arch & defarch - // Add all attributes from defarch that don't already exist in aText - if (defarch != null) { - aText += diffArchText(defarch.getArchText(), true); - } - final String attr2 = attr.trim() + ' '; // attr must be followed by space - String result = ""; // returned String - for (final String line : aText.split("\\s*\n")) { - if (line.startsWith(attr2)) { - result = line.substring(attr2.length()); - } - } - return result; - } - - /** {@inheritDoc} */ - public String getAttributeString(final String attr, final boolean useDefArch) { - return getAttributeString(attr, useDefArch ? defaultArch : null); - } - - /** {@inheritDoc} */ - public String getAttributeString(final String attr) { - return getAttributeString(attr, true); - } - - /** * Sets edit Type. - * - * @param t edit Type. + * @param editType edit Type. */ - public void setEditType(final int t) { - editType = t; + public void setEditType(final int editType) { + this.editType = editType; } public void setContainer(final ArchObjectContainer container) { @@ -601,15 +552,12 @@ add(this, node, next); } - /** - * browse through the inventory tree and count all elements - * @return number of objects in the inventory - */ + /** {@inheritDoc} */ public int countInvObjects() { int count = 0; - for (ArchObject arch : this) { - count++; // we have one in... to through his chain - count += arch.countInvObjects(); // count his inventory + for (final ArchObject arch : this) { + count++; + count += arch.countInvObjects(); } return count; } @@ -813,7 +761,7 @@ } public List<ArchObject> getTailList() { - return multi != null ? multi.getTailList() : emptyList; + return multi != null ? multi.getTailList() : Collections.EMPTY_LIST; } public void setTailList(final List<ArchObject> tails) { @@ -961,11 +909,18 @@ return "???"; // this case should actually never happen } - // Obj name + /** + * Sets the name of this object. + * @param objName the name of this object. + */ public void setObjName(final String objName) { this.objName = objName != null ? objName.intern() : null; } + /** + * Returns the name of this object. + * @return the name of this object. + */ public String getObjName() { return objName; } @@ -974,7 +929,7 @@ private void setFaceObjName(final String faceObjName) { if (faceObjName != null) { this.faceObjName = faceObjName.intern(); - faceObject = mainControl.getFaceObjects().get(this.faceObjName); + faceObject = CMainControl.getInstance().getFaceObjects().get(this.faceObjName); } else { this.faceObjName = null; faceObject = null; @@ -1012,19 +967,11 @@ this.archText.append(archText); } - /** - * Returns the arch text of this arch as String. - * @return the arch text - */ + /** {@inheritDoc} */ public String getArchText() { return archText.toString(); } - /** Clears the arch text of this arch. */ - public void resetArchText() { - archText.delete(0, archText.length()); - } - /** * Set The "face >name>" field of a object. We need this for fast * access. We set here the string name, the face number and we will handle @@ -1069,7 +1016,7 @@ String effectiveFaceObjName; if (effectiveAnimName != null) { // we have a animation - get the frame picture - final AnimationObjects animationObjects = mainControl.getAnimationObjects(); + final AnimationObjects animationObjects = CMainControl.getInstance().getAnimationObjects(); final AnimationObject animationObject = animationObjects.get(effectiveAnimName); if (animationObject != null) { noface = false; @@ -1154,6 +1101,11 @@ return null; } + /** Clears the arch text of this arch. */ + public void resetArchText() { + archText.delete(0, archText.length()); + } + /** * Get all entries from the given archtext 'atxt' that don't exist in * 'this' archtext. Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-07-03 20:36:22 UTC (rev 231) @@ -457,7 +457,7 @@ */ private void loadAnimsFromFiles() { final AnimationObjects anims = mainControl.getAnimationObjects(); - for (File animFile : animFiles) { + for (final File animFile : animFiles) { try { anims.loadAnims(animFile); } catch (final DuplicateAnimationException e) { @@ -475,22 +475,21 @@ /** Loading all animations from the big collected animations file. */ private void loadAllDaimoninAnimationsFromCollect() { - Reader in = null; try { - in = new CFileReader(mainControl.getArchDefaultFolder(), "animations"); - mainControl.getAnimationObjects().loadAnims(in, null); + final Reader in = new CFileReader(mainControl.getArchDefaultFolder(), "animations"); + try { + mainControl.getAnimationObjects().loadAnims(in, null); + } finally { + in.close(); + } + } catch (final FileNotFoundException e) { + mainControl.handleThrowable(e); } catch (final DuplicateAnimationException e) { mainControl.handleThrowable(e); } catch (final IOException e) { mainControl.handleThrowable(e); } catch (final AnimationParseException e) { mainControl.handleThrowable(new AnimationParseException(e, new File("animations"))); - } finally { - try { - in.close(); - } catch (final Exception e) { /* ignore */ } finally { - in = null; - } } } Modified: trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-07-03 20:36:22 UTC (rev 231) @@ -102,17 +102,12 @@ * @throws DuplicateAnimationException in case an animation was not unique */ public void loadAnims(final File animFile) throws FileNotFoundException, IOException, AnimationParseException, DuplicateAnimationException { - Reader in = null; + final Reader in = new InputStreamReader(new FileInputStream(animFile), MAP_ENCODING); try { - in = new InputStreamReader(new FileInputStream(animFile), MAP_ENCODING); final String path = (new File(PathManager.getArchPath(animFile.getPath()))).getParent().replace('\\', '/'); loadAnims(in, path); } finally { - try { - in.close(); - } catch (final Exception e) { /* ignore */ } finally { - in = null; - } + in.close(); } } @@ -185,16 +180,11 @@ * @throws FileNotFoundException in case the file couldn't be opened */ public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { - Reader in = null; + final Reader in = new InputStreamReader(new FileInputStream(animTreeFile), MAP_ENCODING); try { - in = new InputStreamReader(new FileInputStream(animTreeFile), MAP_ENCODING); loadAnimTree(in); } finally { - try { - in.close(); - } catch (final Exception e) { /* ignore */ } finally { - in = null; - } + in.close(); } } Modified: trunk/src/app/net/sf/gridarta/arch/ArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-07-02 22:09:54 UTC (rev 230) +++ trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-07-03 20:36:22 UTC (rev 231) @@ -8,6 +8,30 @@ public interface ArchObject { /** + * Count the number of all inventory items (recursively). + * The returned value does not include this ArchObject. + * @return number of objects in the inventory (recursively) + */ + int countInvObjects(); + + /** + * Returns the arch text of this arch as String. + * @return the arch text + */ + String getArchText(); + + /** + * Get the String of an arch attribute from the archText both of the arch + * itself and if n.e. in it's default arch. If the attribute doesn't exist + * in either one, an empty String "" is returned. + * @param attr search for "attr <value>" + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored + * @return <string>, "" if not found + */ + String getAttributeString(String attr, ArchObject defarch); + + /** * Get the value of an attribute of this ArchObject. * @param attr attribute name to get value for * @param useDefArch <code>true</code> if the default arch of this ArchObject should be queried as well, <code>false</code> to ignore it @@ -26,4 +50,70 @@ */ String getAttributeString(String attr); + /** + * Get the value of an arch attribute from the archText both of the arch + * itself and if n.e. in it's default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. + * @param attr search for <code>attr <var>value</var></code> + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored + * @return <code><var>value</var></code>, zero if not found + */ + int getAttributeInt(String attr, ArchObject defarch); + + /** + * Get the value of an arch attribute from the archText both of the arch + * itself and if n.e. in it's default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. + * @param attr search for "attr <value>" + * @param useDefArch <code>true</code> if the default arch of this + * ArchObject should be queried as well, <code>false</code> to ignore it + * @return <value>, zero if not found + */ + int getAttributeInt(String attr, boolean useDefArch); + + /** + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. + * @param attr search for "attr <value>" + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored + * @return <value>, zero if not found + */ + long getAttributeLong(String attr, ArchObject defarch); + + /** + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. + * @param attr search for "attr <value>" + * @param useDefArch <code>true</code> if the default arch of this + * ArchObject should be queried as well, <code>false</code> to ignore it + * @return <value>, zero if not found + */ + long getAttributeLong(String attr, boolean useDefArch); + + /** + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. + * @param attr search for "attr <value>" + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored + * @return <value>, zero if not found + */ + double getAttributeDouble(String attr, ArchObject defarch); + + /** + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. + * @param attr search for "attr <value>" + * @param useDefArch <code>true</code> if the default arch of this + * ArchObject should be queried as well, <code>false</code> to ignore it + * @return <value>, zero if not found + */ + double getAttributeDouble(String attr, boolean useDefArch); + } // interface ArchObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-07-02 22:10:13
|
Revision: 230 Author: akirschbaum Date: 2006-07-02 15:09:54 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=230&view=rev Log Message: ----------- Unify code: replace ArchObject's 'temp' pointers with collections. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CPickmapPanel.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-07-02 22:09:54 UTC (rev 230) @@ -38,7 +38,10 @@ import java.awt.Toolkit; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; import java.util.Vector; import javax.swing.ImageIcon; import javax.swing.JComponent; @@ -710,21 +713,21 @@ /** * Begins the editing of a new Map. - * @param start first object in the list of map objects. - * 'start' is null for new, empty maps + * @param objects the list of map objects, or <code>null</code> for new empty + * maps * @param maparch map arch * @param initial the view position to show initially; null=show top * left corner * @return map control of new map */ - public MapControl newLevel(final ArchObject start, final MapArchObject maparch, final Point initial) { - return newLevel(start, maparch, true, initial); + public MapControl newLevel(final List<ArchObject> objects, final MapArchObject maparch, final Point initial) { + return newLevel(objects, maparch, true, initial); } /** * Begins the editing of a new Map. - * @param start first object in the list of map objects. - * 'start' is null for new, empty maps + * @param objects the list of map objects, or <code>null</code> for new empty + * maps * @param maparch map arch * @param show if true, map is added to main view. * Set to false to load silently @@ -732,11 +735,11 @@ * left corner * @return map control of new map */ - public MapControl newLevel(final ArchObject start, final MapArchObject maparch, final boolean show, final Point initial) { + public MapControl newLevel(final List<ArchObject> objects, final MapArchObject maparch, final boolean show, final Point initial) { // Create a new level control and set the level view from that CMainStatusbar.getInstance().setText(" Creating new map " + maparch.getMapName()); - final MapControl map = new MapControl(this, start, maparch, false, initial); + final MapControl map = new MapControl(this, objects, maparch, false, initial); if (show) { mainView.addLevelView(map.getMapView()); // one view... map.getMapView().setAutoscrolls(true); @@ -960,10 +963,10 @@ * @return the map controller to manipulate this map */ @Nullable public MapControl openFile(final File file, final boolean show, final Point initial) { - final ArchObject start; + final List<ArchObject> objects; final MapArchObject maparch; try { - start = mapFileDecoder.decodeMapFile(file); // parse mapfile + objects = mapFileDecoder.decodeMapFile(file); // parse mapfile maparch = mapFileDecoder.getMapArch(); // get map arch } catch (GridderException e) { // popup display @@ -980,18 +983,17 @@ // ok, we have it all!! final MapControl control; - if (start == null) { + if (objects == null) { // The map is totally empty - control = newLevel(start, maparch, show, initial); // init the map + control = newLevel(objects, maparch, show, initial); // init the map } else { // go to ArchObjectParser and add the default arch list information to them - if (!collectTempList(start, file)) { // get face names, face id, etc. + if (!collectTempList(objects, file)) { // get face names, face id, etc. return null; } - final ArchObject sortedStart = sortTempList(start); // sort the list (put multiparts at the end) - control = newLevel(sortedStart, maparch, show, initial); // init the map - deleteTempList(sortedStart); // remove temp list connection + final List<ArchObject> sortedObjects = ArchObjectParser.sortTempList(objects); // sort the list (put multiparts at the end) + control = newLevel(sortedObjects, maparch, show, initial); // init the map } if (show) { @@ -1031,15 +1033,15 @@ * browse first through the default arch list and attach map arches to it * then browse through the face list and try to find the pictures */ - boolean collectTempList(ArchObject arch, final File f) { - ArchObject previous = null; // previous arch in loop - + boolean collectTempList(final List<ArchObject> objects, final File file) { + final List<ArchObject> tailList = new ArrayList<ArchObject>(); // first: attach our map sucker to a default arch we have loaded - for (; arch != null;) { + for (final Iterator<ArchObject> it = objects.iterator(); it.hasNext();) { + final ArchObject arch = it.next(); final int index1 = ArchObjectStack.getArchIndex(arch.getArchName()); if (index1 == -1) { // we had an unknown arch here!! - // showMessage("Error Loading Map File "+f.getName(), "\n Found Unknown Arch < "+arch.getArchName()+" >"); + // showMessage("Error Loading Map File "+file.getName(), "\n Found Unknown Arch < "+arch.getArchName()+" >"); // return false; } else { arch.setNodeNr(index1); // our default arch! @@ -1061,47 +1063,16 @@ // (We calculate only edit types that are active, to save time) archObjectParser.postParseMapArch(arch, tileEdit); - // if the arch is a multipart head, we must attach the tail - archObjectParser.expandMulti(arch); + archObjectParser.expandMulti(arch, tailList); + } - // if there's a tail without head, we cut it out - if (arch.isReferenced() && arch.getMapMultiHead() == null - && previous != null) { - log.warn("Found multi-tail without head: '" + arch.getArchName() + "'"); - previous.setTemp(arch.getTemp()); - arch = previous; - } - - // ahhh ... finished... next sucker - previous = arch; // save previous - arch = arch.getTemp(); // next sucker + for (final ArchObject tail : tailList) { + objects.add(tail); } return true; } - /** - * Sorting the temp list - * @param start head-element of temp list before sorting - * @return new head-element of temp list after sorting - */ - public ArchObject sortTempList(final ArchObject start) { - return archObjectParser.sortTempList(start); - } - - /** - * Remove the tmp. pointer connection after map inserting. - * The ArchObjects themselves remain. - * @param arch first arch on the map(/list) - */ - void deleteTempList(ArchObject arch) { - for (; arch != null;) { - final ArchObject temp = arch; - arch = arch.getTemp(); - temp.setTemp(null); - } - } - /** Invoked when user wants to save the current level. */ public void saveCurrentLevelWanted() { if (currentMap == null) { Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-07-02 22:09:54 UTC (rev 230) @@ -30,6 +30,8 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import net.sf.gridarta.GridderException; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -46,15 +48,9 @@ private int maxxlen, maxylen; - /** points to the very first arch of the map */ - private ArchObject start; + /** ArchObjects that are read from the map. */ + private List<ArchObject> objects; - /** always pointing to the previously read arch */ - private ArchObject previous; - - /* first arch for multis (last arch not being "more") */ - //private ArchObject firstArch; - /** Contains the map arch (see MapArchObject class). */ private MapArchObject maparch; @@ -72,15 +68,14 @@ * @return first <code>ArchObject</code> in the list * @throws GridderException when file content invalid */ - public ArchObject decodeMapFile(final File file) throws GridderException { + public List<ArchObject> decodeMapFile(final File file) throws GridderException { try { final FileReader fr = new FileReader(file); final BufferedReader myInput = new BufferedReader(fr); maxxlen = maxylen = 0; - start = previous = null; - //firstArch = null; + objects = new ArrayList<ArchObject>(); // first of all we read the map arch (if that fails we throw an exception) maparch = new MapArchObject(); @@ -100,14 +95,6 @@ } catch (final IOException e) { log.debug("Error Loading file " + file.getName(), e); - for (ArchObject tarch = start, temparch; tarch != null;) { - temparch = tarch; - temparch.setTemp(null); - temparch.setMapMultiHead(null); - temparch.setMapMultiNext(null); - tarch = tarch.getTemp(); - } - throw new GridderException("The file '" + file.getName() + "' cannot be loaded: " + e.getMessage()); } @@ -116,7 +103,7 @@ // the maparch, we set the true size: the maxxlen/maxylen counters. maparch.ensureMapSize(maxxlen + 1, maxylen + 1); - return start; // return first arch of the list + return objects; // return first arch of the list } @@ -212,14 +199,7 @@ log.debug("GO INVENTORY2: " + arch + " - " + thisLine); } } else if (thisLine.startsWith("end")) { - // chain this to temp list - if (start == null) { - start = arch; // if start null, this is the first arch - } - if (previous != null) { - previous.setTemp(arch); - } - previous = arch; + objects.add(arch); archflag = false; archmore = false; Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-07-02 22:09:54 UTC (rev 230) @@ -25,12 +25,14 @@ package cfeditor; import cfeditor.arch.ArchObject; +import cfeditor.arch.ArchObjectParser; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import java.io.File; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import javax.swing.JOptionPane; import javax.swing.JTabbedPane; @@ -133,20 +135,19 @@ final MapArchObject maparch; try { - final ArchObject start1 = mainControl.getMapFileDecoder().decodeMapFile(mapFile); // parse mapfile + final List<ArchObject> objects = mainControl.getMapFileDecoder().decodeMapFile(mapFile); // parse mapfile maparch = mainControl.getMapFileDecoder().getMapArch(); // get map arch - if (start1 == null) { + if (objects == null) { // The map is totally empty bmapview = newPickmap(null, maparch, mapFile); // init the map } else { // go to ArchObjectParser and add the default arch list information to them - if (!mainControl.collectTempList(start1, mapFile)) { // get face names, face id, etc. + if (!mainControl.collectTempList(objects, mapFile)) { // get face names, face id, etc. return false; } - final ArchObject start2 = mainControl.sortTempList(start1); // sort the list (put multiparts at the end) - bmapview = newPickmap(start2, maparch, mapFile); // init the map - mainControl.deleteTempList(start2); // remove temp list connection + final List<ArchObject> sortedObjects = ArchObjectParser.sortTempList(objects); // sort the list (put multiparts at the end) + bmapview = newPickmap(sortedObjects, maparch, mapFile); // init the map } // looks like it worked, so we add a panel and display this pickmap @@ -202,12 +203,12 @@ /** * Add a new pickmap. - * @param start first ArchObject of the pickmap + * @param objects list of objects or <code>null</code> for empty * @param maparch the maparch of the pickmap * @return basic mapview */ - @Nullable private CMapViewBasic newPickmap(final ArchObject start, final MapArchObject maparch, final File mapFile) { - final MapControl map = new MapControl(mainControl, start, maparch, true, null); + @Nullable private CMapViewBasic newPickmap(final List<ArchObject> objects, final MapArchObject maparch, final File mapFile) { + final MapControl map = new MapControl(mainControl, objects, maparch, true, null); map.getMapView().setAutoscrolls(true); map.setMapFile(mapFile); Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-07-02 22:09:54 UTC (rev 230) @@ -82,7 +82,7 @@ mapArch.setFileName("cb"); mapArch.setMapName("cb"); - mapData = new DefaultMapModel(this.mainControl, buffCtrl, mapArch); + mapData = new DefaultMapModel(this.mainControl, buffCtrl, null, mapArch); } /** @@ -156,7 +156,7 @@ mapArch.setMapSize(new Size2D(bufWidth, bufHeight)); mapData = null; // free objects (at least that is the plan and theory) buffCtrl = null; - mapData = new DefaultMapModel(mainControl, buffCtrl, mapArch); // new MapModel + mapData = new DefaultMapModel(mainControl, buffCtrl, null, mapArch); // new MapModel buffCtrl = new MapControl(mainControl, null, mapArch, false, null); // new MapControl } Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-02 22:09:54 UTC (rev 230) @@ -136,8 +136,6 @@ private ArchObject prev; // same - private ArchObject tempptr; // we need this for chain the arches - /** * Enclosing container; if null, this object is not in a container but in a * map. @@ -152,8 +150,6 @@ private int archType; // CF object type of the arch - private int internTemp; // used for drawing - /** Edit Type. */ private int editType; // for view settings @@ -174,7 +170,6 @@ archTextCount = 0; // lines inserted in archText objName = null; - internTemp = 0; noface = true; // this sucker has no face artifactsFlag = false; // will be true for arches from the artifacts file @@ -189,7 +184,6 @@ nodenr = -1; // as default we are not in a node list next = null; prev = null; - tempptr = null; mapx = 0; mapy = 0; editType = 0; @@ -516,14 +510,6 @@ editType = t; } - public int getInternTemp() { - return internTemp; - } - - public void setInternTemp(final int t) { - internTemp = t; - } - public int getMyID() { return myId; } @@ -899,14 +885,6 @@ prev = arch; } - public ArchObject getTemp() { - return tempptr; - } - - public void setTemp(final ArchObject temp) { - tempptr = temp; - } - /** * Get Next link. * @return next link Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-07-02 22:09:54 UTC (rev 230) @@ -33,6 +33,8 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -608,7 +610,7 @@ * The ArchObjectStack should be fully initialized at this point. * @param arch multipart head that needs tail attached */ - public void expandMulti(final ArchObject arch) { + public void expandMulti(final ArchObject arch, final List<ArchObject> objects) { final ArchObject defarch = mainControl.getArch(arch.getNodeNr()); // default arch // is it a multi head? @@ -619,7 +621,6 @@ final int count = defarch.getMultiRefCount(); // how many parts have we got ArchObject newarch = null; // newly inserted arch ArchObject oldarch = arch; // previous arch - final ArchObject tmpNext = arch.getTemp(); // next arch on tmp list after multi // do insertion for all non-head parts of the multi for (int c = 1; c <= count; c++) { @@ -628,7 +629,7 @@ assert newarch != null; newarch.setMapMultiHead(arch); // set link to multi head oldarch.setMapMultiNext(newarch); // set link between multi arches - oldarch.setTemp(newarch); // attach to temp list + objects.add(newarch); // set map position (x, y) newarch.setMapX(arch.getMapX() + mainControl.getArchObjectStack().getArch(defarch.getNodeNr() + c).getMultiRefX()); @@ -640,7 +641,6 @@ // (don't need edit type as we copy from head) mainControl.getArchObjectParser().postParseMapArch(newarch, 0); } - newarch.setTemp(tmpNext); // re-attach the the last multi to the tmp list } } @@ -653,83 +653,16 @@ * @return the sorting might eventually change the starting * arch. Therefore, the new start arch is returned. */ - public ArchObject sortTempList(ArchObject start) { - ArchObject lastBefore = null; // the last arch on the list (before sorting) - ArchObject last = null; // the very last arch on the list - boolean foundMulti = false; // true when multi found (see below) - boolean orderWrong = false; // is the order correct or not? - - // First we cycle through the whole list and check if the - // order is already correct or not (only Crossedit saves in wrong order). - // This takes practically no time and assures we don't waste any. - for (ArchObject tmp = start; tmp != null; tmp = tmp.getTemp()) { - if (!foundMulti && tmp.isMulti()) { - foundMulti = true; // first multi appeared - } else if (foundMulti && !tmp.isMulti() && - (tmp.getContainer() == null || !tmp.getTopContainer().isMulti())) { - orderWrong = true; // order is wrong (found non-multi after multi) + public static List<ArchObject> sortTempList(final List<ArchObject> objects) { + final Comparator<ArchObject> sorter = new Comparator<ArchObject>() { + public int compare(final ArchObject o1, final ArchObject o2) { + final boolean b1 = o1.isMulti(); + final boolean b2 = o2.isMulti(); + return b1 == b2 ? 0 : b2 ? -1 : 1; } - - if (tmp.getTemp() == null) { - lastBefore = last = tmp; - } - } - - // if the last arch is a multi, it must be the head, not the tail - if (lastBefore.isReferenced() && lastBefore.getMapMultiHead() != null) { - lastBefore = lastBefore.getMapMultiHead(); - } - - if (orderWrong) { - // The order is wrong, so we gotta correct it now - - if (LOG.isInfoEnabled()) { - LOG.info("Resorted multipart arches."); - } - - ArchObject previous = null; - boolean increment = true; - for (ArchObject tmp = start; tmp != null && tmp != lastBefore;) { - if (tmp.getMultiRefCount() > 0 && tmp.getMapMultiNext() != null) { - // Got a multi head - Now we move his ass to the end of the list: - last.setTemp(tmp); // attach the head to the end - for (; tmp.getMapMultiNext() != null; tmp = tmp.getMapMultiNext()) { - ; - } - - // close the list: linking previous to the arch after the multi - if (previous == null || tmp.getMapMultiHead() == start) { - // very special case: the start arch is a multi - previous = tmp.getTemp(); // continue after this first multi - start = tmp.getTemp(); // start arch is now this one - increment = false; - } else { - previous.setTemp(tmp.getTemp()); - } - - tmp.setTemp(null); // terminate tail - last = tmp; // last arch is now this one - tmp = previous; // we continue our search after previous - } - - previous = tmp; // next loop tmp is previous - - if (increment) { - tmp = tmp.getTemp(); // jump to next node - } else { - increment = true; - } - - // make sure we don't ever get into an infinite loop - if (tmp != null && tmp.getTemp() == tmp) { - LOG.warn("sortTempList: Arch '" + tmp.getArchName() + "' pointing on itself!"); - tmp = null; // exit the loop - } - } - } - - // return the new starting arch - return start; + }; + Collections.sort(objects, sorter); + return objects; } /** Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-07-02 22:09:54 UTC (rev 230) @@ -37,6 +37,7 @@ import cfeditor.filter.NamedFilterList; import java.awt.Point; import java.util.Iterator; +import java.util.List; import net.sf.gridarta.Size2D; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -75,15 +76,18 @@ * Constructs a level model. * @param mainControl main controller * @param control the controller of this view + * @param objects the <code>ArchObject</code> list of this map or + * <code>null</code> for an empty map * @param mapArch the map header (<code>MapArchObject</code>) */ - public DefaultMapModel(final CMainControl mainControl, final MapControl control, final MapArchObject mapArch) { + public DefaultMapModel(final CMainControl mainControl, final MapControl control, final List<ArchObject> objects, final MapArchObject mapArch) { this.mapArch = mapArch; this.mainControl = mainControl; mapControl = control; mapSize = mapArch.getMapSize(); mapGrid = initMap(); + addArchListToMap(objects); // init mapArchObject and (when not new map) the arch list } /** @@ -122,13 +126,14 @@ * Place a list of arches onto the map. * @param arch the head of the arches list; may be null to insert nothing */ - public void addArchListToMap(ArchObject arch) { - while (arch != null) { + private void addArchListToMap(final List<ArchObject> objects) { + if (objects == null) { + return; + } + for (final ArchObject arch : objects) { if (arch.getContainer() == null) { // only map arches.... addArchObjectToMap(arch, false); } - - arch = arch.getTemp(); } } @@ -857,7 +862,6 @@ final ArchObject temp = node.getMapMultiNext(); // we save our next part (or null=finished) node.setMapMultiHead(null); node.setMapMultiNext(null); - node.setTemp(null); // just in case... node = null; // i have no idea how good the garbage collection node = temp; // is, so i do here some VERY safe stuff } Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-07-02 22:09:54 UTC (rev 230) @@ -36,6 +36,7 @@ import java.awt.Point; import java.io.File; import java.util.Iterator; +import java.util.List; import net.sf.gridarta.GridderException; import net.sf.gridarta.Size2D; @@ -99,18 +100,17 @@ * Constructs a new Map. * @param mainControl the CMainControl * @param maparch the <code>MapArchObject</code> of the map - * @param startObj chained list of Objects (ArchObjects) which should be - * filled in map + * @param objects list of Objects (ArchObjects) which should be filled + * in map or <code>null</code> for empty * @param isPickmap true if this is a pickmap * @param initial the view position to show initially */ - public MapControl(final CMainControl mainControl, final ArchObject startObj, final MapArchObject maparch, final boolean isPickmap, final Point initial) { + public MapControl(final CMainControl mainControl, final List<ArchObject> objects, final MapArchObject maparch, final boolean isPickmap, final Point initial) { this.mainControl = mainControl; activeEditType = 0; // start with no edit types (saves time) this.isPickmap = isPickmap; // is this a pickmap? // we create model (= data) - mapModel = new DefaultMapModel(mainControl, this, maparch); - mapModel.addArchListToMap(startObj); + mapModel = new DefaultMapModel(mainControl, this, objects, maparch); // and create a view (= window) mapView = new CMapViewIFrame(mainControl, this, initial); } Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-07-02 22:09:54 UTC (rev 230) @@ -4,6 +4,7 @@ import cfeditor.arch.ArchObjectIterator; import cfeditor.arch.ArchObjectIteratorDeleteMapArch; import java.awt.Point; +import java.util.List; import net.sf.gridarta.Size2D; import org.jetbrains.annotations.Nullable; @@ -75,8 +76,6 @@ MapArchObject getMapArchObject(); - void addArchListToMap(ArchObject arch); - void appExitNotify(); String getMapText(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-07-02 22:09:54 UTC (rev 230) @@ -1219,7 +1219,7 @@ logger.log(Level.WARNING, "canonIOE", e); } - List<ArchObject> objects; + final List<ArchObject> objects; final MapArchObject maparch; try { @@ -1250,8 +1250,8 @@ if (!collectTempList(objects, file)) { // get face names, face id, etc. return false; // What's this return here? } - objects = ArchObjectParser.sortTempList(objects); // sort the list (put multiparts at the end) - lastOpenedMap = newLevel(objects, maparch, view); // init the map + final List<ArchObject> sortedObjects = ArchObjectParser.sortTempList(objects); // sort the list (put multiparts at the end) + lastOpenedMap = newLevel(sortedObjects, maparch, view); // init the map } // finally, show the map and refresh toolbars @@ -1324,7 +1324,7 @@ archObjectParser.expandMulti(arch, tailList); } - for (ArchObject tail : tailList) { + for (final ArchObject tail : tailList) { objects.add(tail); } if (noarchcount > 0) { Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-07-02 18:57:56 UTC (rev 229) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-07-02 22:09:54 UTC (rev 230) @@ -142,7 +142,7 @@ try { // FIXME: This is somewhat dangerous regarding multithreading final CMapFileDecode decoder = mainControl.getMapFileDecode(); - List<ArchObject> objects = decoder.decodeMapFile(mapFile, mainControl.getMapDir().getAbsolutePath()); + final List<ArchObject> objects = decoder.decodeMapFile(mapFile, mainControl.getMapDir().getAbsolutePath()); final MapArchObject maparch = decoder.getMapArch(); final CMapViewBasic bmapview; @@ -154,8 +154,8 @@ if (!mainControl.collectTempList(objects, mapFile)) { // get face names, face id, etc. return false; } - objects = ArchObjectParser.sortTempList(objects); // sort the list (put multiparts at the end) - bmapview = newPickmap(objects, maparch, mapFile, index); // init the map + final List<ArchObject> sortedObjects = ArchObjectParser.sortTempList(objects); // sort the list (put multiparts at the end) + bmapview = newPickmap(sortedObjects, maparch, mapFile, index); // init the map } // looks like it worked, so we add a panel and display this pickmap This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-07-02 18:58:11
|
Revision: 229 Author: akirschbaum Date: 2006-07-02 11:57:56 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=229&view=rev Log Message: ----------- Unify ArchObjectIterator implementation; unify method names in ArchObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectIterator.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-07-02 18:57:56 UTC (rev 229) @@ -315,7 +315,7 @@ @Nullable private ArchObject findArchOfJoinlist(final MapModel map, final int x, final int y) { ArchObject tmpArch = map.getTopArchObject(x, y); // we look through the arches at the given location (top to bottom): - for (; tmpArch != null; tmpArch = tmpArch.getPrevArch()) { + for (; tmpArch != null; tmpArch = tmpArch.getPrev()) { if (stack.getArch(tmpArch.getNodeNr()).getJoinList() == this) { return tmpArch; // we found an arch } Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-07-02 18:57:56 UTC (rev 229) @@ -317,13 +317,13 @@ ArchObject node = map.getMapModel().getMouseRightPosObject(); // Jump to the end of the list - for (; node != null && node.getNextArch() != null; node = node.getNextArch()) { + for (; node != null && node.getNext() != null; node = node.getNext()) { ; } // Now go through the list backwards and put all arches // on the panel in this order - for (; node != null; node = node.getPrevArch()) { + for (; node != null; node = node.getPrev()) { // add the node if (node.getMyID() == archid) { postSelect = listCounter; Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-07-02 18:57:56 UTC (rev 229) @@ -1628,13 +1628,13 @@ ArchObject tmpArch = mapControl.getBottomArchObject(mapLoc); if (tmpArch != null) { // go to the topmost arch (end of the list) - for (; tmpArch.getNextArch() != null; tmpArch = tmpArch.getNextArch()) { + for (; tmpArch.getNext() != null; tmpArch = tmpArch.getNext()) { ; } // now search backwards for matching view settings for (; tmpArch != null && mainControl.getTileEdit() != 0 && - !mainControl.isTileEdit(tmpArch.getEditType()); tmpArch = tmpArch.getPrevArch()) { + !mainControl.isTileEdit(tmpArch.getEditType()); tmpArch = tmpArch.getPrev()) { ; } if (tmpArch != null) { @@ -1789,13 +1789,13 @@ ArchObject tmpArch = mapControl.getBottomArchObject(temp); if (tmpArch != null) { // go to the topmost arch (end of the list) - for (; tmpArch.getNextArch() != null; tmpArch = tmpArch.getNextArch()) { + for (; tmpArch.getNext() != null; tmpArch = tmpArch.getNext()) { ; } // now search backwards for matching view settings for (; tmpArch != null && mainControl.getTileEdit() != 0 && - !mainControl.isTileEdit(tmpArch.getEditType()); tmpArch = tmpArch.getPrevArch()) { + !mainControl.isTileEdit(tmpArch.getEditType()); tmpArch = tmpArch.getPrev()) { ; } if (tmpArch != null) { Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-07-02 18:57:56 UTC (rev 229) @@ -262,17 +262,17 @@ if (oldHead != null && oldHead.getNodeNr() == arch.getNodeNr()) { // replace old head with our clone: - if (oldHead.getPrevArch() != null) { - oldHead.getPrevArch().setNextArch(clone); - clone.setPrevArch(oldHead.getPrevArch()); + if (oldHead.getPrev() != null) { + oldHead.getPrev().setNext(clone); + clone.setPrev(oldHead.getPrev()); } else { // no previous arch, we must stick it on the grid mapControl.setArchObject(pos, clone); } - if (oldHead.getNextArch() != null) { - oldHead.getNextArch().setPrevArch(clone); - clone.setNextArch(oldHead.getNextArch()); + if (oldHead.getNext() != null) { + oldHead.getNext().setPrev(clone); + clone.setNext(oldHead.getNext()); } clone.setMyID(oldHead.getMyID()); // pass ID to new head @@ -284,8 +284,8 @@ } // delete old head: - oldHead.setNextArch(null); - oldHead.setPrevArch(null); + oldHead.setNext(null); + oldHead.setPrev(null); oldHead.setMapMultiNext(null); oldHead = null; } else { Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-07-02 18:57:56 UTC (rev 229) @@ -334,7 +334,7 @@ (matchCriteria == MATCH_OBJ_NAME && node.getBestName(node.getDefaultArch()).equalsIgnoreCase(matchString)))) { // first, delete the old arch - final ArchObject prevArch = node.getPrevArch(); + final ArchObject prevArch = node.getPrev(); it.remove(); if (replaceArch != null && !deleteOnly) { Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-02 18:57:56 UTC (rev 229) @@ -883,11 +883,19 @@ return mapy; } - public void setNextArch(final ArchObject arch) { + /** + * Set Next link. + * @param arch Arch to point next to + */ + public void setNext(final ArchObject arch) { next = arch; } - public void setPrevArch(final ArchObject arch) { + /** + * Set Prev link. + * @param arch Arch to point prev to + */ + public void setPrev(final ArchObject arch) { prev = arch; } @@ -899,11 +907,19 @@ tempptr = temp; } - public ArchObject getNextArch() { + /** + * Get Next link. + * @return next link + */ + public ArchObject getNext() { return next; } - public ArchObject getPrevArch() { + /** + * Get Prev link. + * @return prev link + */ + public ArchObject getPrev() { return prev; } Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIterator.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIterator.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIterator.java 2006-07-02 18:57:56 UTC (rev 229) @@ -1,4 +1,26 @@ -/* $Id: ArchObjectIterator.java,v 1.1 2006/04/06 17:16:03 akirschbaum Exp $ */ +/* + * Daimonin Java Editor. + * Copyright (C) 2000 Michael Toennies + * Copyright (C) 2001 Andreas Vogl + * + * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) + * + * 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., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ package cfeditor.arch; @@ -6,39 +28,72 @@ import java.util.NoSuchElementException; /** - * The class ArchObjectIterator implements an {@link Iterator} that - * returns all {@link ArchObject}s in a map location. - * @author Andreas Kirschbaum + * Iterator for ArchObjects. + * This class is only meant for usage during the transition from manually linked lists to encapslued Collections lists in arch handling. + * This Iterator is believed to be safe against concurrent modification. + * Therefore it is not fail-fast, it does not throw ConcurrentModificationException. + * The next link is future-fetched, which means that the invocation of {@link #next()} already prepares the next invocation of {@link #hasNext()} or {@link #next()}. + * This allows to safely perform manipulations on the current object, especially deletion, without loosing traversal. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> */ public class ArchObjectIterator implements Iterator<ArchObject> { - protected ArchObject nextArchObject; +// /** Current ArchObject, used for {@link #remove()}. */ +// private ArchObject current; - protected ArchObject currArchObject = null; + /** Traversal direction. */ + private final boolean forward; - public ArchObjectIterator(final ArchObject archObject) { - nextArchObject = archObject; + /** ArchObject for first iteration step. */ + private ArchObject next; + + /** + * Creates a new instance of ArchObjectIterator (forward iteration). + * @param first first ArchObject to start forward iteration on + */ + public ArchObjectIterator(final ArchObject first) { + this(first, true); } + /** + * Creates a new instance of ArchObjectIterator. + * @param first first ArchObject to start iteration on + * @param forward <code>true</code> for forward iteration, <code>false</code> for backward iteration + */ + ArchObjectIterator(final ArchObject first, final boolean forward) { + next = first; + this.forward = forward; + } + /** {@inheritDoc} */ public boolean hasNext() { - return nextArchObject != null; + return next != null; } /** {@inheritDoc} */ public ArchObject next() { - if (nextArchObject == null) { - throw new NoSuchElementException(); + try { + return next; + } finally { + try { + next = forward ? next.getNext() : next.getPrev(); + } catch (final NullPointerException e) { + //noinspection ThrowFromFinallyBlock + throw new NoSuchElementException(); + } } - - currArchObject = nextArchObject; - nextArchObject = currArchObject.getNextArch(); - return currArchObject; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + * @todo eventually, multitile-removal should go here. + */ public void remove() { throw new UnsupportedOperationException(); +// ArchObject prev = current.getPrevArch(); +// ArchObject next = current.getNextArch(); +// if (next != null) { next.setPrevArch(prev); } +// if (prev != null) { prev.setPrevArch(next); } } } // class ArchObjectIterator Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java 2006-07-02 18:57:56 UTC (rev 229) @@ -26,6 +26,12 @@ } /** {@inheritDoc} */ + public ArchObject next() { + currArchObject = super.next(); + return currArchObject; + } + + /** {@inheritDoc} */ @Override public void remove() { if (currArchObject == null) { throw new IllegalStateException(); @@ -35,4 +41,6 @@ currArchObject = null; } + private ArchObject currArchObject = null; + } // class ArchObjectIteratorDeleteArchMapObject Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java 2006-07-02 18:57:56 UTC (rev 229) @@ -49,6 +49,12 @@ } /** {@inheritDoc} */ + public ArchObject next() { + currArchObject = super.next(); + return currArchObject; + } + + /** {@inheritDoc} */ @Override public void remove() { if (currArchObject == null) { throw new IllegalStateException(); @@ -58,4 +64,6 @@ currArchObject = null; } + private ArchObject currArchObject = null; + } // class ArchObjectIteratorDeleteMapArch Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-07-02 12:48:06 UTC (rev 228) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-07-02 18:57:56 UTC (rev 229) @@ -227,8 +227,8 @@ */ public ArchObject getTopArchObject(final Point pos) { ArchObject result = getBottomArchObject(pos); - while (result != null && result.getNextArch() != null) { - result = result.getNextArch(); + while (result != null && result.getNext() != null) { + result = result.getNext(); } return result; } @@ -362,20 +362,20 @@ return; } - final ArchObject arch = prev.getNextArch(); + final ArchObject arch = prev.getNext(); if (arch == null) { return; } - prev.setNextArch(arch.getNextArch()); - arch.setPrevArch(prev.getPrevArch()); - arch.setNextArch(prev); - prev.setPrevArch(arch); - if (prev.getNextArch() != null) { - prev.getNextArch().setPrevArch(prev); + prev.setNext(arch.getNext()); + arch.setPrev(prev.getPrev()); + arch.setNext(prev); + prev.setPrev(arch); + if (prev.getNext() != null) { + prev.getNext().setPrev(prev); } - if (arch.getPrevArch() != null) { - arch.getPrevArch().setNextArch(arch); + if (arch.getPrev() != null) { + arch.getPrev().setNext(arch); } else { mapGrid[arch.getMapX()][arch.getMapY()] = arch; } @@ -402,20 +402,20 @@ return; } - final ArchObject prev = arch.getPrevArch(); + final ArchObject prev = arch.getPrev(); if (prev == null) { return; } - prev.setNextArch(arch.getNextArch()); - arch.setPrevArch(prev.getPrevArch()); - arch.setNextArch(prev); - prev.setPrevArch(arch); - if (prev.getNextArch() != null) { - prev.getNextArch().setPrevArch(prev); + prev.setNext(arch.getNext()); + arch.setPrev(prev.getPrev()); + arch.setNext(prev); + prev.setPrev(arch); + if (prev.getNext() != null) { + prev.getNext().setPrev(prev); } - if (arch.getPrevArch() != null) { - arch.getPrevArch().setNextArch(arch); + if (arch.getPrev() != null) { + arch.getPrev().setNext(arch); } else { mapGrid[arch.getMapX()][arch.getMapY()] = arch; } @@ -492,18 +492,18 @@ } else { if (!insertBelow) { // if we want to insert on top, we need to get last node element - for (int i = 0; node.getNextArch() != null; i++) { - node = node.getNextArch(); + for (int i = 0; node.getNext() != null; i++) { + node = node.getNext(); } - node.setNextArch(newarch); - node.getNextArch().setPrevArch(node); - node.getNextArch().setMapX(mapx); - node.getNextArch().setMapY(mapy); + node.setNext(newarch); + node.getNext().setPrev(node); + node.getNext().setMapX(mapx); + node.getNext().setMapY(mapy); } else { //ArchObject tmp = node; - node.setPrevArch(newarch); - newarch.setNextArch(node); + node.setPrev(newarch); + newarch.setNext(node); mapGrid[mapx][mapy] = newarch; newarch.setMapX(mapx); newarch.setMapY(mapy); @@ -572,14 +572,14 @@ // jump to the end of the list (-> grab "topmost" arch) ArchObject node; for (node = mapGrid[pos.x][pos.y]; - node != null && node.getNextArch() != null; - node = node.getNextArch()) { + node != null && node.getNext() != null; + node = node.getNext()) { ; } // now move the arch down till it meets the insert position - for (; node != null && node.getPrevArch() != null && - (next == null || node.getPrevArch().getMyID() != next.getMyID()); + for (; node != null && node.getPrev() != null && + (next == null || node.getPrev().getMyID() != next.getMyID()); moveTileDown(node, false)) { ; } @@ -650,18 +650,18 @@ } else { if (!insertBelow) { // if we want to insert on top, we need to get last node element - for (int i = 0; node.getNextArch() != null; i++) { - node = node.getNextArch(); + for (int i = 0; node.getNext() != null; i++) { + node = node.getNext(); } - node.setNextArch(arch); - node.getNextArch().setPrevArch(node); - node.getNextArch().setMapX(mapx); - node.getNextArch().setMapY(mapy); + node.setNext(arch); + node.getNext().setPrev(node); + node.getNext().setMapX(mapx); + node.getNext().setMapY(mapy); } else { // insert below, so just put it on first place - node.setPrevArch(arch); - arch.setNextArch(node); + node.setPrev(arch); + arch.setNext(node); mapGrid[mapx][mapy] = arch; arch.setMapX(mapx); arch.setMapY(mapy); @@ -824,8 +824,8 @@ final int mapx = node.getMapX(); final int mapy = node.getMapY(); // second, we remove our arch from the map position chain - final ArchObject prev = node.getPrevArch(); - ArchObject next = node.getNextArch(); + final ArchObject prev = node.getPrev(); + ArchObject next = node.getNext(); if (next == node) { // should not happen, but better we double-check to prevent infinite loop @@ -837,13 +837,13 @@ // if some up (or null), put this on start mapGrid[mapx][mapy] = next; if (next != null) { // if there one up, mark them as starter - next.setPrevArch(null); + next.setPrev(null); } } else { // we chain next to prev - prev.setNextArch(next); + prev.setNext(next); if (next != null) { // we are last... no next - next.setPrevArch(prev); + next.setPrev(prev); } } if (next != null) { @@ -852,8 +852,8 @@ // remove all inventory... node.clearInventory(); - node.setNextArch(null); - node.setPrevArch(null); + node.setNext(null); + node.setPrev(null); final ArchObject temp = node.getMapMultiNext(); // we save our next part (or null=finished) node.setMapMultiHead(null); node.setMapMultiNext(null); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-02 12:48:20
|
Revision: 228 Author: christianhujer Date: 2006-07-02 05:48:06 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=228&view=rev Log Message: ----------- Minor improvements and unifications to ArchObject and ArchObjectStack. Modified Paths: -------------- trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/arch/ArchObject.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-02 12:47:15 UTC (rev 227) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-07-02 12:48:06 UTC (rev 228) @@ -632,35 +632,19 @@ // ---- GET/SET methods for multi arches public int getRefMaxX() { - if (multi != null) { - return multi.getRefMaxx(); - } - - return 0; + return multi != null ? multi.getRefMaxx() : 0; } public int getRefMaxY() { - if (multi != null) { - return multi.getRefMaxy(); - } - - return 0; + return multi != null ? multi.getRefMaxy() : 0; } public int getRefMaxMX() { - if (multi != null) { - return multi.getRefMaxxm(); - } - - return 0; + return multi != null ? multi.getRefMaxxm() : 0; } public int getRefMaxMY() { - if (multi != null) { - return multi.getRefMaxym(); - } - - return 0; + return multi != null ? multi.getRefMaxym() : 0; } public void setRefMaxMX(final int x) { @@ -714,11 +698,8 @@ } public boolean isReferenced() { - if (multi != null) { - return multi.isReferenced(); - } + return multi != null ? multi.isReferenced() : false; - return false; } // this chained multi tiles on map for fast access. better then number and search trash @@ -739,27 +720,15 @@ } @Nullable public ArchObject getMapMultiHead() { - if (multi != null) { - return multi.getHead(); // this points to head. Heads points to itsself - } - - return null; + return multi != null ? multi.getHead() : null; } @Nullable public ArchObject getMapMultiNext() { - if (multi != null) { - return multi.getNext(); // if this is null and head != null = last tile - } - - return null; + return multi != null ? multi.getNext() : null; } public int getMultiShapeID() { - if (multi != null) { - return multi.getMultiShapeID(); - } - - return 0; + return multi != null ? multi.getMultiShapeID() : 0; } public void setMultiShapeID(final int value) { @@ -771,11 +740,7 @@ } public int getMultiPartNr() { - if (multi != null) { - return multi.getMultiPartNr(); - } - - return 0; + return multi != null ? multi.getMultiPartNr() : 0; } public void setMultiPartNr(final int value) { @@ -787,11 +752,7 @@ } public boolean isLowestPart() { - if (multi != null) { - return multi.isLowestPart(); - } - - return false; + return multi != null && multi.isLowestPart(); } public void setLowestPart(final boolean state) { @@ -822,11 +783,8 @@ // RefNr == NodeNr : head (first) tile of a multi tile arch // RefNr != NodeNr : part of multi tile arch public int getRefNr() { - if (multi != null) { - return multi.getRefNr(); - } + return multi != null ? multi.getRefNr() : -1; - return -1; // single tile } // refx/refy: Offset of this multi tile from head tile Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-07-02 12:47:15 UTC (rev 227) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-07-02 12:48:06 UTC (rev 228) @@ -82,7 +82,7 @@ * true when arches were loaded from the big collected archive files, * false when arches were loaded from individual archfiles */ - private static boolean loadFromArchive = false; + private static boolean loadedFromArchive = false; // this is the static part.. i want fast access later private final ArchObjectNode[] archNodeList = new ArchObjectNode[10000]; @@ -122,6 +122,10 @@ archObjCount++; } + /** + * Gets the number of loaded arch objects (only default arches). + * @return number of loaded arch objects (default arches) + */ public int getArchObjCount() { return archObjCount; } @@ -131,7 +135,7 @@ } public static boolean isLoadedFromArchive() { - return loadFromArchive; + return loadedFromArchive; } /** Returns the index of a face in the face map or -1. @@ -286,7 +290,7 @@ * "archtypes" and "crossfire.0" */ private void loadArchFromCollected() { - loadFromArchive = true; // load from the collected files + loadedFromArchive = true; // load from the collected files try { // open the resource file @@ -314,7 +318,7 @@ private void loadArchFromFiles(final File f, int index) { final String name = f.getName(); - loadFromArchive = false; // don't load from the collected files + loadedFromArchive = false; // don't load from the collected files if (f.isDirectory()) { // now, setup the arch panels if (!"cvs".equalsIgnoreCase(name) && !"dev".equalsIgnoreCase(name) && !name.startsWith(".")) { Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-02 12:47:15 UTC (rev 227) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-02 12:48:06 UTC (rev 228) @@ -63,9 +63,6 @@ /** Special constant that's used if an arch has no arch type set. */ public static final int TYPE_UNSET = -666; - /** Static reference to the archstack (default arches). */ - private static ArchObjectStack archstack; - /** Static reference to the typeList (find syntax errors). */ private static CFArchTypeList typeList; @@ -181,15 +178,6 @@ // TODO } - // set static references: arch stack and typeList - public static void setArchStack(final ArchObjectStack stack) { - archstack = stack; - } - - public static ArchObjectStack getArchStack() { - return archstack; - } - public static void setTypeList(final CFArchTypeList tlist) { typeList = tlist; } @@ -720,11 +708,11 @@ return isReferenced() && getMapMultiHead() != null ? getMapMultiHead() : this; } - public ArchObject getMapMultiHead() { + @Nullable public ArchObject getMapMultiHead() { return multi != null ? multi.getHead() : null; } - public ArchObject getMapMultiNext() { + @Nullable public ArchObject getMapMultiNext() { return multi != null ? multi.getNext(this) : null; } @@ -1237,7 +1225,7 @@ * Get the complete message text. * @return message text */ - public String getMsgText() { + @Nullable public String getMsgText() { return msgText != null ? msgText.toString() : null; } @@ -1279,7 +1267,7 @@ return clone; } catch (final CloneNotSupportedException e) { assert false; - throw new AssertionError(); + throw new AssertionError(e); } } @@ -1463,7 +1451,7 @@ return defaultArch.createArch(); } final ArchObject arch = new ArchObject(); - arch.setArchName(this.archName); + arch.setArchName(archName); arch.setDefaultArch(this); arch.setObjectFace(); return arch; Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-07-02 12:47:15 UTC (rev 227) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-07-02 12:48:06 UTC (rev 228) @@ -3,6 +3,7 @@ * Copyright (C) 2000 Michael Toennies * Copyright (C) 2001 Andreas Vogl * Copyright (C) 2005 Christian Hujer + * Copyright (C) 2006 The Gridarta Developers * * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) * @@ -86,15 +87,13 @@ // true when arches were loaded from the big collected archive files, // false when arches were loaded from individual archfiles - private static boolean isLoadedFromArchive; + private static boolean loadedFromArchive; private final List<ArchObject> archObjects = new ArrayList<ArchObject>(); /** The defined default arches. */ private final Map<String, ArchObject> arches = new TreeMap<String, ArchObject>(); - private int archNodeListCount; // ALL default arches loaded - private int archObjCount; // all objects, multi tile arches = 1 object private final CMainControl mainControl; @@ -113,19 +112,26 @@ */ public ArchObjectStack(final CMainControl mainControl) { this.mainControl = mainControl; - ArchObject.setArchStack(this); // XXX Bad Thing: add static reference to ArchObject } public void incArchObjCount() { archObjCount++; } + /** + * Gets the number of loaded arch objects (only default arches). + * @return number of loaded arch objects (default arches) + */ + public int getArchObjCount() { + return archObjCount; + } + public static int getLoadStatus() { return loadStatus; } public static boolean isLoadedFromArchive() { - return isLoadedFromArchive; + return loadedFromArchive; } /** @@ -201,7 +207,7 @@ loadArchFromCollected(); // collect arches & images from collection } else { FaceFacade.setNormal(new ArchFaceProvider()); - isLoadedFromArchive = false; // don't load from the collected files + loadedFromArchive = false; // don't load from the collected files animFiles = new ArrayList<File>(); loadArchFromFiles(new File(mainControl.getArchDefaultFolder()), 0, false); // collect arches & images from individual files loadAnimsFromFiles(); @@ -347,7 +353,7 @@ /** Load all arches and pngs from the collected files "archtypes" and "daimonin.0" */ private void loadArchFromCollected() { - isLoadedFromArchive = true; // load from the collected files + loadedFromArchive = true; // load from the collected files CFileReader stream = null; try { @@ -514,7 +520,7 @@ } public void connectFaces() { - for (ArchObject arch : archObjects) { + for (final ArchObject arch : archObjects) { arch.setObjectFace(); } } @@ -550,175 +556,172 @@ */ private void collectDaimoninArchesArches(final Progress pbar) { // WARNING: do not use out.println() because the server will crash if it's not "\n" but e.g. "\r"! - BufferedWriter out = null; try { final File dfile = new File(mainControl.getArchDefaultFolder(), IGUIConstants.ARCH_FILE); // now open the output-stream - out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dfile), CMainControl.MAP_ENCODING)); - int artifactCount = 0; + final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dfile), CMainControl.MAP_ENCODING)); + try { + int artifactCount = 0; - int count = 0; // count how much arches we've collected + int count = 0; // count how much arches we've collected - for (final ArchObject arch : archObjects) { + for (final ArchObject arch : archObjects) { - // exclude arches generated from artifacts file from collection - if (arch.isArtifact()) { - artifactCount++; - continue; - } - if (arch.getArchName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { - // process map arch + // exclude arches generated from artifacts file from collection + if (arch.isArtifact()) { + artifactCount++; + continue; + } + if (arch.getArchName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { + // process map arch - out.append("Object ").append(arch.getArchName()).append('\n'); + out.append("Object ").append(arch.getArchName()).append('\n'); - // map object hack: x/y is normally a reference for multi - // part arches - i include this hack until we rework the - // arch objects with more useful script names - if (arch.getArchName().equals(ArchObjectParser.STARTARCH_NAME)) { - out.append("x ").append(Integer.toString(arch.getMultiRefX())).append('\n'); - out.append("y ").append(Integer.toString(arch.getMultiRefY())).append('\n'); - } + // map object hack: x/y is normally a reference for multi + // part arches - i include this hack until we rework the + // arch objects with more useful script names + if (arch.getArchName().equals(ArchObjectParser.STARTARCH_NAME)) { + out.append("x ").append(Integer.toString(arch.getMultiRefX())).append('\n'); + out.append("y ").append(Integer.toString(arch.getMultiRefY())).append('\n'); + } - if (arch.getObjName() != null) { - out.append("name ").append(arch.getObjName()).append('\n'); - } - //if(arch.getFaceName() != null) { - // out.append("face ").append(arch.getFaceNAme()).append('\n'); - //} - if (arch.getArchTypNr() > 0) { - out.append("type ").append(Integer.toString(arch.getArchTypNr())).append('\n'); - } + if (arch.getObjName() != null) { + out.append("name ").append(arch.getObjName()).append('\n'); + } + //if(arch.getFaceName() != null) { + // out.append("face ").append(arch.getFaceNAme()).append('\n'); + //} + if (arch.getArchTypNr() > 0) { + out.append("type ").append(Integer.toString(arch.getArchTypNr())).append('\n'); + } - out.append(arch.getArchText()); - if (arch.getArchText().lastIndexOf(0x0a) != arch.getArchText().length() - 1) { - out.append('\n'); - } - out.append("end\n"); - } else { + out.append(arch.getArchText()); + if (arch.getArchText().lastIndexOf(0x0a) != arch.getArchText().length() - 1) { + out.append('\n'); + } + out.append("end\n"); + } else { - if (arch.isReferenced()) { - continue; - //ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), WARNING_MESSAGE, "archCollectWarningMultipartTailInPanel"); - } - out.append("Object ").append(arch.getArchName()).append('\n'); + if (arch.isReferenced()) { + continue; + //ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), WARNING_MESSAGE, "archCollectWarningMultipartTailInPanel"); + } + out.append("Object ").append(arch.getArchName()).append('\n'); - if (arch.getObjName() != null) { - out.append("name ").append(arch.getObjName()).append('\n'); - } - //if(arch.getFaceName() != null) { - // out.append("face ").append(arch.getFaceName()).append('\n'); - //} - if (arch.getArchTypNr() > 0) { - out.append("type ").append(Integer.toString(arch.getArchTypNr())).append('\n'); - } - if (arch.getMultiShapeID() > 0) { - out.append("mpart_id ").append(Integer.toString(arch.getMultiShapeID())).append('\n'); - } - if (arch.getMultiPartNr() > 0) { - out.append("mpart_nr ").append(Integer.toString(arch.getMultiPartNr())).append('\n'); - } + if (arch.getObjName() != null) { + out.append("name ").append(arch.getObjName()).append('\n'); + } + //if(arch.getFaceName() != null) { + // out.append("face ").append(arch.getFaceName()).append('\n'); + //} + if (arch.getArchTypNr() > 0) { + out.append("type ").append(Integer.toString(arch.getArchTypNr())).append('\n'); + } + if (arch.getMultiShapeID() > 0) { + out.append("mpart_id ").append(Integer.toString(arch.getMultiShapeID())).append('\n'); + } + if (arch.getMultiPartNr() > 0) { + out.append("mpart_nr ").append(Integer.toString(arch.getMultiPartNr())).append('\n'); + } - if (arch.getMsgText() != null) { - out.append("msg").append('\n'); - if (arch.getMsgText().length() > 1) { - out.append(arch.getMsgText()); - if (arch.getMsgText().lastIndexOf('\n') != arch.getMsgText().length() - 1) { - out.append('\n'); + if (arch.getMsgText() != null) { + out.append("msg").append('\n'); + if (arch.getMsgText().length() > 1) { + out.append(arch.getMsgText()); + if (arch.getMsgText().lastIndexOf('\n') != arch.getMsgText().length() - 1) { + out.append('\n'); + } } + out.append("endmsg\n"); } - out.append("endmsg\n"); - } - // special: add a string-attribute with the display-cathegory - out.append("editor_folder ").append(arch.getEditorFolder()).append('\n'); + // special: add a string-attribute with the display-cathegory + out.append("editor_folder ").append(arch.getEditorFolder()).append('\n'); - out.append(arch.getArchText()); - if (arch.getArchText().lastIndexOf('\n') != arch.getArchText().length() - 1) { - out.append('\n'); - } - out.append("end\n"); + out.append(arch.getArchText()); + if (arch.getArchText().lastIndexOf('\n') != arch.getArchText().length() - 1) { + out.append('\n'); + } + out.append("end\n"); - // if multi-head, we must attach the tail - if (arch.isMulti()) { - // process the multipart tail: - for (final ArchObject tail : arch.getTailList()) { + // if multi-head, we must attach the tail + if (arch.isMulti()) { + // process the multipart tail: + for (final ArchObject tail : arch.getTailList()) { - if (!tail.isReferenced()) { - ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), "archCollectWarningMultipartTooShort"); - } + if (!tail.isReferenced()) { + ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), "archCollectWarningMultipartTooShort"); + } - out.append("More\n"); + out.append("More\n"); - out.append("Object ").append(tail.getArchName()).append('\n'); + out.append("Object ").append(tail.getArchName()).append('\n'); - if (tail.getObjName() != null) { - out.append("name ").append(tail.getObjName()).append('\n'); - } - //if(arch.getFaceName() != null) { - // out.append("face ").append(arch.getFaceName()).append('\n'); - //} - if (tail.getArchTypNr() > 0) { - out.append("type ").append(Integer.toString(tail.getArchTypNr())).append('\n'); - } - if (tail.getMultiShapeID() > 0) { - out.append("mpart_id ").append(Integer.toString(tail.getMultiShapeID())).append('\n'); - } - if (tail.getMultiPartNr() > 0) { - out.append("mpart_nr ").append(Integer.toString(tail.getMultiPartNr())).append('\n'); - } + if (tail.getObjName() != null) { + out.append("name ").append(tail.getObjName()).append('\n'); + } + //if(arch.getFaceName() != null) { + // out.append("face ").append(arch.getFaceName()).append('\n'); + //} + if (tail.getArchTypNr() > 0) { + out.append("type ").append(Integer.toString(tail.getArchTypNr())).append('\n'); + } + if (tail.getMultiShapeID() > 0) { + out.append("mpart_id ").append(Integer.toString(tail.getMultiShapeID())).append('\n'); + } + if (tail.getMultiPartNr() > 0) { + out.append("mpart_nr ").append(Integer.toString(tail.getMultiPartNr())).append('\n'); + } - if (tail.getMsgText() != null) { - out.append("msg\n"); - if (tail.getMsgText().length() > 1) { - out.append(tail.getMsgText()); - if (tail.getMsgText().lastIndexOf('\n') != tail.getMsgText().length() - 1) { - out.append('\n'); + if (tail.getMsgText() != null) { + out.append("msg\n"); + if (tail.getMsgText().length() > 1) { + out.append(tail.getMsgText()); + if (tail.getMsgText().lastIndexOf('\n') != tail.getMsgText().length() - 1) { + out.append('\n'); + } } + out.append("endmsg\n"); } - out.append("endmsg\n"); - } - out.append(tail.getArchText()); - if (tail.getArchText().lastIndexOf(0x0a) != tail.getArchText().length() - 1) { - out.append('\n'); - } + out.append(tail.getArchText()); + if (tail.getArchText().lastIndexOf(0x0a) != tail.getArchText().length() - 1) { + out.append('\n'); + } - // position of multi relative to head - if (tail.isReferenced()) { - if (tail.getMultiRefX() != 0) { - out.append("x ").append(Integer.toString(tail.getMultiRefX())).append('\n'); + // position of multi relative to head + if (tail.isReferenced()) { + if (tail.getMultiRefX() != 0) { + out.append("x ").append(Integer.toString(tail.getMultiRefX())).append('\n'); + } + if (tail.getMultiRefY() != 0) { + out.append("y ").append(Integer.toString(tail.getMultiRefY())).append('\n'); + } } - if (tail.getMultiRefY() != 0) { - out.append("y ").append(Integer.toString(tail.getMultiRefY())).append('\n'); + out.append("end\n"); + count++; + if (count % 100 == 0) { + pbar.setValue(count); } } - out.append("end\n"); - count++; - if (count % 100 == 0) { - pbar.setValue(count); - } } } + count++; + if (count % 100 == 0) { + pbar.setValue(count); + } } - count++; - if (count % 100 == 0) { - pbar.setValue(count); + + // check if we still missed any arches + if ((count + artifactCount) - mainControl.getArchCount() != 0) { + ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), "archCollectWarningMissed", mainControl.getArchCount() - count); } + pbar.setValue(count); + } finally { + out.close(); } - - // check if we still missed any arches - if ((count + artifactCount) - mainControl.getArchCount() != 0) { - ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), "archCollectWarningMissed", mainControl.getArchCount() - count); - } - pbar.setValue(count); } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), "archCollectErrorIOException", "arches", e); - } finally { - try { - out.close(); - } catch (final Exception e) { /* ignore */ } finally { - out = null; - } } } @@ -727,33 +730,28 @@ * @param pbar progress bar to update */ private void collectDaimoninArchesAnimations(final Progress pbar) { - BufferedWriter out = null; try { - out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(mainControl.getArchDefaultFolder(), "animations")), CMainControl.MAP_ENCODING)); - - final AnimationObjects animationObjects = mainControl.getAnimationObjects(); - - pbar.setLabel(ACTION_FACTORY.getString("archCollectAnimations"), animationObjects.size()); - int counter = 0; // counter for progress bar - for (final AnimationObject anim : animationObjects) { - out - .append("anim ") - .append(anim.getAnimName()) - .append('\n') - .append(anim.getAnimList()) - .append("mina\n"); - if (++counter % 100 == 0) { - pbar.setValue(counter); + final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(mainControl.getArchDefaultFolder(), "animations")), CMainControl.MAP_ENCODING)); + try { + final AnimationObjects animationObjects = mainControl.getAnimationObjects(); + pbar.setLabel(ACTION_FACTORY.getString("archCollectAnimations"), animationObjects.size()); + int counter = 0; // counter for progress bar + for (final AnimationObject anim : animationObjects) { + out + .append("anim ") + .append(anim.getAnimName()) + .append('\n') + .append(anim.getAnimList()) + .append("mina\n"); + if (++counter % 100 == 0) { + pbar.setValue(counter); + } } + } finally { + out.close(); } } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), "archCollectErrorIOException", "animations", e); - } finally { - try { - out.close(); - } catch (final Exception e) { /* ignore */ } finally { - out = null; - } } } @@ -762,31 +760,26 @@ * @param pbar progress bar to update */ private void collectDaimoninArchesAnimationTree(final Progress pbar) { - BufferedWriter out = null; try { - out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(new File(mainControl.getArchDefaultFolder(), IGUIConstants.CONFIG_DIR), IGUIConstants.ANIMTREE_FILE)), CMainControl.MAP_ENCODING)); - - final AnimationObjects animationObjects = mainControl.getAnimationObjects(); - final Map<String, String> tree = animationObjects.getAnimPathTree(); - - pbar.setLabel(ACTION_FACTORY.getString("archCollectAnimationTree"), animationObjects.size()); - int counter = 0; // counter for progress bar - for (String path : tree.values()) { - out - .append(path) - .append('\n'); - if (++counter % 100 == 0) { - pbar.setValue(counter); + final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(new File(mainControl.getArchDefaultFolder(), IGUIConstants.CONFIG_DIR), IGUIConstants.ANIMTREE_FILE)), CMainControl.MAP_ENCODING)); + try { + final AnimationObjects animationObjects = mainControl.getAnimationObjects(); + final Map<String, String> tree = animationObjects.getAnimPathTree(); + pbar.setLabel(ACTION_FACTORY.getString("archCollectAnimationTree"), animationObjects.size()); + int counter = 0; // counter for progress bar + for (String path : tree.values()) { + out + .append(path) + .append('\n'); + if (++counter % 100 == 0) { + pbar.setValue(counter); + } } + } finally { + out.close(); } } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), "archCollectErrorIOException", IGUIConstants.ANIMTREE_FILE, e); - } finally { - try { - out.close(); - } catch (final Exception e) { /* ignore */ } finally { - out = null; - } } } @@ -920,12 +913,4 @@ } } - /** - * Gets the number of loaded arch objects (only default arches). - * @return number of loaded arch objects (default arches) - */ - public int getArchObjCount() { - return archObjCount; - } - } // class ArchObjectStack This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-02 12:47:24
|
Revision: 227 Author: christianhujer Date: 2006-07-02 05:47:15 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=227&view=rev Log Message: ----------- Minor changes to release system. Modified Paths: -------------- trunk/daimonin/build.xml Modified: trunk/daimonin/build.xml =================================================================== --- trunk/daimonin/build.xml 2006-07-02 10:12:24 UTC (rev 226) +++ trunk/daimonin/build.xml 2006-07-02 12:47:15 UTC (rev 227) @@ -292,29 +292,8 @@ </target> <target - name = "ftpPublish" - description = "publishes ${jarname} using ftp" - depends="preparePublish" - > - <ftp - server="${user.ftp.host}" - userid="${user.ftp.user}" - password="${user.ftp.pass}" - remotedir="${user.ftp.dir}" - depends="${user.ftp.depends}" - passive="${user.ftp.passive}" - ignoreNoncriticalErrors="${user.ftp.ignoreNoncriticalErrors}" - > - <fileset dir="."> - <include name="${jarname}" /> - <include name="update.properties" /> - </fileset> - </ftp> - </target> - - <target name = "scpPublish" - description = "publishes ${jarname} using scp" + description = "Releases a nightly build on sourceforge usable for auto-update." depends = "preparePublish" > <scp @@ -334,4 +313,11 @@ </exec> </target> + <target + name = "release" + description = "Releases a build on sourceforge usable for auto-update plus a new release package on sourceforge and freshmeat." + depends = "scpPublish" + > + </target> + </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-02 10:12:29
|
Revision: 226 Author: christianhujer Date: 2006-07-02 03:12:24 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=226&view=rev Log Message: ----------- Fix for Mantis #0000407: Removing an out of bounds multi-tile object throws NPE. Modified Paths: -------------- trunk/daimonin/src/daieditor/arch/ArchObject.java Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-30 00:27:57 UTC (rev 225) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-07-02 10:12:24 UTC (rev 226) @@ -585,8 +585,10 @@ */ public void remove() { final ArchObject head = getMapMultiHead() != null ? getMapMultiHead() : this; - for (ArchObject tail : head.getTailList()) { - tail.container.remove(tail); + for (final ArchObject tail : head.getTailList()) { + if (tail.container != null) { + tail.container.remove(tail); + } tail.setMapMultiHead(null); tail.setTailList(null); tail.setReferenced(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-30 00:28:04
|
Revision: 225 Author: christianhujer Date: 2006-06-29 17:27:57 -0700 (Thu, 29 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=225&view=rev Log Message: ----------- Released new update version, committing next build number. Modified Paths: -------------- trunk/daimonin/nextBuildNumber.properties Modified: trunk/daimonin/nextBuildNumber.properties =================================================================== --- trunk/daimonin/nextBuildNumber.properties 2006-06-30 00:26:33 UTC (rev 224) +++ trunk/daimonin/nextBuildNumber.properties 2006-06-30 00:27:57 UTC (rev 225) @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Fri Jun 30 02:01:12 CEST 2006 -build.number=2927 +#Fri Jun 30 02:27:53 CEST 2006 +build.number=2928 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-30 00:26:48
|
Revision: 224 Author: christianhujer Date: 2006-06-29 17:26:33 -0700 (Thu, 29 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=224&view=rev Log Message: ----------- Changed application name from Daimonin to Gridarta, removed old version scheme. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/IGUIConstants.java trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-06-30 00:01:17 UTC (rev 223) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-06-30 00:26:33 UTC (rev 224) @@ -88,6 +88,8 @@ import java.util.List; import java.util.ListIterator; import java.util.Random; +import java.util.MissingResourceException; +import static java.util.ResourceBundle.getBundle; import java.util.logging.Level; import java.util.logging.Logger; import java.util.prefs.Preferences; @@ -446,18 +448,6 @@ // now collect all arch you can find in the arch path!! mainView.updateFocus(false); /*MTMT*/ - // Delete the old settings file. Remove me after a while. - File settings = new File(new File(System.getProperty("user.home"), IGUIConstants.APP_SETTINGS_DIR), IGUIConstants.APP_NAME); - if (settings.exists() && ACTION_FACTORY.showOnetimeConfirmDialog(mainView, YES_NO_OPTION, INFORMATION_MESSAGE, "oldSettingsFound", settings.toString()) == YES_OPTION) - { - settings.delete(); - } - // Now delete the settings dir in case it's empty. - settings = settings.getParentFile(); - if (settings.list() == null || settings.list().length == 0) { - settings.delete(); - } - // Delete libraries. final File libs = new File(System.getProperty("user.dir"), "lib"); final String libsString = ACTION_FACTORY.getString("oldLibs.okayLibs"); @@ -1530,7 +1520,7 @@ public void options() { if (prefsGroup == null) { prefsGroup = new PreferencesGroup( - "Daimonin Editor", + "Gridarta for Daimonin", new ResPrefs(this), new AppPrefs(), new NetPrefs(), @@ -2202,6 +2192,14 @@ return lastOpenedMap; } + public static String getBuildNumberAsString() { + try { + return getBundle("build").getString("build.number"); + } catch (final MissingResourceException e) { + return "unknown version"; + } + } + /** Recent entry. */ public final class Recent extends AbstractAction { Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-06-30 00:01:17 UTC (rev 223) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-06-30 00:26:33 UTC (rev 224) @@ -162,7 +162,7 @@ * Constructs the main view and registers the given main controller. */ CMainView() { - super(IGUIConstants.APP_NAME + " - " + IGUIConstants.APP_WINDOW_TITLE); + super(ACTION_FACTORY.format("mainWindow.title", CMainControl.getBuildNumberAsString())); initActions(); final ImageIcon icon = CGUIUtils.getIcon(IGUIConstants.APP_ICON); Modified: trunk/daimonin/src/daieditor/IGUIConstants.java =================================================================== --- trunk/daimonin/src/daieditor/IGUIConstants.java 2006-06-30 00:01:17 UTC (rev 223) +++ trunk/daimonin/src/daieditor/IGUIConstants.java 2006-06-30 00:26:33 UTC (rev 224) @@ -38,12 +38,6 @@ public interface IGUIConstants { /** - * Version number of the CFJavaEditor <br> - * should be increased when a certain amount of changes happened - */ - String VERSION = "BETA3 v0.966"; //Changed as of December 17th, 2004 - - /** * Internal version number of the included online-documentation <br> * increasing the number causes an automated popup of the docu * when users upgrade their editor and run for the first time @@ -98,12 +92,6 @@ */ int[] ALL_TILE_PATHS = {TILE_PATH_NORTH, TILE_PATH_EAST, TILE_PATH_SOUTH, TILE_PATH_WEST, TILE_PATH_NORTHEAST, TILE_PATH_SOUTHEAST, TILE_PATH_SOUTHWEST, TILE_PATH_NORTHWEST}; - String APP_NAME = "DaimoninEditor BETA3 v0.966"; // application name - - String APP_WINDOW_TITLE = "Daimonin Map & Arch Editor"; // application main window title - - String APP_SETTINGS_DIR = ".daieditor"; // name of directory with settings file - /** * The height of rigid area between the two tab-panes on * the pickmap- and arch-panel. Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-06-30 00:01:17 UTC (rev 223) +++ trunk/daimonin/src/daieditor/messages.properties 2006-06-30 00:26:33 UTC (rev 224) @@ -1,6 +1,8 @@ # Warning: This file MUST be ISO-8859-1 # See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding +mainWindow.title=Gridarta for Daimonin {0} + # Zoom zoomMen.text=Zoom zoomMen.mnemonic=Z @@ -310,9 +312,7 @@ autoValidate.text=Automatically run validation after each change optionsValidators=Validators -# Old Settings and Libraries -oldSettingsFound.message=Old configuration file found.\nLocation: {0}\nIt''s not used anymore.\nDelete it? -oldSettingsFound.title=Delete old configuration file? +# Old Libraries oldLibsFound.message=Old libraries found.\nLocation: {0}\nThey aren''t used anymore.\nDelete them? oldLibsFound.title=Delete old libraries? @@ -785,15 +785,15 @@ about.text=About... about.mnemonic=A -about.title=About DaimoninEditor BETA3 v0.966 -about=<html><h1 align="center">Daimonin Editor</h1><h2 align="center">Version BETA3 v0.966</h2><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> +about.title=About Gridarta for Daimonin +about=<html><h1 align="center">Gridarta for Daimonin</h1><p>Editor for Daimonin MMORPG maps and arches</p><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> aboutTab.title=About license.text=License... license.mnemonic=L license.title=License license.missing=Cannot find License file. -license.1.title=Daimonin Editor +license.1.title=Gridarta license.1.file=License license.2.title=JAPI license.2.file=LICENSE-japi.jar Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2006-06-30 00:01:17 UTC (rev 223) +++ trunk/daimonin/src/daieditor/messages_de.properties 2006-06-30 00:26:33 UTC (rev 224) @@ -438,8 +438,8 @@ about.text=\xDCber... about.mnemonic=A -about.title=\xDCber DaimoninEditor BETA3 v0.966 -about.message=Version BETA3 v0.966\n(c) 2001-2005 Michael Toennies\nAndreas Vogl\nPeter Plischewsky\nGecko\nChristian Hujer +about.title=\xDCber Gridarta +about=<html><h1 align="center">Gridarta f\xFCr Daimonin</h1><p>Editor f\xFCr Daimonin MMORPG Karten und Objekte</p><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build-Nummer:</td><td>{1}</td></tr><tr><td align="right">Build-Entwickler:</td><td>{2}</td></tr><tr><td align="right">Build-Zeit:</td><td>{3}</td></tr></table></html> aboutTab.title=\xDCber license.text=Lizenz... Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2006-06-30 00:01:17 UTC (rev 223) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2006-06-30 00:26:33 UTC (rev 224) @@ -308,9 +308,7 @@ autoValidate.text=Validera automatiskt efter varje \xE4ndring optionsValidators=Validerare -# Old Settings and Libraries -oldSettingsFound=Hittade en gammal konfigurationsfil.\nS\xF6kv\xE4g: {0}\nDen anv\xE4nds inte l\xE4ngre. Skall jag ta bort den? -oldSettingsFound.title=Ta bort gammal konfigurationsfil +# Old Libraries oldLibsFound=Hittade gamla bibliotek.\nS\xF6kv\xE4g: {0}\nDe anv\xE4nds inte l\xE4ngre. Skall jag ta bort dem? oldLibsFound.title=Ta bort gamla bibliotek? Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-06-30 00:01:17 UTC (rev 223) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-06-30 00:26:33 UTC (rev 224) @@ -23,7 +23,6 @@ package daieditor.textedit.scripteditor; -import daieditor.IGUIConstants; import daieditor.textedit.textarea.InputHandler; import daieditor.textedit.textarea.JEditTextArea; import java.awt.Event; @@ -252,26 +251,26 @@ }); menuHelp.add(miOnlineHelp); - final JMenuItem miAbout = new JMenuItem("About"); - miAbout.setMnemonic('A'); - miAbout.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent event) { - control.showMessage("About " + IGUIConstants.APP_NAME, - " Version " + IGUIConstants.VERSION + '\n' - + "(c) 2005 Michael Toennies\n" - + " Andreas Vogl\n" - + " Peter Plischewsky\n" - + " Gecko\n"); - } - }); - menuHelp.add(miAbout); +// final JMenuItem miAbout = new JMenuItem("About"); +// miAbout.setMnemonic('A'); +// miAbout.addActionListener(new ActionListener() { +// public void actionPerformed(final ActionEvent event) { +// control.showMessage("About " + IGUIConstants.APP_NAME, +// " Version " + IGUIConstants.VERSION + '\n' +// + "(c) 2005 Michael Toennies\n" +// + " Andreas Vogl\n" +// + " Peter Plischewsky\n" +// + " Gecko\n"); +// } +// }); +// menuHelp.add(miAbout); add(menuHelp); } /** * Refreshes the enable/disable state of all menus. */ - public final void refresh() { + public void refresh() { miFind.setEnabled(false); miColors.setEnabled(false); miFont.setEnabled(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-30 00:01:24
|
Revision: 223 Author: christianhujer Date: 2006-06-29 17:01:17 -0700 (Thu, 29 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=223&view=rev Log Message: ----------- Released new update version, committing next build number. Modified Paths: -------------- trunk/daimonin/nextBuildNumber.properties Modified: trunk/daimonin/nextBuildNumber.properties =================================================================== --- trunk/daimonin/nextBuildNumber.properties 2006-06-29 23:57:57 UTC (rev 222) +++ trunk/daimonin/nextBuildNumber.properties 2006-06-30 00:01:17 UTC (rev 223) @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Wed Jun 28 23:16:08 CEST 2006 -build.number=2926 +#Fri Jun 30 02:01:12 CEST 2006 +build.number=2927 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-29 23:58:09
|
Revision: 222 Author: christianhujer Date: 2006-06-29 16:57:57 -0700 (Thu, 29 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=222&view=rev Log Message: ----------- Minor documentation improvements. Modified Paths: -------------- trunk/daimonin/src/daieditor/arch/ArchObject.java Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-29 23:56:10 UTC (rev 221) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-29 23:57:57 UTC (rev 222) @@ -91,24 +91,16 @@ private String animName; /** - * The archText. - * <p/> - * It only contains the differences from the default arch. - * <p/> - * Note: It's a rule that every line ends with a '\n', including the last - * line. + * The archText with the differences from the default arch. + * @note Every line in the archText must end on '\n', including the last line. */ private StringBuffer archText; /** * The msgText. - * <p/> - * Note: It's a rule that every line ends with a '\n', including the last - * line. - * <p/> - * Another rule (unconfirmed): If the value is <code>null</code>, the arch - * has no message text, if the value exists but is empty, the arch has an - * empty message text. + * @note Every line in msgText must end on '\n', including the last line. + * @note If the value is <code>null</code>, the arch has no message text, + * if the value exists but is empty, the arch has an empty message text (unconfirmed). */ private StringBuffer msgText; @@ -1247,7 +1239,11 @@ return msgText != null ? msgText.toString() : null; } - // object can altered by "direction <value> " + /** + * Returns whether the direction is set. <code>true</code> if direction is set, + * otherwise <code>false</code>. + * @return whether the direction is set. + */// object can altered by "direction <value> " public boolean isDirectionSet() { return directionSet; } @@ -1479,10 +1475,18 @@ container.replace(this, other); } + /** + * Returns editor Folder. + * @return editor Folder + */ public String getEditorFolder() { return editorFolder; } + /** + * Sets editor Folder. + * @param editorFolder editor Folder + */ public void setEditorFolder(final String editorFolder) { this.editorFolder = editorFolder; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-29 23:56:18
|
Revision: 221 Author: christianhujer Date: 2006-06-29 16:56:10 -0700 (Thu, 29 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=221&view=rev Log Message: ----------- Put tool selection in a split pane on user demand (Unislash). Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanel.java Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-28 21:33:14 UTC (rev 220) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-29 23:56:10 UTC (rev 221) @@ -32,10 +32,12 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JTabbedPane; +import javax.swing.JSplitPane; import static javax.swing.SwingConstants.TOP; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.jetbrains.annotations.Nullable; +import net.sf.gridarta.gui.GSplitPane; /** * The <code>CArchPanel</code> holds the tile palette. @@ -101,8 +103,7 @@ // TODO: introduce a tool registry - add(toolSelectorPane, BorderLayout.NORTH); - add(archAndPickPane, BorderLayout.CENTER); + add(new GSplitPane(JSplitPane.VERTICAL_SPLIT, toolSelectorPane, archAndPickPane), BorderLayout.CENTER); add(archQuickPanel, BorderLayout.SOUTH); // we must set the list of the selected list depend on combo selection This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-28 21:33:23
|
Revision: 220 Author: christianhujer Date: 2006-06-28 14:33:14 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=220&view=rev Log Message: ----------- Added unit test for Size2D. Added Paths: ----------- trunk/src/test/net/sf/gridarta/Size2DTest.java Added: trunk/src/test/net/sf/gridarta/Size2DTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/Size2DTest.java (rev 0) +++ trunk/src/test/net/sf/gridarta/Size2DTest.java 2006-06-28 21:33:14 UTC (rev 220) @@ -0,0 +1,67 @@ +package test.net.sf.gridarta; + +import net.sf.gridarta.Size2D; +import junit.framework.TestCase; + +/** + * Test for {@link Size2D}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class Size2DTest extends TestCase { + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + super.tearDown(); + } + + /** Test case for {@link Size2D#Size2D(int, int)}. */ + public void testSize2D() throws Exception { + final Size2D size = new Size2D(100, 200); + assertEquals("width MUST be stored", 100, size.getWidth()); + assertEquals("height MUST be stored", 200, size.getHeight()); + } + + /** Test case for {@link Size2D#equals(Object)}. */ + public void testEquals() throws Exception { + final Size2D size1 = new Size2D(100, 200); + final Size2D size2 = new Size2D(100, 200); + final Size2D size3 = new Size2D(100, 200); + final Size2D differWidth = new Size2D(50, 200); + final Size2D differHeight = new Size2D(100, 80); + final Size2D differBoth = new Size2D(50, 80); + assertEquals("Sizes with identical width and height MUST be equal.", size1, size2); + assertEquals("Sizes with identical width and height MUST be equal.", size1, size3); + assertEquals("Sizes with identical width and height MUST be equal.", size2, size1); + assertEquals("Sizes with identical width and height MUST be equal.", size2, size3); + assertEquals("Sizes with identical width and height MUST be equal.", size3, size1); + assertEquals("Sizes with identical width and height MUST be equal.", size3, size2); + assertFalse("Sizes with different width or height MUST be unequal", size1.equals(differBoth)); + assertFalse("Sizes with different width or height MUST be unequal", size1.equals(differWidth)); + assertFalse("Sizes with different width or height MUST be unequal", size1.equals(differHeight)); + } + + /** Test case for {@link Size2D#hashCode()}. */ + public void testHashCode() throws Exception { + final Size2D size1 = new Size2D(100, 200); + final Size2D size2 = new Size2D(100, 200); + assertEquals("Equal sizes MUST return the same hashCode.", size1.hashCode(), size2.hashCode()); + } + + /** Test case for {@link Size2D#getWidth()}. */ + public void testGetWidth() throws Exception { + final Size2D size = new Size2D(100, 200); + assertEquals("width MUST be stored", 100, size.getWidth()); + } + + /** Test case for {@link Size2D#getHeight()}. */ + public void testGetHeight() throws Exception { + final Size2D size = new Size2D(100, 200); + assertEquals("height MUST be stored", 200, size.getHeight()); + } + +} // class Size2DTest \ No newline at end of file Property changes on: trunk/src/test/net/sf/gridarta/Size2DTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-28 21:16:16
|
Revision: 219 Author: christianhujer Date: 2006-06-28 14:16:10 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=219&view=rev Log Message: ----------- Released new update version, committing next build number. Modified Paths: -------------- trunk/daimonin/nextBuildNumber.properties Modified: trunk/daimonin/nextBuildNumber.properties =================================================================== --- trunk/daimonin/nextBuildNumber.properties 2006-06-28 21:14:36 UTC (rev 218) +++ trunk/daimonin/nextBuildNumber.properties 2006-06-28 21:16:10 UTC (rev 219) @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Wed Jun 28 22:37:09 CEST 2006 -build.number=2925 +#Wed Jun 28 23:16:08 CEST 2006 +build.number=2926 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-28 21:14:42
|
Revision: 218 Author: christianhujer Date: 2006-06-28 14:14:36 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=218&view=rev Log Message: ----------- Implemented equals() and hashCode() to allow checking sizes on equality. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/Size2D.java Modified: trunk/src/app/net/sf/gridarta/Size2D.java =================================================================== --- trunk/src/app/net/sf/gridarta/Size2D.java 2006-06-28 21:13:33 UTC (rev 217) +++ trunk/src/app/net/sf/gridarta/Size2D.java 2006-06-28 21:14:36 UTC (rev 218) @@ -54,6 +54,20 @@ this.height = height; } + /** {@inheritDoc} */ + @Override public boolean equals(final Object obj) { + if (!(obj instanceof Size2D)) { + return false; + } + final Size2D other = (Size2D) obj; + return height == other.height && width == other.width; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + return height ^ width << 16 ^ width >> 16; + } + /** * Returns the width of the area. * It is always greater than zero. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-28 21:13:38
|
Revision: 217 Author: christianhujer Date: 2006-06-28 14:13:33 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=217&view=rev Log Message: ----------- Fixed broken times character. Modified Paths: -------------- trunk/daimonin/src/daieditor/messages.properties Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-06-28 21:05:21 UTC (rev 216) +++ trunk/daimonin/src/daieditor/messages.properties 2006-06-28 21:13:33 UTC (rev 217) @@ -211,7 +211,7 @@ mapTilesClear.text=Clear Paths mapTilesClear.shortdescription=Clear all path names mapShrink.title=Confirm shrinking map -mapShrink.message=You selected a new map size of {0,number,integer} � {1,number,integer}. If the map was\nresized in this way, some objects would get cut off and deleted.\nAre you really sure you want this? +mapShrink.message=You selected a new map size of {0,number,integer} \xD7 {1,number,integer}. If the map was\nresized in this way, some objects would get cut off and deleted.\nAre you really sure you want this? mapHelp.text=Help mapOkay.text=Ok mapRestore.text=Restore This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-28 21:05:30
|
Revision: 216 Author: christianhujer Date: 2006-06-28 14:05:21 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=216&view=rev Log Message: ----------- Fixed broken times character. Modified Paths: -------------- trunk/daimonin/src/daieditor/messages.properties Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-06-28 20:37:12 UTC (rev 215) +++ trunk/daimonin/src/daieditor/messages.properties 2006-06-28 21:05:21 UTC (rev 216) @@ -239,7 +239,7 @@ mapErrorArchOutOfGrid.title=Arch out of map mapErrorArchOutOfGrid.message=Removing arch out of map bounds mapErrorDifferentSize.title=Different size -mapErrorDifferentSize.message=The maps you''re attaching have different sizes.\n{0} has size {1} � {2}, while\n{3} has size {4} � {5}.\nThis is hazardous for server and client and MUST BE FIXED! +mapErrorDifferentSize.message=The maps you''re attaching have different sizes.\n{0} has size {1} \xD7 {2}, while\n{3} has size {4} \xD7 {5}.\nThis is hazardous for server and client and MUST BE FIXED! mapMapTabTitle=Map properties mapTilesTabTitle=Map tiles mapTilesNoMapFileNoMapTilePane.title=Map tiles card unavailable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-28 20:37:23
|
Revision: 215 Author: christianhujer Date: 2006-06-28 13:37:12 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=215&view=rev Log Message: ----------- Released new update version, committing next build number. Modified Paths: -------------- trunk/daimonin/nextBuildNumber.properties Modified: trunk/daimonin/nextBuildNumber.properties =================================================================== --- trunk/daimonin/nextBuildNumber.properties 2006-06-27 20:42:18 UTC (rev 214) +++ trunk/daimonin/nextBuildNumber.properties 2006-06-28 20:37:12 UTC (rev 215) @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sun Jun 25 21:11:03 CEST 2006 -build.number=2924 +#Wed Jun 28 22:37:09 CEST 2006 +build.number=2925 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-27 20:42:29
|
Revision: 214 Author: derdanny Date: 2006-06-27 13:42:18 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=214&view=rev Log Message: ----------- Directory "arch/dev" is excluded from arch collection. All files/directories starting with "." are ignored. Modified Paths: -------------- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-27 19:01:38 UTC (rev 213) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-27 20:42:18 UTC (rev 214) @@ -391,7 +391,7 @@ final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels - if (CMainControl.arcFileFilter.accept(f)) { + if (CMainControl.arcFileFilter.accept(f) && !(folderLevel == 1 && name.equalsIgnoreCase("dev"))) { final String[] entries = f.list(); if (entries != null) { Arrays.sort(entries); Modified: trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java 2006-06-27 19:01:38 UTC (rev 213) +++ trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java 2006-06-27 20:42:18 UTC (rev 214) @@ -40,7 +40,7 @@ private final AbstractFileFilter other; /** The default rejected directory names. */ - private static final List<String> REJECTED_DIRECTORY_NAMES = Arrays.asList("CVS", ".dedit", ".xvpics"); + private static final List<String> REJECTED_DIRECTORY_NAMES = Arrays.asList("CVS"); /** The rejected directory names. */ private final List<String> rejectedDirectoryNames = new ArrayList<String>(); @@ -67,6 +67,9 @@ * First checks whether the file should be hidden, if not, checks the other FileFilter. */ @Override public boolean accept(final File pathname) { + if (pathname.getName().startsWith(".")) { + return false; + } // XXX suppression for Bug in IDEA //noinspection RedundantCast return !(pathname.isDirectory() && rejectedDirectoryNames.contains(pathname.getName())) && ((FileFilter) other).accept(pathname); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-27 19:01:53
|
Revision: 213 Author: akirschbaum Date: 2006-06-27 12:01:38 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=213&view=rev Log Message: ----------- Unify identifier names, white space and comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFileReader.java trunk/daimonin/src/daieditor/CFileReader.java Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-27 18:40:37 UTC (rev 212) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-27 19:01:38 UTC (rev 213) @@ -412,17 +412,17 @@ fileReader = new FileReader(spellfile.getAbsolutePath()); bufferedReader = new BufferedReader(fileReader); - CFileReader.readTill(bufferedReader, "spell spells", null); - CFileReader.readTill(bufferedReader, "{", null); + CFileReader.readUntil(bufferedReader, "spell spells", null); + CFileReader.readUntil(bufferedReader, "{", null); // reading spellnames one after the other, // this loop is terminated by an EOFException int i = 0; // index for insertion in the vector for (int counter = 0; true; counter++) { - CFileReader.readTill(bufferedReader, "{", "}"); - CFileReader.readTill(bufferedReader, "\"", null); - String name = CFileReader.readsTill(bufferedReader, "\""); - CFileReader.readTill(bufferedReader, "}", null); + CFileReader.readUntil(bufferedReader, "{", "}"); + CFileReader.readUntil(bufferedReader, "\"", null); + String name = CFileReader.readUntil(bufferedReader, "\""); + CFileReader.readUntil(bufferedReader, "}", null); name = name.trim(); // now insert this string lexographically into the vector Modified: trunk/crossfire/src/cfeditor/CFileReader.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileReader.java 2006-06-27 18:40:37 UTC (rev 212) +++ trunk/crossfire/src/cfeditor/CFileReader.java 2006-06-27 19:01:38 UTC (rev 213) @@ -60,11 +60,14 @@ private BufferedReader read; + /** Maximum number of characters to read in readUntil. */ + private static final long READ_MAX = 10000L; + /** - * Constructor: Open an ascii-stream to the specified resource file. - * @param dname name of directory that the file is in - * (null means the file is located in the editor root dir) + * Open an ascii-stream to the specified resource file. + * @param dname name of directory that the file is in (<code>null</code> means the file is located in the editor root dir) * @param fname name of the resource file + * @throws FileNotFoundException in case all three tries to open the file failed */ public CFileReader(final String dname, final String fname) throws FileNotFoundException { filename = fname; @@ -130,8 +133,8 @@ * @throws EOFException the end of file was reached, or the 'abort' string * has been encountered */ - public static void readTill(final BufferedReader stream, final String tag, final String abort) throws IOException { - int c; // character value, read from the stream + public static void readUntil(final BufferedReader stream, final String tag, final String abort) throws IOException { + int c; // character value, read from the stream int t = 0; // tag index int a = 0; // abort index @@ -144,7 +147,6 @@ } else { t = 0; } - if (c == abort.charAt(a)) { a++; } else { @@ -176,8 +178,8 @@ /** * Reads characters from the BufferedReader stream till 'tag' is found. - * Similar to readTill(), except that the read String is returned. 'tag' is - * not included in the returned String. + * Similar to readUntil(), except that the read String is returned. 'tag' + * is not included in the returned String. * @param stream ascii input stream to read from * @param tag stop reading at the string 'tag' * @return the string between the starting pos. of 'stream' (inclusive) and @@ -185,16 +187,16 @@ * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached */ - public static String readsTill(final BufferedReader stream, final String tag) throws IOException { + public static String readUntil(final BufferedReader stream, final String tag) throws IOException { String r = ""; // returned string - int c; // character value, read from the stream - int t = 0; // index + int c; // character value, read from the stream + int t = 0; // index - long count = 0; // counter (to realize when shooting past EOF) - final long maxCount = 10000; // bail out when counter exceeds this value + long count = 0; // counter (to realize when shooting past EOF) + final long maxCount = READ_MAX; // bail out when counter exceeds this value do { - c = stream.read(); // read one character + c = stream.read(); // read one character r += String.valueOf((char) c); // add character 'c' to the string if ((char) c == tag.charAt(t)) { t++; @@ -214,14 +216,14 @@ return r; } - // wrapper method for readTill, using BufferReader from 'this' - public void readTill(final String tag, final String abort) throws IOException { - readTill(read, tag, abort); + // wrapper method for readUntil, using BufferReader from 'this' + public void readUntil(final String tag, final String abort) throws IOException { + readUntil(read, tag, abort); } - // wrapper method for readsTill, using BufferReader from 'this' - public String readsTill(final String tag) throws IOException { - return readsTill(read, tag); + // wrapper method for readUntil, using BufferReader from 'this' + public String readUntil(final String tag) throws IOException { + return readUntil(read, tag); } /** close all open streams, print errormessages if closing failed */ Modified: trunk/daimonin/src/daieditor/CFileReader.java =================================================================== --- trunk/daimonin/src/daieditor/CFileReader.java 2006-06-27 18:40:37 UTC (rev 212) +++ trunk/daimonin/src/daieditor/CFileReader.java 2006-06-27 19:01:38 UTC (rev 213) @@ -60,7 +60,7 @@ * Open an ascii-stream to the specified resource file. * @param dname name of directory that the file is in (<code>null</code> means the file is located in the editor root dir) * @param fname name of the resource file - * @throws FileNotFoundException In case all three tries to open the file failed + * @throws FileNotFoundException in case all three tries to open the file failed */ public CFileReader(final String dname, final String fname) throws FileNotFoundException { super(createReader(dname, fname)); @@ -95,7 +95,7 @@ * an EOFException? That's semantically wrong, but current usage code * relies on this :( */ - public static void readUntil(final BufferedReader stream, final String tag, final String abort) throws IOException, EOFException { + public static void readUntil(final BufferedReader stream, final String tag, final String abort) throws IOException { int c; // character value, read from the stream int t = 0; // tag index int a = 0; // abort index @@ -149,7 +149,7 @@ * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached */ - public static String readUntil(final BufferedReader stream, final String tag) throws IOException, EOFException { + public static String readUntil(final BufferedReader stream, final String tag) throws IOException { final StringBuilder sb = new StringBuilder(); int c; // character value, read from the stream int t = 0; // index This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-27 18:40:48
|
Revision: 212 Author: christianhujer Date: 2006-06-27 11:40:37 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=212&view=rev Log Message: ----------- Fix for #1513135: Added missing library jar for build. Added Paths: ----------- trunk/lib/LICENSE-megaxslt.jar trunk/lib/megaxslt.jar Added: trunk/lib/LICENSE-megaxslt.jar =================================================================== --- trunk/lib/LICENSE-megaxslt.jar (rev 0) +++ trunk/lib/LICENSE-megaxslt.jar 2006-06-27 18:40:37 UTC (rev 212) @@ -0,0 +1,4 @@ +MegaXSLT must only be used for building the JAPI documentation. +It is not allowed to use MegaXSLT for other purposes. +MegaXSLT comes as it is, without any implicit or explicit warrant. +USE AT YOUR OWN RISK! Property changes on: trunk/lib/LICENSE-megaxslt.jar ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/lib/megaxslt.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/megaxslt.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-27 18:27:08
|
Revision: 211 Author: akirschbaum Date: 2006-06-27 11:26:31 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=211&view=rev Log Message: ----------- Unify identifier names, white space and comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/MultiArchData.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchType.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/MultiArchData.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/arch/ArchObject.java trunk/daimonin/src/daieditor/arch/ArchObjectParser.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-27 18:26:31 UTC (rev 211) @@ -200,28 +200,28 @@ // now do the joining in all four directions: ArchObject arch = null; - if (map.pointValid(x, y - 1)) { + if (map.isPointValid(x, y - 1)) { if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { newIndex = addDir(newIndex, NORTH); connectArch(arch, nodenr[addDir(getIndex(arch.getNodeNr()), SOUTH)]); } } - if (map.pointValid(x + 1, y)) { + if (map.isPointValid(x + 1, y)) { if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { newIndex = addDir(newIndex, EAST); connectArch(arch, nodenr[addDir(getIndex(arch.getNodeNr()), WEST)]); } } - if (map.pointValid(x, y + 1)) { + if (map.isPointValid(x, y + 1)) { if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { newIndex = addDir(newIndex, SOUTH); connectArch(arch, nodenr[addDir(getIndex(arch.getNodeNr()), NORTH)]); } } - if (map.pointValid(x - 1, y)) { + if (map.isPointValid(x - 1, y)) { if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { newIndex = addDir(newIndex, WEST); connectArch(arch, nodenr[addDir(getIndex(arch.getNodeNr()), EAST)]); @@ -244,25 +244,25 @@ ArchObject arch; // temp. arch // do the joining in all four directions: - if (map.pointValid(x, y - 1)) { + if (map.isPointValid(x, y - 1)) { if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), SOUTH)]); } } - if (map.pointValid(x + 1, y)) { + if (map.isPointValid(x + 1, y)) { if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), WEST)]); } } - if (map.pointValid(x, y + 1)) { + if (map.isPointValid(x, y + 1)) { if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), NORTH)]); } } - if (map.pointValid(x - 1, y)) { + if (map.isPointValid(x - 1, y)) { if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), EAST)]); } Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-06-27 18:26:31 UTC (rev 211) @@ -139,8 +139,8 @@ archTypeText.setText("<html><font color=black>Type: " + mainControl.getArchObjectParser().getArchTypeName(arch.getArchTypNr()) + " (" + arch.getArchTypNr() + ") </font></html>"); - if (arch.getRefCount() > 0) { - archTileText.setText("<html><font color=black>Tile: </font><font color=green> multi</font><font color=black> (" + +(arch.getRefCount() + 1) + " parts) (" + (arch.getRefMaxX() - arch.getRefMaxMX() + 1) + "," + (arch.getRefMaxY() - arch.getRefMaxMY() + 1) + ")</font></html>"); + if (arch.getMultiRefCount() > 0) { + archTileText.setText("<html><font color=black>Tile: </font><font color=green> multi</font><font color=black> (" + +(arch.getMultiRefCount() + 1) + " parts) (" + (arch.getRefMaxX() - arch.getRefMaxMX() + 1) + "," + (arch.getRefMaxY() - arch.getRefMaxMY() + 1) + ")</font></html>"); } else { archTileText.setText("<html><font color=black>Tile: single" + "</font></html>"); } Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-27 18:26:31 UTC (rev 211) @@ -606,8 +606,7 @@ number++; } // check for bitmask attributes - if (!hasBitmask && - (type.getAttr()[i].getDataType() == CFArchAttrib.T_BITMASK)) { + if (!hasBitmask && type.getAttr()[i].getDataType() == CFArchAttrib.T_BITMASK) { hasBitmask = true; } } @@ -1824,8 +1823,7 @@ if (event.getStateChange() == ItemEvent.DESELECTED) { // remember the deselected type deselected = ((String) event.getItem()).trim(); - } else if (event.getStateChange() == ItemEvent.SELECTED && - !((String) event.getItem()).equals(deselected)) { + } else if (event.getStateChange() == ItemEvent.SELECTED && !event.getItem().equals(deselected)) { // new type was selected // first, get new type structure final CFArchType newType = typelist.getTypeByName((String) event.getItem()); @@ -1837,13 +1835,7 @@ deselected = frame.type.getTypeName(); } - if (JOptionPane.showConfirmDialog(frame, - "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) { + if (JOptionPane.showConfirmDialog(frame, "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) { // change is confirmed, now get it on... frame.type = newType; // set new type structure Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-27 18:26:31 UTC (rev 211) @@ -107,7 +107,6 @@ typeName = ""; typeAttributes = null; sectionNum = 2; // there's always the "general" and "special" sections (even if empty) - this.defaultArchType = defaultArchType; // set head of list } @@ -130,7 +129,6 @@ List children; // list of children elements Element elem; // xml element Attribute a1; - int i; // index if (root.getName().equalsIgnoreCase("default_type")) { // special case: default type (this one contains the default attribs) @@ -155,7 +153,7 @@ if (required != null) { children = required.getChildren(XML_ATTRIBUTE); final List<String> tmp = new ArrayList<String>(); - for (i = 0; children != null && i < children.size(); i++) { + for (int i = 0; children != null && i < children.size(); i++) { elem = (Element) children.get(i); a1 = elem.getAttribute(CFArchAttrib.XML_KEY_ARCH); final Attribute a2 = elem.getAttribute(XML_VALUE); @@ -183,7 +181,7 @@ if (signore != null) { // load all attributes in the ignore section children = signore.getChildren(XML_ATTRIBUTE); - for (i = 0; children != null && i < children.size(); i++) { + for (int i = 0; children != null && i < children.size(); i++) { elem = (Element) children.get(i); a1 = elem.getAttribute(CFArchAttrib.XML_KEY_ARCH); if (a1 == null) { @@ -195,7 +193,7 @@ // load attributes from ignore lists children = signore.getChildren("ignore_list"); - for (i = 0; children != null && i < children.size(); i++) { + for (int i = 0; children != null && i < children.size(); i++) { elem = (Element) children.get(i); a1 = elem.getAttribute("name"); if (a1 == null) { @@ -238,7 +236,7 @@ children = root.getChildren(); boolean inSection; String section = "?"; - for (i = 0; children != null && i < children.size(); i++) { + for (int i = 0; children != null && i < children.size(); i++) { elem = (Element) children.get(i); // attribute directly in type element if (elem.getName().equalsIgnoreCase(XML_ATTRIBUTE)) { @@ -360,7 +358,7 @@ } // put the list of the (non-default) CFArchAttribs into an array: - for (i = 0; numDef < j && i < attrList.size(); numDef++, i++) { + for (int i = 0; numDef < j && i < attrList.size(); numDef++, i++) { attr[numDef] = (CFArchAttrib) (attrList.elementAt(i)); } @@ -371,15 +369,14 @@ * Parse an xml attribute element. If parsing succeeds, the new CFArchAttrib is * added to the temporare linked list provided by the parameters (see below). * Assigment of sections to attributes also happens in this method. - * @param elem the xml attribute element - * @param secNames vector storing all section names - * @param inSection true if this attribute belongs to a (custom-defined) section - * @param section name of the section (only relevant if 'inSection'==true) - * @param attrList linked list of attributes - * @param tlist arch type list + * @param elem the xml attribute element + * @param secNames vector storing all section names + * @param inSection true if this attribute belongs to a (custom-defined) section + * @param section name of the section (only relevant if 'inSection'==true) + * @param attrList linked list of attributes + * @param tlist arch type list */ - private void parseAttribute(final Element elem, final Vector secNames, final boolean inSection, final String section, - final Vector attrList, final CFArchTypeList tlist) { + private void parseAttribute(final Element elem, final Vector secNames, final boolean inSection, final String section, final Vector attrList, final CFArchTypeList tlist) { // create new instance final CFArchAttrib attrib = new CFArchAttrib(); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-27 18:26:31 UTC (rev 211) @@ -1065,7 +1065,7 @@ archObjectParser.expandMulti(arch); // if there's a tail without head, we cut it out - if (arch.getRefFlag() && arch.getMapMultiHead() == null + if (arch.isReferenced() && arch.getMapMultiHead() == null && previous != null) { log.warn("Found multi-tail without head: '" + arch.getArchName() + "'"); previous.setTemp(arch.getTemp()); @@ -1353,7 +1353,7 @@ // path points to the same map if (exitPos.x == 0 && exitPos.y == 0) { showMessage("Destination Invalid", "This exit points nowhere."); - } else if (currentMap.pointValid(exitPos)) { + } else if (currentMap.isPointValid(exitPos)) { currentMap.getMapView().setHotspot(exitPos.x, exitPos.y); } else { showMessage("Destination Invalid", "The destination of this exit is outside the map."); Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-06-27 18:26:31 UTC (rev 211) @@ -307,7 +307,7 @@ if (pmap != null && pmap.getMapView().isHighlight()) { // now try to get the topmost object ArchObject arch = null; - if (pmap.pointValid(pmap.getMapView().getHighlightStart())) { + if (pmap.isPointValid(pmap.getMapView().getHighlightStart())) { arch = pmap.getMapModel().getBottomArchObject(pmap.getMapView().getHighlightStart()); } if (arch != null) { Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-27 18:26:31 UTC (rev 211) @@ -266,7 +266,7 @@ } // no single tile? - if (arch.getRefCount() > 0 || arch.getRefFlag()) { + if (arch.getMultiRefCount() > 0 || arch.isReferenced()) { return; } @@ -276,7 +276,7 @@ } // if this is a multi-tail, we put the new arch into the head's inv. - if (inv.getRefFlag() && inv.getMapMultiHead() != null) { + if (inv.isReferenced() && inv.getMapMultiHead() != null) { inv = inv.getMapMultiHead(); } @@ -286,7 +286,7 @@ invnew = mainControl.getArchObjectStack().newArchObjectInstance(arch.getNodeNr()); } else { // create clone from a pickmap - invnew = arch.getClone(inv.getMapX(), inv.getMapY()); + invnew = arch.createClone(inv.getMapX(), inv.getMapY()); } inv.addInvObj(invnew); @@ -312,7 +312,7 @@ // If the active arch is part of a multi, the mutli-head's stats // are taken instead: final ArchObject arch; - if (activeArch.getRefFlag() && activeArch.getMapMultiHead() != null) { + if (activeArch.isReferenced() && activeArch.getMapMultiHead() != null) { arch = activeArch.getMapMultiHead(); } else { arch = activeArch; @@ -707,7 +707,7 @@ // If the active arch is part of a multi, the mutli-head's stats // are displayed (Only the head can store information!). final ArchObject arch; - if (activeArch.getRefFlag() && activeArch.getMapMultiHead() != null) { + if (activeArch.isReferenced() && activeArch.getMapMultiHead() != null) { arch = activeArch.getMapMultiHead(); } else { arch = activeArch; @@ -787,7 +787,7 @@ } // check for multi tile - if (arch.getRefCount() > 0 || arch.getRefFlag()) { + if (arch.getMultiRefCount() > 0 || arch.isReferenced()) { // multi: print size archTileText.setText("Tile: " + (arch.getRefMaxX() - arch.getRefMaxMX() + 1) + "x" + (arch.getRefMaxY() - arch.getRefMaxMY() + 1)); Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-27 18:26:31 UTC (rev 211) @@ -111,7 +111,7 @@ while (it.hasNext()) { final ArchObject node = (ArchObject) it.next(); // search only for heads! - if (node.getRefCount() > 0 && node.getMapMultiNext() != null) { + if (node.getMultiRefCount() > 0 && node.getMapMultiNext() != null) { /* old version: Both heads and tails got written into the mapfile for (multi = node; ; ) { if (!writeMapArch(multi, false)) { Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-06-27 18:26:31 UTC (rev 211) @@ -372,7 +372,7 @@ public void addInvObjects(final ArchObject node, String x, String y, final int archid, final int indent) { // if this is a multi-tile, we want to show the head's inventory final Iterator it; - if (node.getRefFlag() && node.getMapMultiHead() != null) { + if (node.isReferenced() && node.getMapMultiHead() != null) { final Iterator it2 = node.getMapMultiHead().getInventory(); // we go to heads inv. if (it2.hasNext()) { final ArchObject arch = (ArchObject) it2.next(); Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-27 18:26:31 UTC (rev 211) @@ -434,41 +434,41 @@ // first look how many we need int num = 1; - if (mapControl.pointValid(arch.getMapX() + 1, arch.getMapY())) { + if (mapControl.isPointValid(arch.getMapX() + 1, arch.getMapY())) { num++; } - if (mapControl.pointValid(arch.getMapX(), arch.getMapY() + 1)) { + if (mapControl.isPointValid(arch.getMapX(), arch.getMapY() + 1)) { num++; } - if (mapControl.pointValid(arch.getMapX() - 1, arch.getMapY())) { + if (mapControl.isPointValid(arch.getMapX() - 1, arch.getMapY())) { num++; } - if (mapControl.pointValid(arch.getMapX(), arch.getMapY() - 1)) { + if (mapControl.isPointValid(arch.getMapX(), arch.getMapY() - 1)) { num++; } // now get the coordinates redraw = new Point[num]; // create instance of needed size redraw[--num] = new Point(arch.getMapX(), arch.getMapY()); // center square - if (mapControl.pointValid(arch.getMapX() + 1, arch.getMapY())) { + if (mapControl.isPointValid(arch.getMapX() + 1, arch.getMapY())) { redraw[--num] = new Point(arch.getMapX() + 1, arch.getMapY()); } - if (mapControl.pointValid(arch.getMapX(), arch.getMapY() + 1)) { + if (mapControl.isPointValid(arch.getMapX(), arch.getMapY() + 1)) { redraw[--num] = new Point(arch.getMapX(), arch.getMapY() + 1); } - if (mapControl.pointValid(arch.getMapX() - 1, arch.getMapY())) { + if (mapControl.isPointValid(arch.getMapX() - 1, arch.getMapY())) { redraw[--num] = new Point(arch.getMapX() - 1, arch.getMapY()); } - if (mapControl.pointValid(arch.getMapX(), arch.getMapY() - 1)) { + if (mapControl.isPointValid(arch.getMapX(), arch.getMapY() - 1)) { redraw[--num] = new Point(arch.getMapX(), arch.getMapY() - 1); } } else if (arch.isMulti()) { // this arch is a multi: - if (arch.getRefFlag() && arch.getMapMultiHead() != null) { + if (arch.isReferenced() && arch.getMapMultiHead() != null) { arch = arch.getMapMultiHead(); // make sure we got the head } - int num = arch.getRefCount() + 1; // get number of parts + int num = arch.getMultiRefCount() + 1; // get number of parts if (num <= 1) { // safety check return null; } @@ -538,7 +538,7 @@ if (tile.length <= 25) { for (int i = tile.length - 1; i >= 0; i--) { // paint the tiles - if (mapControl.getMapModel().pointValid(tile[i].x, tile[i].y)) { + if (mapControl.getMapModel().isPointValid(tile[i].x, tile[i].y)) { renderer.paintTile(tile[i].x, tile[i].y); } if (log.isDebugEnabled()) { @@ -774,7 +774,7 @@ final ImageIcon img = archlist.getFace(node.getFaceNr()); if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); - } else if (node.getRefCount() > 0) { + } else if (node.getMultiRefCount() > 0) { oversizedMultiHeads.addElement(node); // store oversized arches for later } } @@ -878,11 +878,11 @@ mainControl.getUnknownTileIconX().paintIcon(this, tmpGrfx, 0, 0); } else { final ImageIcon img = archlist.getFace(node.getFaceNr()); - if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32) || node.getRefCount() > 0) { + if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32) || node.getMultiRefCount() > 0) { img.paintIcon(this, tmpGrfx, 0, 0); } else { // this is an oversized image and not the head, so it must be shifted - img.paintIcon(this, tmpGrfx, -32 * node.getRefX(), -32 * node.getRefY()); + img.paintIcon(this, tmpGrfx, -32 * node.getMultiRefX(), -32 * node.getMultiRefY()); } } } @@ -1218,7 +1218,7 @@ ArchObject node = (ArchObject) it.next(); final ArchObject tmpNode; - if (node.isMulti() && node.getRefCount() == 0 && node.getMapMultiHead() != null) { + if (node.isMulti() && node.getMultiRefCount() == 0 && node.getMapMultiHead() != null) { // this is a multipart tail: tmpNode = node; // save old node node = node.getMapMultiHead(); // go to multipart head @@ -1243,7 +1243,7 @@ yoff = 0; } - if (node.isMulti() && node.getRefCount() > 0) { + if (node.isMulti() && node.getMultiRefCount() > 0) { // multipart images have to be painted with correct offset if ((tmpNode != null && tmpNode.isLowestPart()) || node.isLowestPart()) { img.paintIcon(this, grfx, xstart - MultiPositionData.getXOffset(node.getMultiShapeID(), (tmpNode == null ? node.getMultiPartNr() : tmpNode.getMultiPartNr())), @@ -1862,7 +1862,7 @@ if (insertAllowed) { if (!newarch.isMulti()) { // insert single tile from pickmap - newarch = newarch.getClone(pos.x, pos.y); + newarch = newarch.createClone(pos.x, pos.y); mapControl.addArchObjectToMap(newarch); needRedraw = calcArchRedraw(newarch); } else { @@ -1911,14 +1911,14 @@ final MapControl currentMap = mainControl.getCurrentMap(); // insertion is only allowed for valid *empty* squares - if (currentMap != null && mapControl.isPickmap() && mapControl.pointValid(pos) + if (currentMap != null && mapControl.isPickmap() && mapControl.isPointValid(pos) && !mapControl.containsArchObject(pos)) { // get the currently selected map arch ArchObject newarch = mainControl.getMainView().getMapTileSelection(); if (newarch != null) { if (!newarch.isMulti()) { // insert single tile from pickmap - newarch = newarch.getClone(pos.x, pos.y); + newarch = newarch.createClone(pos.x, pos.y); mapControl.addArchObjectToMap(newarch); needRedraw = calcArchRedraw(newarch); } else { @@ -1932,7 +1932,7 @@ final Point d = new Point(); for (d.x = pos.x; d.x - pos.x <= newarch.getRefMaxX(); d.x++) { for (d.y = pos.y; d.y - pos.y <= newarch.getRefMaxY(); d.y++) { - if (!mapControl.pointValid(d) || mapControl.containsArchObject(d)) { + if (!mapControl.isPointValid(d) || mapControl.containsArchObject(d)) { allSpacesFree = false; } } Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-06-27 18:26:31 UTC (rev 211) @@ -173,10 +173,10 @@ // (for multiparts, only the heads get copied into the buffer) // arches that don't match the view settings are ignored! if ((mode == DO_CUT || mode == DO_COPY) && - !arch.getRefFlag() && arch.getContainer() == null && + !arch.isReferenced() && arch.getContainer() == null && (mainControl.getTileEdit() == 0 || mainControl.isTileEdit(arch.getEditType()))) { // copy this arch - final ArchObject clone = arch.getClone(Math.abs(pos.x - startp.x), Math.abs(pos.y - startp.y)); + final ArchObject clone = arch.createClone(Math.abs(pos.x - startp.x), Math.abs(pos.y - startp.y)); buffCtrl.addArchObjectToMap(clone); } @@ -189,8 +189,8 @@ // delete arch (without redrawing the map) // For CUT we don't delete multi tails of multis which are left or // above the head (we would miss to copy them otherwise). - if (mode == DO_CLEAR || !arch.isMulti() || arch.getRefCount() > 0 || - (arch.getMapMultiHead() != null && arch.getRefX() >= 0 && arch.getRefY() >= 0)) { + if (mode == DO_CLEAR || !arch.isMulti() || arch.getMultiRefCount() > 0 || + (arch.getMapMultiHead() != null && arch.getMultiRefX() >= 0 && arch.getMultiRefY() >= 0)) { it.remove(); } } @@ -221,7 +221,7 @@ for (pos.x = startp.x; Math.abs(pos.x - startp.x) < bufWidth; pos.x++) { for (pos.y = startp.y; Math.abs(pos.y - startp.y) < bufHeight; pos.y++) { // paste the archs if on the map: - if (mapControl.pointValid(pos)) { + if (mapControl.isPointValid(pos)) { sourcePos.x = pos.x - startp.x; sourcePos.y = pos.y - startp.y; final Iterator<ArchObject> it = buffCtrl.getArchObjects(sourcePos); @@ -229,7 +229,7 @@ final ArchObject arch = it.next(); if (!arch.isMulti()) { // read arch from buffer and stick in on the map - final ArchObject clone = arch.getClone(pos.x, pos.y); + final ArchObject clone = arch.createClone(pos.x, pos.y); mapControl.addArchObjectToMap(clone); } } @@ -241,15 +241,15 @@ for (pos.x = startp.x; Math.abs(pos.x - startp.x) < bufWidth; pos.x++) { for (pos.y = startp.y; Math.abs(pos.y - startp.y) < bufHeight; pos.y++) { // paste the archs if on the map: - if (mapControl.pointValid(pos)) { + if (mapControl.isPointValid(pos)) { sourcePos.x = pos.x - startp.x; sourcePos.y = pos.y - startp.y; final Iterator<ArchObject> it = buffCtrl.getArchObjects(sourcePos); while (it.hasNext()) { final ArchObject arch = it.next(); - if (arch.getRefCount() > 0) { + if (arch.getMultiRefCount() > 0) { // first we clone the head - final ArchObject clone = arch.getClone(pos.x, pos.y); + final ArchObject clone = arch.createClone(pos.x, pos.y); // second we insert a default multi on the map if (mapControl.addArchToMap(arch.getNodeNr(), pos, -1, MapModel.JOIN_DISABLE)) { @@ -355,7 +355,7 @@ MapModel.JOIN_DISABLE, fillBelow); } else { // insert arch-clone from pickmap - mapControl.addArchObjectToMap(arch.getClone(pos.x, pos.y), fillBelow); + mapControl.addArchObjectToMap(arch.createClone(pos.x, pos.y), fillBelow); } } } @@ -385,20 +385,20 @@ mapControl.addArchToMap(arch.getNodeNr(), p, 0, MapModel.JOIN_DISABLE); } else { // insert arch-clone from pickmap - mapControl.addArchObjectToMap(arch.getClone(x, y)); + mapControl.addArchObjectToMap(arch.createClone(x, y)); } // now go recursive into all four directions - if (mapControl.pointValid(x - 1, y) && !mapControl.containsArchObject(x - 1, y)) { + if (mapControl.isPointValid(x - 1, y) && !mapControl.containsArchObject(x - 1, y)) { floodfill(mapControl, x - 1, y, arch, isDefarch); } - if (mapControl.pointValid(x, y - 1) && !mapControl.containsArchObject(x, y - 1)) { + if (mapControl.isPointValid(x, y - 1) && !mapControl.containsArchObject(x, y - 1)) { floodfill(mapControl, x, y - 1, arch, isDefarch); } - if (mapControl.pointValid(x + 1, y) && !mapControl.containsArchObject(x + 1, y)) { + if (mapControl.isPointValid(x + 1, y) && !mapControl.containsArchObject(x + 1, y)) { floodfill(mapControl, x + 1, y, arch, isDefarch); } - if (mapControl.pointValid(x, y + 1) && !mapControl.containsArchObject(x, y + 1)) { + if (mapControl.isPointValid(x, y + 1) && !mapControl.containsArchObject(x, y + 1)) { floodfill(mapControl, x, y + 1, arch, isDefarch); } } Modified: trunk/crossfire/src/cfeditor/MultiArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiArchData.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/MultiArchData.java 2006-06-27 18:26:31 UTC (rev 211) @@ -36,7 +36,7 @@ */ public final class MultiArchData { - private boolean refflag; // true: this arch is a part of the tail - NOT the head + private boolean referenced; // true: this arch is a part of the tail - NOT the head private int refnr; // if != -1 - multi tile @@ -53,7 +53,7 @@ private int refmaxy; // head: parts in y - private int refmaxxm; // head: parts in x to count minus ref + private int refmaxxm; // head: parts in x to count minus referenced private int refmaxym; // head: parts in y sic @@ -71,7 +71,7 @@ public MultiArchData() { refmaxx = refmaxy = 0; refnr = -1; - refflag = false; + referenced = false; refcount = 0; head = nextref = null; isLowestPart = false; @@ -87,7 +87,7 @@ public MultiArchData getClone() { final MultiArchData clone = new MultiArchData(); - clone.refflag = refflag; // true: this arch is a multi tile part + clone.referenced = referenced; // true: this arch is a multi tile part // and NOT the head clone.refnr = refnr; // if != -1 - multi tile; if refnr == nodenr then first tile // else refnr==first tile; multi tile: offset pos from head @@ -95,7 +95,7 @@ clone.refcount = refcount; // head: number of parts clone.refmaxx = refmaxx; // head: parts in x clone.refmaxy = refmaxy; // head: parts in y - clone.refmaxxm = refmaxxm; // head: parts in x to count minus ref + clone.refmaxxm = refmaxxm; // head: parts in x to count minus referenced clone.refmaxym = refmaxym; // head: parts in y sic clone.multiShapeID = multiShapeID; // ID for the multiPositionData clone.multiPartNr = multiPartNr; // part number for the multiPositionData @@ -105,20 +105,20 @@ } // --- GET/SET methods --- - public boolean getRefflag() { - return refflag; + public boolean isReferenced() { + return referenced; } - public void setRefflag(final boolean state) { - refflag = state; + public void setReferenced(final boolean referenced) { + this.referenced = referenced; } public boolean isLowestPart() { return isLowestPart; } - public void setLowestPart(final boolean state) { - isLowestPart = state; + public void setLowestPart(final boolean lowestPart) { + isLowestPart = lowestPart; } public int getRefNr() { @@ -145,12 +145,12 @@ refy = value; } - public int getRefCount() { + public int getMultiRefCount() { return refcount; } - public void setRefCount(final int value) { - refcount = value; + public void setMultiRefCount(final int refcount) { + this.refcount = refcount; } public int getRefMaxx() { @@ -189,8 +189,8 @@ return multiShapeID; } - public void setMultiShapeID(final int value) { - multiShapeID = value; + public void setMultiShapeID(final int multiShapeID) { + this.multiShapeID = multiShapeID; } public int getMultiPartNr() { Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-06-27 18:26:31 UTC (rev 211) @@ -328,7 +328,7 @@ final Iterator<ArchObject> it = mapControl.getArchObjectsDeleteMapArch(pos, false, false); while (it.hasNext()) { final ArchObject node = it.next(); - if ((!node.isMulti() || node.getRefCount() > 0) && + if ((!node.isMulti() || node.getMultiRefCount() > 0) && ((matchCriteria == MATCH_ARCH_NAME && node.getArchName() != null && node.getArchName().equalsIgnoreCase(matchString)) || (matchCriteria == MATCH_OBJ_NAME && @@ -341,7 +341,7 @@ // insert replacement object if (replaceArch.isMulti()) { // multi's cannot be inserted properly, so we just put them ontop - if (replaceArch.getRefCount() == 0 && replaceArch.getMapMultiHead() != null) { + if (replaceArch.getMultiRefCount() == 0 && replaceArch.getMapMultiHead() != null) { replaceArch = replaceArch.getMapMultiHead(); } mapControl.addArchToMap(replaceArch.getNodeNr(), pos, 0, false); Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-06-27 18:26:31 UTC (rev 211) @@ -344,8 +344,7 @@ // find out if the scriptfile is in a subdirectory of the map file File tmp; - for (tmp = f.getParentFile(); tmp != null && !tmp.getAbsolutePath().equalsIgnoreCase(localMapDir.getAbsolutePath()); - tmp = tmp.getParentFile()) { + for (tmp = f.getParentFile(); tmp != null && !tmp.getAbsolutePath().equalsIgnoreCase(localMapDir.getAbsolutePath()); tmp = tmp.getParentFile()) { ; } Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-27 18:26:31 UTC (rev 211) @@ -60,7 +60,7 @@ private static ArchObjectStack archstack; /** Static reference to the typeList (find syntax errors). */ - private static CFArchTypeList typelist; + private static CFArchTypeList typeList; private static int myIdCounter = 0; @@ -195,13 +195,13 @@ editType = 0; } - // set static references: arch stack and typelist + // set static references: arch stack and typeList public static void setArchStack(final ArchObjectStack stack) { archstack = stack; } public static void setTypeList(final CFArchTypeList tlist) { - typelist = tlist; + typeList = tlist; } /** @@ -705,17 +705,17 @@ } } - public void setRefFlag(final boolean bool) { + public void setReferenced(final boolean referenced) { //if (multi == null) { // multi = new MultiArchData(); //} - multi.setRefflag(bool); + multi.setReferenced(referenced); } - public boolean getRefFlag() { + public boolean isReferenced() { if (multi != null) { - return multi.getRefflag(); + return multi.isReferenced(); } return false; @@ -846,51 +846,52 @@ multi.setRefY(yoff); } - public int getRefX() { - if (multi != null) { - return multi.getRefX(); - } - - return 0; + /** + * Get the multitile arch offset. + * @return multitile arch x offset or 0 on multitile heads and singletile + * arches + */ + public int getMultiRefX() { + return multi != null ? multi.getRefX() : 0; } - public int getRefY() { - if (multi != null) { - return multi.getRefY(); - } - - return 0; + /** + * Get the multitile arch offset. + * @return multitile arch y offset or 0 on multitile heads and singletile + * arches + */ + public int getMultiRefY() { + return multi != null ? multi.getRefY() : 0; } - public void setRefCount(final int count) { + public void setMultiRefCount(final int count) { if (multi == null) { if (count != 0) { multi = new MultiArchData(); - multi.setRefCount(count); + multi.setMultiRefCount(count); } } else { - multi.setRefCount(count); + multi.setMultiRefCount(count); } } /** - * Returns number of parts for multipart heads. - * (*.getRefCount() > 0) is often used as way to find multi-heads. + * Returns number of parts for multipart heads. (*.getMultiRefCount() > 0) + * is often used as way to find multi-heads. * @return number of parts */ - public int getRefCount() { - if (multi != null) { - return multi.getRefCount(); - } - - return 0; + public int getMultiRefCount() { + return multi != null ? multi.getMultiRefCount() : 0; } public boolean isMD() { return multi != null; } - /** Initialize the multipart data object - must only be called for multipart arches */ + /** + * Initialize the multipart data object - must only be called for multipart + * arches. + */ public void initMultiData() { if (multi == null) { multi = new MultiArchData(); @@ -978,10 +979,10 @@ /** * Sets arch name. - * @param name arch name + * @param archName arch name */ - public void setArchName(final String name) { - archName = name != null ? name.intern() : null; + public void setArchName(final String archName) { + this.archName = archName != null ? archName.intern() : null; } /** @@ -1013,8 +1014,8 @@ } // Obj name - public void setObjName(final String name) { - objName = name != null ? name.intern() : null; + public void setObjName(final String objName) { + this.objName = objName != null ? objName.intern() : null; } public String getObjName() { @@ -1040,11 +1041,11 @@ /** * Set <var>text</var> as arch text of this arch. - * @param text text to set as arch text + * @param archText text to set as arch text */ - public void setArchText(final String text) { - archText.delete(0, archText.length()); - archText.append(text); + public void setArchText(final String archText) { + this.archText.delete(0, this.archText.length()); + this.archText.append(archText); clearCachedAttributeValue(); } @@ -1197,11 +1198,7 @@ * @return message text */ @Nullable public String getMsgText() { - if (msgText == null) { - return null; - } - - return msgText.toString(); + return msgText != null ? msgText.toString() : null; } // ANIMText! @@ -1256,7 +1253,7 @@ * @param posy map y coords. for the returned clone * @return clone instance of this <code>ArchObject</code> */ - public ArchObject getClone(final int posx, final int posy) { + public ArchObject createClone(final int posx, final int posy) { final ArchObject clone = new ArchObject(); // The clone is a new object! clone.faceName = faceName; // face name @@ -1311,7 +1308,7 @@ final Iterator<ArchObject> it = inv.iterator(); while (it.hasNext()) { final ArchObject tmp = it.next(); - clone.addInvObj(tmp.getClone(posx, posy)); + clone.addInvObj(tmp.createClone(posx, posy)); } return clone; @@ -1327,7 +1324,7 @@ /** @return true if 'this' arch is part of a multisquare object */ public boolean isMulti() { - return multi != null && (multi.getRefflag() || multi.getRefCount() > 0); + return multi != null && (multi.isReferenced() || multi.getMultiRefCount() > 0); } public void addEventPlugin(final String eventType, final String pluginName) { @@ -1448,7 +1445,7 @@ */ @Nullable public String getSyntaxErrors(CFArchType type) { - if (typelist != null && archText != null && archText.length() > 0) { + if (typeList != null && archText != null && archText.length() > 0) { String errors = ""; // return value: all error lines // open a reading stream for the archText @@ -1458,7 +1455,7 @@ try { if (type == null) { - type = typelist.getTypeOfArch(this); // the type of this arch + type = typeList.getTypeOfArch(this); // the type of this arch } if (LOG.isDebugEnabled()) { Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-27 18:26:31 UTC (rev 211) @@ -198,7 +198,7 @@ if (defArch == null) { arch = new ArchObject(); } else { - arch = defArch.getClone(0, 0); + arch = defArch.createClone(0, 0); } arch.resetArchText(); @@ -235,7 +235,7 @@ firstArch = mainControl.getArchCount() - 1; // if more && !-1 last was first mainControl.getArch(firstArch).setRefNr(firstArch); } - mainControl.getArch(firstArch).setRefCount(mainControl.getArch(firstArch).getRefCount() + 1); + mainControl.getArch(firstArch).setMultiRefCount(mainControl.getArch(firstArch).getMultiRefCount() + 1); archmore = true; } else if (thisLine.regionMatches(0, "Object", 0, 6)) { @@ -298,9 +298,9 @@ arch.setRefNr(firstArch); if (firstArch != -1) { // add to head our x/y position so he can setup refmax - mainControl.getArch(firstArch).setRefMaxX(arch.getRefX()); - mainControl.getArch(firstArch).setRefMaxY(arch.getRefY()); - arch.setRefFlag(true); // mark it as ref + mainControl.getArch(firstArch).setRefMaxX(arch.getMultiRefX()); + mainControl.getArch(firstArch).setRefMaxY(arch.getMultiRefY()); + arch.setReferenced(true); // mark it as ref } else { mainControl.incArchObjCount(); @@ -526,7 +526,7 @@ * if null, copy the default text in arch, so the user can see and edit it * if at save time msg-maparch == msg-default, we ignore it * in every other case (even "" text) we save - * @param arch map arch to be parsed + * @param arch map arch to be parsed * @param editType edit type(s) to be calculated for the arch */ public void postParseMapArch(final ArchObject arch, final int editType) { @@ -566,19 +566,20 @@ } if (arch.isMulti() || defarch.isMulti()) { - if (!arch.isMD()) { // make sure the MultiArchData is initialized - arch.initMultiData(); + if (!arch.isMD()) { + arch.initMultiData(); // make sure the MultiArchData is initialized } - arch.setRefCount(defarch.getRefCount()); - arch.setRefFlag(defarch.getRefFlag()); + arch.setMultiRefCount(defarch.getMultiRefCount()); + arch.setReferenced(defarch.isReferenced()); arch.setRefMaxX(defarch.getRefMaxX()); arch.setRefMaxY(defarch.getRefMaxY()); arch.setRefMaxMX(defarch.getRefMaxMX()); arch.setRefMaxMY(defarch.getRefMaxMY()); - arch.setRefX(defarch.getRefX()); - arch.setRefY(defarch.getRefY()); + arch.setRefX(defarch.getMultiRefX()); + arch.setRefY(defarch.getMultiRefY()); } + // arch.setEditType(defarch.getEditType()); // validate the ScriptedEvents @@ -592,7 +593,7 @@ } // Finally, we calculate the desired editType of the arch - if (arch.getRefFlag() && arch.getMapMultiHead() != null) { + if (arch.isReferenced() && arch.getMapMultiHead() != null) { arch.setEditType(arch.getMapMultiHead().getEditType()); // copy from head } else if (editType != 0) { arch.setEditType(arch.calculateEditType(editType)); // calculate new @@ -611,11 +612,11 @@ final ArchObject defarch = mainControl.getArch(arch.getNodeNr()); // default arch // is it a multi head? - if (arch != null && defarch != null && defarch.getRefCount() > 0 && + if (arch != null && defarch != null && defarch.getMultiRefCount() > 0 && arch.getMapMultiNext() == null && arch.getMapMultiHead() == null) { // we have a multi head and need to insert his tail now - final int count = defarch.getRefCount(); // how many parts have we got + final int count = defarch.getMultiRefCount(); // how many parts have we got ArchObject newarch = null; // newly inserted arch ArchObject oldarch = arch; // previous arch final ArchObject tmpNext = arch.getTemp(); // next arch on tmp list after multi @@ -630,8 +631,8 @@ oldarch.setTemp(newarch); // attach to temp list // set map position (x, y) - newarch.setMapX(arch.getMapX() + mainControl.getArchObjectStack().getArch(defarch.getNodeNr() + c).getRefX()); - newarch.setMapY(arch.getMapY() + mainControl.getArchObjectStack().getArch(defarch.getNodeNr() + c).getRefY()); + newarch.setMapX(arch.getMapX() + mainControl.getArchObjectStack().getArch(defarch.getNodeNr() + c).getMultiRefX()); + newarch.setMapY(arch.getMapY() + mainControl.getArchObjectStack().getArch(defarch.getNodeNr() + c).getMultiRefY()); oldarch = newarch; // next loop oldarch = current newarch @@ -675,7 +676,7 @@ } // if the last arch is a multi, it must be the head, not the tail - if (lastBefore.getRefFlag() && lastBefore.getMapMultiHead() != null) { + if (lastBefore.isReferenced() && lastBefore.getMapMultiHead() != null) { lastBefore = lastBefore.getMapMultiHead(); } @@ -689,7 +690,7 @@ ArchObject previous = null; boolean increment = true; for (ArchObject tmp = start; tmp != null && tmp != lastBefore;) { - if (tmp.getRefCount() > 0 && tmp.getMapMultiNext() != null) { + if (tmp.getMultiRefCount() > 0 && tmp.getMapMultiNext() != null) { // Got a multi head - Now we move his ass to the end of the list: last.setTemp(tmp); // attach the head to the end for (; tmp.getMapMultiNext() != null; tmp = tmp.getMapMultiNext()) { @@ -747,7 +748,7 @@ int t; // tmp. storage // 1.step: find the maximal y-offest - while (tmp.getRefCount() <= 0 && tmp.getNodeNr() > 0) { + while (tmp.getMultiRefCount() <= 0 && tmp.getNodeNr() > 0) { t = MultiPositionData.getYOffset(tmp.getMultiShapeID(), tmp.getMultiPartNr()); if (t < minYOffset) { minYOffset = t; Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-27 18:26:31 UTC (rev 211) @@ -672,7 +672,7 @@ arch = mainControl.getArch(numList[i]); - if (arch.getRefFlag()) { + if (arch.isReferenced()) { LOG.error("Collect Error: Multipart Tail in Panel found!"); } @@ -708,13 +708,13 @@ } // if multi-head, we must attach the tail - if (arch.getRefCount() > 0) { + if (arch.getMultiRefCount() > 0) { // process the multipart tail: - multiparts = arch.getRefCount(); + multiparts = arch.getMultiRefCount(); for (int j = 1; j <= multiparts; j++) { arch = mainControl.getArch(numList[i] + j); - if (!arch.getRefFlag()) { + if (!arch.isReferenced()) { LOG.warn("Multipart object is too short!"); final ArchObject before = mainControl.getArch(numList[i]); if (before != null) { @@ -746,12 +746,12 @@ } // position of multi relative to head - if (arch.getRefFlag()) { - if (arch.getRefX() != 0) { - binFile.writeBytes("x " + arch.getRefX() + "\n"); + if (arch.isReferenced()) { + if (arch.getMultiRefX() != 0) { + binFile.writeBytes("x " + arch.getMultiRefX() + "\n"); } - if (arch.getRefY() != 0) { - binFile.writeBytes("y " + arch.getRefY() + "\n"); + if (arch.getMultiRefY() != 0) { + binFile.writeBytes("y " + arch.getMultiRefY() + "\n"); } } binFile.writeBytes("end\n"); @@ -779,8 +779,8 @@ // part arches - i include this hack until we rework the // arch objects with more useful script names if (arch.getArchName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { - binFile.writeBytes("x " + arch.getRefX() + "\n"); - binFile.writeBytes("y " + arch.getRefY() + "\n"); + binFile.writeBytes("x " + arch.getMultiRefX() + "\n"); + binFile.writeBytes("y " + arch.getMultiRefY() + "\n"); } if (arch.getObjName() != null) { Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-26 13:55:52 UTC (rev 210) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-27 18:26:31 UTC (rev 211) @@ -50,7 +50,7 @@ private static final Logger log = Logger.getLogger(DefaultMapModel.class); - /** The MapArchObject; it contains global map attributes. */ + /** The Map Arch Object with the meta information about the map. */ private final MapArchObject mapArch; /** @@ -68,7 +68,7 @@ /** CMainControl. */ private final CMainControl mainControl; - /** MapControl. */ + /** The MapControl that controls this MapModel. */ private final MapControl mapControl; /** @@ -94,7 +94,7 @@ @Nullable public ArchObject getMouseRightPosObject() { final Point pos = mapControl.getMapView().getMapMouseRightPos(); - if (pos.x == -1 || pos.y == -1 || !pointValid(pos)) { + if (pos.x == -1 || pos.y == -1 || !isPointValid(pos)) { return null; } @@ -132,16 +132,22 @@ } } - /** Notifies that the application is about to exit. */ + /** + * Notify that the application is about to exit. + */ public void appExitNotify() { } - /** Notifies that the level is about to be closed. */ + /** + * Notify that the level is about to be closed. + */ public void levelCloseNotify() { freeMapArchObject(); } - /** Reset the level changed flag to false. */ + /** + * Reset the level changed flag to false. + */ public void resetLevelChangedFlag() { if (!levelChanged) { return; @@ -154,7 +160,9 @@ } } - /** Set the level changed flag to true. */ + /** + * Set the level changed flag to true. + */ public void setLevelChangedFlag() { if (levelChanged) { return; @@ -202,7 +210,7 @@ * @return the ArchObject, or null if no object is present */ @Nullable public ArchObject getBottomArchObject(final Point pos) { - if (!pointValid(pos)) { + if (!isPointValid(pos)) { return null; } @@ -231,7 +239,7 @@ /** Save a map square to the given ArchObject. */ public void setArchObject(final Point pos, final ArchObject arch) { - if (!pointValid(pos)) { + if (!isPointValid(pos)) { throw new IllegalArgumentException(); } if (arch == null) { @@ -281,7 +289,7 @@ /** Check whether a given location contains at least one ArchObject. */ public boolean containsArchObject(final Point pos) { - return pointValid(pos) && mapGrid[pos.x][pos.y] != null; + return isPointValid(pos) && mapGrid[pos.x][pos.y] != null; } /** @@ -308,11 +316,11 @@ * @param intern ??? */ private boolean testArchToMap(final int archnr, final int xx, final int yy, final int intern) { - final int count = mainControl.getArchObjectStack().getArch(archnr).getRefCount(); // count of multi tile. 0= single tile + final int count = mainControl.getArchObjectStack().getArch(archnr).getMultiRefCount(); // count of multi tile. 0= single tile f... [truncated message content] |
From: <chr...@us...> - 2006-06-26 13:56:06
|
Revision: 210 Author: christianhujer Date: 2006-06-26 06:55:52 -0700 (Mon, 26 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=210&view=rev Log Message: ----------- Minor icon improvements. Modified Paths: -------------- trunk/daimonin/resource/toolbarButtonGraphics/misc/Select16.gif trunk/daimonin/resource/toolbarButtonGraphics/navigation/Bottom16.gif trunk/daimonin/resource/toolbarButtonGraphics/navigation/Top16.gif Modified: trunk/daimonin/resource/toolbarButtonGraphics/misc/Select16.gif =================================================================== (Binary files differ) Modified: trunk/daimonin/resource/toolbarButtonGraphics/navigation/Bottom16.gif =================================================================== (Binary files differ) Modified: trunk/daimonin/resource/toolbarButtonGraphics/navigation/Top16.gif =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |