From: <aki...@us...> - 2006-09-24 15:27:59
|
Revision: 389 http://svn.sourceforge.net/gridarta/?rev=389&view=rev Author: akirschbaum Date: 2006-09-24 08:27:44 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Some unification changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/daimonin/src/daieditor/CArchQuickView.java trunk/daimonin/src/daieditor/MultiPositionData.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/arch/ArchObjectParser.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 15:27:44 UTC (rev 389) @@ -159,7 +159,7 @@ * @param defaobj the default ArchObject of 'arch' * @param mainControl main control */ - CAttribDialog(final CFArchTypeList atList, final ArchObject aobj, final ArchObject defaobj, final CMainControl mainControl) { + CAttribDialog(final CFArchTypeList atList, final ArchObject aobj, final CMainControl mainControl) { super(mainControl.getMainView(), "CF Attribute Dialog", false); // when close-box is selected, execute the 'closeDialog' method and nothing else @@ -179,13 +179,8 @@ CAttribDialog.setDefaultBounds(); // set width/height etc // reference to the ArchObject - if (aobj.isTail()) { - arch = aobj.getHead(); - defarch = this.mainControl.getArchObjectStack().getArch(arch.getNodeNr()); - } else { - arch = aobj; - defarch = defaobj; // reference to the default ArchObject - } + arch = aobj.getHead(); + defarch = arch.getDefaultArch(); /* set frame icon if (arch.getFaceNr() >= 0) { Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 15:27:44 UTC (rev 389) @@ -1019,7 +1019,7 @@ // types.txt is missing! showMessage("File Missing", "The definitions-file \"types.txt\" is missing! The\nattribute interface doesn't work without that file."); } else if (arch != null && arch.getNodeNr() != -1) { - final CAttribDialog dwin = new CAttribDialog(typelist, arch, getArch(arch.getNodeNr()), this); + final CAttribDialog dwin = new CAttribDialog(typelist, arch, this); } } Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 15:27:44 UTC (rev 389) @@ -267,7 +267,7 @@ } // no single tile? - if (arch.isMulti() || arch.isTail()) { + if (arch.isMulti()) { return; } @@ -776,7 +776,7 @@ } // check for multi tile - if (arch.isMulti() || arch.isTail()) { + if (arch.isMulti()) { // multi: print size archTileText.setText("Tile: " + arch.getSizeX() + "x" + arch.getSizeY()); } else { Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-24 15:27:44 UTC (rev 389) @@ -364,18 +364,17 @@ for (ArchObject tmp = arch.getDefaultArch().getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { final ArchObject newTail = mainControl.getArchObjectStack().newArchObjectInstance(tmp.getNodeNr()); - final int mapx = pos.x + newTail.getMultiX(); - final int mapy = pos.y + newTail.getMultiY(); + final Point mapPos = new Point(pos.x + newTail.getMultiX(), pos.y + newTail.getMultiY()); - if (!mapControl.isPointValid(mapx, mapy)) { + if (!mapControl.isPointValid(mapPos)) { // outside map return; } newTail.setMultiX(tmp.getMultiX()); newTail.setMultiY(tmp.getMultiY()); - newTail.setMapX(mapx); - newTail.setMapY(mapy); + newTail.setMapX(mapPos.x); + newTail.setMapY(mapPos.y); newHead.addTailPart(newTail); } Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-09-24 15:27:44 UTC (rev 389) @@ -566,7 +566,7 @@ final ArchObject defarch = mainControl.getArch(arch.getNodeNr()); // default arch // is it a multi head? - if (defarch != null && defarch.isMulti() && !arch.isMulti()) { + if (defarch != null && defarch.isMulti() && arch.getMultiRefCount() <= 1) { // we have a multi head and need to insert his tail now // do insertion for all non-head parts of the multi Modified: trunk/daimonin/src/daieditor/CArchQuickView.java =================================================================== --- trunk/daimonin/src/daieditor/CArchQuickView.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/daimonin/src/daieditor/CArchQuickView.java 2006-09-24 15:27:44 UTC (rev 389) @@ -129,7 +129,7 @@ archTypeText.setText(mainControl.getTypeList().getArchTypeName(arch.getArchTypNr()) + " (" + arch.getArchTypNr() + ')'); - if (arch.getMultiRefCount() > 0) { + if (arch.isMulti()) { archTileText.setText("<html><span style=\"color:green;\"> multi</span> (" + arch.getMultiRefCount() + " parts) (" + arch.getSizeX() + ',' + arch.getSizeY() + ")</html>"); } else { archTileText.setText("single"); Modified: trunk/daimonin/src/daieditor/MultiPositionData.java =================================================================== --- trunk/daimonin/src/daieditor/MultiPositionData.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/daimonin/src/daieditor/MultiPositionData.java 2006-09-24 15:27:44 UTC (rev 389) @@ -46,7 +46,7 @@ public static final int Y_DIM = 16; - private static MultiPositionData instance; + private static MultiPositionData instance = null; /** array with position data */ private final int[][] data; Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-09-24 15:27:44 UTC (rev 389) @@ -315,7 +315,7 @@ final int replaceListSize = replaceList == null ? 0 : replaceList.size(); for (MapSquare square : entireMap ? mapControl.getMapModel() : mapViewIFrame.getView().getSelectedSquares()) { for (ArchObject node : square) { - if ((!node.isMulti() || node.isHead()) + if (!node.isMulti() && (matchCriteria == MATCH_ARCH_NAME && node.getArchName() != null && node.getArchName().equalsIgnoreCase(matchString) || matchCriteria == MATCH_OBJ_NAME && node.getBestName().equalsIgnoreCase(matchString))) { if (replaceListSize > 0 && !deleteOnly) { Modified: trunk/daimonin/src/daieditor/arch/ArchObjectParser.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectParser.java 2006-09-24 14:41:10 UTC (rev 388) +++ trunk/daimonin/src/daieditor/arch/ArchObjectParser.java 2006-09-24 15:27:44 UTC (rev 389) @@ -560,6 +560,7 @@ // is it a multi head? if (defarch != null && defarch.isMulti() && arch.getMultiRefCount() <= 1) { + // we have a multi head and need to insert his tail now // do insertion for all non-head parts of the multi for (ArchObject oldPart = defarch.getMultiNext(); oldPart != null; oldPart = oldPart.getMultiNext()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-09-24 17:17:18
|
Revision: 401 http://svn.sourceforge.net/gridarta/?rev=401&view=rev Author: christianhujer Date: 2006-09-24 10:15:52 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Renamed ArchObjectStack to ArchetypeSet. Renamed ArchObject to GameObject (missing part of previous commit). Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/ExitTypes.java trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/crossfire/src/cfeditor/MultiArchData.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/crossfire/src/cfeditor/filter/Filter.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/gui/ArchComboBox.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/crossfire/src/cfeditor/parameter/ArchParameter.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/arch/ArchObjectParser.java trunk/daimonin/src/daieditor/arch/GameObject.java trunk/daimonin/src/daieditor/map/MapModel.java Added Paths: ----------- trunk/crossfire/src/cfeditor/arch/ArchetypeSet.java trunk/crossfire/src/cfeditor/arch/GameObject.java trunk/crossfire/src/cfeditor/arch/GameObjectIterator.java trunk/crossfire/src/cfeditor/arch/GameObjectIteratorDeleteGameMapObject.java trunk/crossfire/src/cfeditor/arch/GameObjectIteratorDeleteMapGame.java trunk/daimonin/src/daieditor/arch/ArchetypeSet.java trunk/src/app/net/sf/gridarta/arch/GameObject.java Removed Paths: ------------- 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/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java trunk/src/app/net/sf/gridarta/arch/ArchObject.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,10 +24,9 @@ package cfeditor; -import cfeditor.arch.ArchObject; -import cfeditor.arch.ArchObjectStack; +import cfeditor.arch.GameObject; +import cfeditor.arch.ArchetypeSet; import cfeditor.map.MapModel; -import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.log4j.Logger; @@ -54,7 +53,7 @@ private static final int WEST = 8; - private ArchObjectStack stack; // reference to the stack of default arches + private ArchetypeSet stack; // reference to the stack of default arches private AutojoinList next; // next autojoin list @@ -83,7 +82,7 @@ * @param archstack the stack of default arches * @return true if at least one autojoin list was successfully loaded */ - public boolean loadList(final ArchObjectStack archstack) { + public boolean loadList(final ArchetypeSet archstack) { boolean success = false; // return value (true if >= 1 list loaded) try { @@ -141,7 +140,7 @@ // add a new archid to the buffer // try to parse the arch node_nr from the hashtable - final int entry = ArchObjectStack.getArchIndex(line); + final int entry = ArchetypeSet.getArchIndex(line); if (entry != -1) { nbuf[count] = entry; @@ -200,7 +199,7 @@ } // now do the joining in all four directions: - ArchObject arch = null; + GameObject arch = null; if (map.isPointValid(x, y - 1)) { if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { newIndex = addDir(newIndex, NORTH); @@ -233,7 +232,7 @@ } /** - * Do autojoining on deletion of an ArchObject on the map. + * Do autojoining on deletion of an GameObject on the map. * All arches around the insert point get adjusted. * This method must be called from the appropriate element of the * AutojoinList, best use the link from the default arch. @@ -242,7 +241,7 @@ * @param map Data model of the map */ public void joinDelete(final MapModel map, final int x, final int y) { - ArchObject arch; // temp. arch + GameObject arch; // temp. arch // do the joining in all four directions: if (map.isPointValid(x, y - 1)) { @@ -313,8 +312,8 @@ * @param y location to search * @return arch which is part of this joinlist, null if no such arch exists */ - @Nullable private ArchObject findArchOfJoinlist(final MapModel map, final int x, final int y) { - ArchObject tmpArch = map.getTopArchObject(x, y); + @Nullable private GameObject findArchOfJoinlist(final MapModel map, final int x, final int y) { + GameObject tmpArch = map.getTopArchObject(x, y); // we look through the arches at the given location (top to bottom): for (; tmpArch != null; tmpArch = tmpArch.getPrev()) { if (stack.getArch(tmpArch.getNodeNr()).getJoinList() == this) { @@ -329,8 +328,8 @@ * Add/remove a certain connection of the given arch * by changing archtype and face. */ - private void connectArch(final ArchObject arch, final int newNodenr) { - final ArchObject defarch = stack.getArch(newNodenr); // new default arch + private void connectArch(final GameObject arch, final int newNodenr) { + final GameObject defarch = stack.getArch(newNodenr); // new default arch if (arch.getNodeNr() != newNodenr) { // set new archtype Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -145,7 +145,7 @@ } } - @Nullable public ArchObject getArchPanelSelection() { + @Nullable public GameObject getArchPanelSelection() { if (selectedPanel == null) { return null; } @@ -153,7 +153,7 @@ return selectedPanel.getArchListObject(); } - public void showArchPanelQuickObject(final ArchObject arch) { + public void showArchPanelQuickObject(final GameObject arch) { archQuickPanel.showArchPanelQuickObject(arch); } Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; @@ -120,8 +120,8 @@ }); } - public ArchObject getArchListObject() { - ArchObject arch = null; + public GameObject getArchListObject() { + GameObject arch = null; int index = theList.getSelectedIndex(); if (index != -1) { @@ -132,7 +132,7 @@ } public void showArchListObject(int index) { - ArchObject arch = null; + GameObject arch = null; if (index != -1) { try { @@ -271,7 +271,7 @@ /* We additionally set the JLabels icon property here. */ - final ArchObject arch = mainControl.getArchObjectStack().getArch(Integer.parseInt(value.toString())); + final GameObject arch = mainControl.getArchObjectStack().getArch(Integer.parseInt(value.toString())); if (isSelected) { archPanel.setPanelArch(Integer.parseInt(value.toString())); mainControl.setStatusText(" " + value.toString() + " "); Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; @@ -117,7 +117,7 @@ * @param archPart the object to show; this may be any part of a multi-part * object */ - void showArchPanelQuickObject(final ArchObject archPart) { + void showArchPanelQuickObject(final GameObject archPart) { if (archPart == null) { archArchNameText.setText("<html><font color=black>Arch:</font></html>"); archObjNameText.setText("<html><font color=black>Name:</font></html>"); @@ -126,10 +126,10 @@ return; } - final ArchObject arch = archPart.getHead(); + final GameObject arch = archPart.getHead(); archArchNameText.setText("<html><font color=black>Arch: " + arch.getArchName() + "</font></html>"); if (arch.getObjName() == null || arch.getObjName().length() <= 0) { - final ArchObject def = arch.getDefaultArch(); + final GameObject def = arch.getDefaultArch(); if (def == null || def == arch) { archObjNameText.setText("<html><font color=black>Name: -none- </font></html>"); } else if (def.getObjName() != null && def.getObjName().length() > 0) { Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.ArchObject; -import cfeditor.arch.ArchObjectStack; +import cfeditor.arch.GameObject; +import cfeditor.arch.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -121,13 +121,13 @@ private JLabel imagePanel; // panel for object's face (png) - private final ArchObject arch; + private final GameObject arch; - private final ArchObject defarch; + private final GameObject defarch; private CFArchType type; // reference to the type data - // this differs from the ArchObject if the type is undefined + // this differs from the GameObject if the type is undefined private int listNr; // the position of this type in the type list // buttons: @@ -155,11 +155,11 @@ * Constructor: Creates the GUI layout and * draws the dialog window. * @param atList the list of CF type-data - * @param aobj the ArchObject to be displayed by this dialog - * @param defaobj the default ArchObject of 'arch' + * @param aobj the GameObject to be displayed by this dialog + * @param defaobj the default GameObject of 'arch' * @param mainControl main control */ - CAttribDialog(final CFArchTypeList atList, final ArchObject aobj, final CMainControl mainControl) { + CAttribDialog(final CFArchTypeList atList, final GameObject aobj, final CMainControl mainControl) { super(mainControl.getMainView(), "CF Attribute Dialog", false); // when close-box is selected, execute the 'closeDialog' method and nothing else @@ -178,7 +178,7 @@ CAttribDialog.setDefaultBounds(); // set width/height etc - // reference to the ArchObject + // reference to the GameObject arch = aobj.getHead(); defarch = arch.getDefaultArch(); @@ -1016,14 +1016,14 @@ applyButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { - // write settings into the ArchObject + // write settings into the GameObject applySettings(); } }); okButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { - // write settings into the ArchObject, then exit + // write settings into the GameObject, then exit if (applySettings()) { closeDialog(); } @@ -1175,7 +1175,7 @@ /** * This method is called when the "apply"-button has been * pressed. All the settings from the dialog get - * written into the ArchObject. + * written into the GameObject. * @return true if the settings were applied, false if error occurred */ private boolean applySettings() { @@ -1396,11 +1396,11 @@ if (faceChanged) { if (arch.getFaceName() != null) { // we have a non-default face - final int index = ArchObjectStack.getFaceIndex(arch.getFaceName()); + final int index = ArchetypeSet.getFaceIndex(arch.getFaceName()); arch.setFaceNr(index); } else { // we have the default face - final int index = ArchObjectStack.getFaceIndex(defarch.getFaceName()); + final int index = ArchetypeSet.getFaceIndex(defarch.getFaceName()); arch.setFaceNr(index); } mainControl.getCurrentMap().repaint(); // repaint map @@ -1708,7 +1708,7 @@ final JTextArea text; // textfield containing the error-text to keep - final ArchObject arch; // the according arch + final GameObject arch; // the according arch final String allErrors; // list of all errors @@ -1720,7 +1720,7 @@ * @param keepB button "keep what is in the textfield" * @param textNew textfield containing the error-text to keep */ - public ConfirmErrorsAL(final JDialog dl, final ArchObject archNew, final String errors, final JButton keepB, final JTextArea textNew) { + public ConfirmErrorsAL(final JDialog dl, final GameObject archNew, final String errors, final JButton keepB, final JTextArea textNew) { arch = archNew; keepButton = keepB; text = textNew; @@ -1785,9 +1785,9 @@ final CAttribDialog frame; // the entire frame - final ArchObject arch; // the according arch + final GameObject arch; // the according arch - final ArchObject defarch; // default arch of 'arch' + final GameObject defarch; // default arch of 'arch' String deselected; // the latest deselected item @@ -1799,7 +1799,7 @@ * @param archNew the arch which has the error to be added * @param defarchNew the default arch of 'arch' */ - public TypesBoxAL(final CAttribDialog frameNew, final ArchObject archNew, final ArchObject defarchNew) { + public TypesBoxAL(final CAttribDialog frameNew, final GameObject archNew, final GameObject defarchNew) { frame = frameNew; arch = archNew; defarch = defarchNew; Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-09-24 17:15:52 UTC (rev 401) @@ -413,7 +413,7 @@ } /** - * Create the documentation to this ArchObject-type. + * Create the documentation to this GameObject-type. * @return the full html-text to be (parsed and) displayed */ public String createHtmlDocu() { Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.EOFException; @@ -528,12 +528,12 @@ * @return the <code>CFArchType</code> which belongs to this arch, * or the first (misc) type if no match is found. */ - public CFArchType getTypeOfArch(final ArchObject arch) { + public CFArchType getTypeOfArch(final GameObject arch) { // check if the type of the object is present in the definitions CFArchType tmp = head.getNext(); // tmp cycles through all types CFArchType type = tmp; // return value: the type of the arch, first one (misc) if no other found - final ArchObject defarch = arch.getDefaultArch(); + final GameObject defarch = arch.getDefaultArch(); boolean typeFound = false; for (int i = 0; tmp != null && !typeFound; tmp = tmp.getNext(), i++) { Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.ArchObject; -import cfeditor.arch.ArchObjectStack; +import cfeditor.arch.GameObject; +import cfeditor.arch.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -983,9 +983,9 @@ } } else if (content.getType() != TreasureObj.FOLDER) { // normal arch: display the face icon - final int num = ArchObjectStack.getArchIndex(content.getName()); - if (num != -1 && ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_COMPLETE) { - final ArchObject arch = CMainControl.getInstance().getArch(num); + final int num = ArchetypeSet.getArchIndex(content.getName()); + if (num != -1 && ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_COMPLETE) { + final GameObject arch = CMainControl.getInstance().getArch(num); if (arch != null) { if (!arch.getFaceFlag()) { setIcon(CMainControl.getInstance().getFace(arch.getFaceNr())); Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-09-24 17:15:52 UTC (rev 401) @@ -7,7 +7,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import cfeditor.filter.ConfigEvent; import cfeditor.filter.ConfigListener; import cfeditor.filter.Filter; @@ -25,7 +25,7 @@ * @author tchize * <p/> * Control to check if - * 1) a specific ArchObject can be shown (filter out of view part) + * 1) a specific GameObject can be shown (filter out of view part) * 2) a specific MapSquare must be highlighted (analysis part) * It provides onyl one filterOut path (and so elements elements are visbile * or not, they can't be twice visible or such). @@ -102,7 +102,7 @@ return false; } - public void objectInSquare(final ArchObject o) { + public void objectInSquare(final GameObject o) { for (int i = 0; i < 3; i++) { if (!highLightConfig[i].isEnabled()) { continue; /*matching system not activated*/ @@ -114,7 +114,7 @@ } } - public boolean canShow(final ArchObject o) { + public boolean canShow(final GameObject o) { if (!filterOutConfig.isEnabled()) { return true; } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,9 +24,9 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import cfeditor.arch.ArchObjectParser; -import cfeditor.arch.ArchObjectStack; +import cfeditor.arch.ArchetypeSet; import cfeditor.arch.anim.AnimationObjects; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; @@ -143,7 +143,7 @@ private ImageIcon noarchTileIconX; - private final ArchObjectStack archList; // the one and only arch list + private final ArchetypeSet archList; // the one and only arch list /** All open maps. */ private final Vector levels = new Vector(1, 2); @@ -202,7 +202,7 @@ /** Constructs the main controller and its model and view. */ public CMainControl() { - archList = new ArchObjectStack(this); + archList = new ArchetypeSet(this); mainView = new CMainView(this); instance = this; @@ -283,7 +283,7 @@ // load the list with archtype-data from "types.txt" typelist = new CFArchTypeList(); - ArchObject.setTypeList(typelist); // set reference in ArchObject + GameObject.setTypeList(typelist); // set reference in GameObject // now collect all arch you can find in the arch path!! System.gc(); @@ -293,7 +293,7 @@ /** * Loading the joinlist from file and attaching all to 'joinlist'. * (This method must not be called before all arches are loaded - * into the ArchObjectStack 'archList'!) + * into the ArchetypeSet 'archList'!) */ public void loadJoinlist() { joinlist = new AutojoinList(); @@ -302,17 +302,17 @@ } } - void moveTileUp(final ArchObject arch, final boolean refresh) { + void moveTileUp(final GameObject arch, final boolean refresh) { currentMap.getMapModel().moveTileUp(arch, refresh); } - void moveTileDown(final ArchObject arch, final boolean refresh) { + void moveTileDown(final GameObject arch, final boolean refresh) { currentMap.getMapModel().moveTileDown(arch, refresh); } /** collect CF arches */ public void collectCFArches() { - if (ArchObjectStack.getLoadStatus() != ArchObjectStack.IS_COMPLETE) { + if (ArchetypeSet.getLoadStatus() != ArchetypeSet.IS_COMPLETE) { // must not collect arches while arch stack not complete showMessage("Arches still Loading", "You have to wait for all arches to be loaded\nbefore you can collect them."); return; @@ -392,7 +392,7 @@ // access to ArchNodeList // remark: i use before some weird access to it, use this instead when you find it - public void addArchToList(final ArchObject data) { + public void addArchToList(final GameObject data) { archList.addArchToList(data); } @@ -408,7 +408,7 @@ return archList.getArchCount(); } - public ArchObject getArch(final int i) { + public GameObject getArch(final int i) { return archList.getArch(i); } @@ -548,12 +548,12 @@ } // ask arch panel which arch is selectd - public ArchObject getArchPanelSelection() { + public GameObject getArchPanelSelection() { return mainView.getArchPanelSelection(); } // setup quick view window - public void showArchPanelQuickObject(final ArchObject arch) { + public void showArchPanelQuickObject(final GameObject arch) { mainView.showArchPanelQuickObject(arch); } @@ -595,7 +595,7 @@ return currentMap.addArchToMap(archnr, pos, intern, join); } - boolean insertArchToMap(final ArchObject newarch, final int archnr, final ArchObject next, final Point pos, final boolean join) { + boolean insertArchToMap(final GameObject newarch, final int archnr, final GameObject next, final Point pos, final boolean join) { return currentMap.insertArchToMap(newarch, archnr, next, pos, join); } @@ -603,7 +603,7 @@ currentMap.deleteMapArch(index, pos, refreshMap, join); } - public ArchObject getMapArch(final int index, final Point pos) { + public GameObject getMapArch(final int index, final Point pos) { return currentMap.getMapArch(index, pos); } @@ -649,10 +649,10 @@ } /** - * Get the ArchObjectStack. - * @return ArchObjectStack + * Get the ArchetypeSet. + * @return ArchetypeSet */ - public ArchObjectStack getArchObjectStack() { + public ArchetypeSet getArchObjectStack() { return archList; } @@ -728,7 +728,7 @@ * left corner * @return map control of new map */ - public MapControl newLevel(final List<ArchObject> objects, final MapArchObject maparch, final Point initial) { + public MapControl newLevel(final List<GameObject> objects, final MapArchObject maparch, final Point initial) { return newLevel(objects, maparch, true, initial); } @@ -743,7 +743,7 @@ * left corner * @return map control of new map */ - public MapControl newLevel(final List<ArchObject> objects, final MapArchObject maparch, final boolean show, final Point initial) { + public MapControl newLevel(final List<GameObject> 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.getMapDisplayName()); @@ -904,7 +904,7 @@ final int returnVal = fileChooser.showOpenDialog(mainView); if (returnVal == JFileChooser.APPROVE_OPTION) { - if (ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_LOADING) { + if (ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_LOADING) { // ArchStack still loading -> abort! showMessage("Cannot open Map", "Are you nuts?! :-)\n" + "All arches have to be loaded before you can open a map.\n" + @@ -912,7 +912,7 @@ return; } - if (ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_EMPTY) { + if (ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_EMPTY) { // ArchStack is empty -> abort! showMessage("Cannot open Map", "There are currently no arches avaliable!\n" + "You need to have arches loaded before opening a map.\n" + @@ -971,7 +971,7 @@ * @return the map controller to manipulate this map */ @Nullable public MapControl openFile(final File file, final boolean show, final Point initial) { - final List<ArchObject> objects; + final List<GameObject> objects; final MapArchObject maparch; try { objects = mapFileDecoder.decodeMapFile(file); // parse mapfile @@ -1014,7 +1014,7 @@ * Open an attribute dialog window for the specified arch * @param arch attr. window is opened for this arch */ - public void openAttrDialog(final ArchObject arch) { + public void openAttrDialog(final GameObject arch) { if (typelist.isEmpty()) { // types.txt is missing! showMessage("File Missing", "The definitions-file \"types.txt\" is missing! The\nattribute interface doesn't work without that file."); @@ -1043,12 +1043,12 @@ * 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(final List<ArchObject> objects, final File file) { - final List<ArchObject> tailList = new ArrayList<ArchObject>(); + boolean collectTempList(final List<GameObject> objects, final File file) { + final List<GameObject> tailList = new ArrayList<GameObject>(); // first: attach our map sucker to a default arch we have loaded - for (final Iterator<ArchObject> it = objects.iterator(); it.hasNext();) { - final ArchObject arch = it.next(); - final int index1 = ArchObjectStack.getArchIndex(arch.getArchName()); + for (final Iterator<GameObject> it = objects.iterator(); it.hasNext();) { + final GameObject arch = it.next(); + final int index1 = ArchetypeSet.getArchIndex(arch.getArchName()); if (index1 == -1) { // we had an unknown arch here!! // showMessage("Error Loading Map File "+file.getName(), "\n Found Unknown Arch < "+arch.getArchName()+" >"); @@ -1060,7 +1060,7 @@ // if there was no special face added in map, get it from def object if (arch.getFaceName() != null) { - final int index2 = ArchObjectStack.getFaceIndex(arch.getFaceName()); + final int index2 = ArchetypeSet.getFaceIndex(arch.getFaceName()); if (index2 == -1) { // just warn here we have not the gfx //showMessage("LOAD FILE", "Arch: "+arch.getFaceName()+" Face: " +arch.getFaceName()+" Face Name Unknown"); } else { @@ -1076,7 +1076,7 @@ archObjectParser.expandMulti(arch, tailList); } - for (final ArchObject tail : tailList) { + for (final GameObject tail : tailList) { objects.add(tail); } @@ -1318,7 +1318,7 @@ /** Try to load the map where the selected map-exit points to. */ public void enterExitWanted() { - final ArchObject exit = currentMap.getMapModel().getExit(); + final GameObject exit = currentMap.getMapModel().getExit(); if (exit == null) { // no exit found showMessage("No Exit Found", "There is no valid exit at the selected spot."); Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObjectStack; +import cfeditor.arch.ArchetypeSet; import cfeditor.menu.AggregateMenuLocation; import cfeditor.menu.BasicMenuEntry; import cfeditor.menu.CheckBoxMenuEntry; @@ -38,7 +38,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; -import java.util.Enumeration; import java.util.List; import javax.swing.JMenu; import javax.swing.JMenuBar; @@ -857,7 +856,7 @@ mainControl.setPickmapsLocked(m_lockPickmaps.isChecked()); m_newPickmap.setEnabled(!m_lockPickmaps.isChecked()); - final boolean isArchLoadComplete = ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_COMPLETE; + final boolean isArchLoadComplete = ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_COMPLETE; if (isArchLoadComplete) { m_deletePickmap.setEnabled(!m_lockPickmaps.isChecked()); m_loadPickmap.setEnabled(!m_lockPickmaps.isChecked()); @@ -1253,7 +1252,7 @@ /** Refreshes the state of items in this toolbar. */ public void refresh() { - final boolean isArchLoadComplete = ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_COMPLETE; + final boolean isArchLoadComplete = ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_COMPLETE; m_undo.setEnabled(false); m_redo.setEnabled(false); @@ -1268,7 +1267,7 @@ m_autojoin.setEnabled(mainControl.getJoinlist() != null); // collect arches is only allowed if we run from individual archfiles - m_collectArch.setEnabled(isArchLoadComplete && !ArchObjectStack.isLoadedFromArchive()); + m_collectArch.setEnabled(isArchLoadComplete && !ArchetypeSet.isLoadedFromArchive()); if (isArchLoadComplete) { m_viewTreasure.setEnabled(true); Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import cfeditor.map.MapControl; import java.awt.BorderLayout; import java.awt.Dimension; @@ -292,10 +292,10 @@ * @return the active arch in the left-side panel. * This can either be a default arch from the archlist, or * a custom arch from a pickmap. - * IMPORTANT: The returned ArchObject is not a clone. A copy + * IMPORTANT: The returned GameObject is not a clone. A copy * must be generated before inserting such an arch to the map. */ - public ArchObject getArchPanelSelection() { + public GameObject getArchPanelSelection() { if ((isPickmapActive() || archPanel.getArchPanelSelection() == null) && CPickmapPanel.getInstance().isLoadComplete() && @@ -305,7 +305,7 @@ if (pmap != null && pmap.getMapView().isHighlight()) { // now try to get the topmost object - ArchObject arch = null; + GameObject arch = null; if (pmap.isPointValid(pmap.getMapView().getHighlightStart())) { arch = pmap.getMapModel().getBottomArchObject(pmap.getMapView().getHighlightStart()); } @@ -321,7 +321,7 @@ return archPanel.getArchPanelSelection(); } - public void showArchPanelQuickObject(final ArchObject arch) { + public void showArchPanelQuickObject(final GameObject arch) { archPanel.showArchPanelQuickObject(arch); } @@ -331,12 +331,12 @@ } // show a arch in the arch map panel - public void setMapArchPanelObject(final ArchObject arch) { + public void setMapArchPanelObject(final GameObject arch) { mapArchPanel.setMapArchPanelObject(arch); } // show a arch in the arch map panel - public ArchObject getMapArchPanelObject() { + public GameObject getMapArchPanelObject() { return mapArchPanel.getMapArchPanelObject(); } @@ -349,7 +349,7 @@ mapTileList.refresh(); } - public ArchObject getMapTileSelection() { + public GameObject getMapTileSelection() { return mapTileList.getMapTileSelection(); } Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,11 +24,10 @@ package cfeditor; -import cfeditor.arch.ArchObject; -import cfeditor.arch.ArchObjectStack; +import cfeditor.arch.GameObject; +import cfeditor.arch.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -44,7 +43,6 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; @@ -60,7 +58,7 @@ /** * <code>CMapArchPanel</code> implements the panel that holds information about - * the currently selected ArchObject on the map. + * the currently selected GameObject on the map. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ @@ -161,7 +159,7 @@ private JList eventList; - private ArchObject selectedObject; + private GameObject selectedObject; /* Build Panel */ CMapArchPanel(final CMainControl mainControl, final CMainView view) { @@ -259,7 +257,7 @@ invChange.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { - final ArchObject arch = mainControl.getArchPanelSelection(); + final GameObject arch = mainControl.getArchPanelSelection(); if (arch == null) { // nothing selected? return; } @@ -269,7 +267,7 @@ return; } - ArchObject inv = mainView.getMapTileSelection(); + GameObject inv = mainView.getMapTileSelection(); if (inv == null) { return; } @@ -277,7 +275,7 @@ // if this is a multi-tail, we put the new arch into the head's inv. inv = inv.getHead(); - final ArchObject invnew; + final GameObject invnew; if (arch.isDefaultArch()) { // create a new copy of a default arch invnew = mainControl.getArchObjectStack().newArchObjectInstance(arch.getNodeNr()); @@ -299,7 +297,7 @@ * is pressed, this function updates the active arch object. * @param activeArch the currently selected arch */ - public void applyArchPanelChanges(final ArchObject activeArch) { + public void applyArchPanelChanges(final GameObject activeArch) { boolean needRedraw = false; // do we need a map-redraw? true/false if (activeArch == null) { @@ -308,9 +306,9 @@ // If the active arch is part of a multi, the mutli-head's stats // are taken instead: - final ArchObject arch = activeArch.getHead(); + final GameObject arch = activeArch.getHead(); - final ArchObject defarch = mainControl.getArch(arch.getNodeNr()); + final GameObject defarch = mainControl.getArch(arch.getNodeNr()); if (defarch == null) { // hm, this should NOT happen return; } @@ -376,11 +374,11 @@ if (arch.getFaceName() != null) { // we have a non-default face - final int index = ArchObjectStack.getFaceIndex(arch.getFaceName()); + final int index = ArchetypeSet.getFaceIndex(arch.getFaceName()); arch.setFaceNr(index); } else { // we have the default face - final int index = ArchObjectStack.getFaceIndex(defarch.getFaceName()); + final int index = ArchetypeSet.getFaceIndex(defarch.getFaceName()); arch.setFaceNr(index); } @@ -519,7 +517,7 @@ * Open an attribute dialog window for the currently selected arch * @param arch currently selected arch */ - private void openAttrDialog(final ArchObject arch) { + private void openAttrDialog(final GameObject arch) { mainControl.openAttrDialog(arch); } @@ -657,7 +655,7 @@ * updated. * @return the selected arch */ - public ArchObject getMapArchPanelObject() { + public GameObject getMapArchPanelObject() { return selectedObject; } @@ -666,7 +664,7 @@ * updated. * @param activeArch the selected arch */ - public void setMapArchPanelObject(final ArchObject activeArch) { + public void setMapArchPanelObject(final GameObject activeArch) { selectedObject = activeArch; // archObjNameText.setText("<html><font color=black>Name:</font></html>"); // reset panel @@ -698,7 +696,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 = activeArch.getHead(); + final GameObject arch = activeArch.getHead(); // no text, we try to set the default text final boolean hasMessage; @@ -835,7 +833,7 @@ * script is triggered. */ public void editScriptWanted(final int task) { - ArchObject arch = mainControl.getMainView().getMapTileSelection(); // get selected arch + GameObject arch = mainControl.getMainView().getMapTileSelection(); // get selected arch if (arch != null) { arch = arch.getHead(); } @@ -854,7 +852,7 @@ /** This method is invoked when the user pressed the "new script" button. */ public void addNewScriptWanted() { - ArchObject arch = mainControl.getMainView().getMapTileSelection(); // get selected arch + GameObject arch = mainControl.getMainView().getMapTileSelection(); // get selected arch if (arch != null) { arch = arch.getHead(); arch.addEventScript(eventList, this); Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import cfeditor.map.MapArchObject; import java.io.BufferedReader; import java.io.File; @@ -53,7 +53,7 @@ private int maxxlen, maxylen; /** ArchObjects that are read from the map. */ - private List<ArchObject> objects; + private List<GameObject> objects; /** Contains the map arch (see MapArchObject class). */ private MapArchObject maparch; @@ -69,17 +69,17 @@ * Loading a Crossfire map from the given mapfile. * This method returns a list of arches, connected with the temp pointers. * @param file mapfile - * @return first <code>ArchObject</code> in the list + * @return first <code>GameObject</code> in the list * @throws FileNotFoundException in case the requested map file was not found * @throws IOException in case the file couldn't be read or is in wrong format * @todo create a separate exception for the wrong format */ - public List<ArchObject> decodeMapFile(final File file) throws FileNotFoundException, IOException { + public List<GameObject> decodeMapFile(final File file) throws FileNotFoundException, IOException { final BufferedReader myInput = new BufferedReader(new InputStreamReader(new FileInputStream(file), CFileReader.MAP_ENCODING)); try { maxxlen = 0; maxylen = 0; - objects = new ArrayList<ArchObject>(); + objects = new ArrayList<GameObject>(); // first of all we read the map arch (if that fails we throw an exception) maparch = new MapArchObject(); @@ -113,12 +113,12 @@ * @param myInput input filestream * @param thisLine first line of text, belonging to this new arch * @param container container arch that contains this new arch - if any - * @return the new parsed <code>ArchObject</code> + * @return the new parsed <code>GameObject</code> * @throws IOException when an I/O-error occured during file reading */ - @Nullable private ArchObject readArch(final BufferedReader myInput, String thisLine, final ArchObject container) + @Nullable private GameObject readArch(final BufferedReader myInput, String thisLine, final GameObject container) throws IOException { - ArchObject arch; + GameObject arch; String thisLine2; boolean archflag, archmore, msgflag, animflag, scriptflag; final int y; @@ -158,7 +158,7 @@ archflag = true; // from now on we are inside an arch if (!archmore) { - arch = new ArchObject(); // create a new instance + arch = new GameObject(); // create a new instance // our arch! it has a name! arch.setArchName(thisLine.substring(x, thisLine.length())); Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import cfeditor.map.MapArchObject; import cfeditor.map.MapModel; import java.awt.Point; @@ -75,7 +75,7 @@ try { fname = file.getAbsolutePath(); bufferedWriter = new BufferedWriter(new FileWriter(file)); - //ArchObject multi; + //GameObject multi; // write map header: map arch mapArch.writeMapArch(bufferedWriter); @@ -87,7 +87,7 @@ for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { final Iterator it = mapModel.getArchObjects(pos); while (it.hasNext()) { - final ArchObject node = (ArchObject) it.next(); + final GameObject node = (GameObject) it.next(); // only non multi suckers if (!node.isMulti()) { if (!writeMapArch(node, false)) { @@ -103,7 +103,7 @@ for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { final Iterator it = mapModel.getArchObjects(pos); while (it.hasNext()) { - final ArchObject node = (ArchObject) it.next(); + final GameObject node = (GameObject) it.next(); // search only for heads! if (node.isMulti() && node.isHead()) { // only the heads get stored in the mapfile @@ -125,20 +125,20 @@ * Walk through the inventory of an arch and write everything into the file. * @param start the container arch whose inventory is to be written */ - private void browseInvObjects(final ArchObject start) { - for (final ArchObject arch : start) { + private void browseInvObjects(final GameObject start) { + for (final GameObject arch : start) { writeMapArch(arch, true); } } /** * Here the map arch gets written into the file. - * @param arch <code>ArchObject</code> to be written into the map + * @param arch <code>GameObject</code> to be written into the map * @param isInventory is 'arch' inside a container? true/false * @return true if arch was written successfully */ - boolean writeMapArch(final ArchObject arch, final boolean isInventory) { - final ArchObject defarch = arch.getDefaultArch(); + boolean writeMapArch(final GameObject arch, final boolean isInventory) { + final GameObject defarch = arch.getDefaultArch(); // Collect all fields to write. final Map<String, String> fields = new HashMap<String, String>(); // String key -> String value Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchObject; +import cfeditor.arch.GameObject; import cfeditor.map.MapControl; import cfeditor.map.MapModel; import java.awt.BorderLayout; @@ -238,7 +238,7 @@ return listIndex; } - @Nullable public ArchObject getMapTileSelection() { + @Nullable public GameObject getMapTileSelection() { // find the selected entry if one final int index = list.getSelectedIndex(); if (currentSquare == null || index >= list.getModel().getSize() || index < 0 || list.getModel().getSize() <= 0 || mainControl.getCurrentMap() == null) { @@ -254,7 +254,7 @@ /** Insert a tile index of list, this will delete it. */ void deleteIndexFromList(final int index) { if (currentSquare != null && index != -1 && index < list.getModel().getSize()) { - final ArchObject temp = getMapTileSelection(); + final GameObject temp = getMapTileSelection(); final String entry = model.getElementAt(index).toString(); final int num = Integer.parseInt(entry.substring(0, 10)); mainControl.deleteMapArch(num, currentSquare, true, MapModel.JOIN_ENABLE); @@ -279,7 +279,7 @@ void refresh() { final int id; - final ArchObject sel = getMapTileSelection(); + final GameObject sel = getMapTileSelection(); if (sel != null) { id = getMapTileSelection().getMyID(); } else { @@ -314,7 +314,7 @@ postSelect = -1; listCounter = 0; currentSquare = map.getMapModel().getMouseRightPos(); - ArchObject node = map.getMapModel().getMouseRightPosObject(); + GameObject node = map.getMapModel().getMouseRightPosObject(); // Jump to the end of the list for (; node != null && node.getNext() != null; node = node.getNext()) { @@ -363,12 +363,12 @@ * @param archid nodeNr of the highlighted arch (?) * @param indent indentation; 1=minimal indentation */ - public void addInvObjects(final ArchObject node, final int archid, final int indent) { + public void addInvObjects(final GameObject node, final int archid, final int indent) { final String indentStr = Integer.toString(indent); final Iterator it = node.getHead().iterator(); while (it.hasNext()) { - final ArchObject arch = (ArchObject) it.next(); + final GameObject arch = (GameObject) it.next(); if (arch.getMyID() == archid) { postSelect = listCounter; @@ -408,7 +408,7 @@ final int num = Integer.parseInt(entry.substring(0, 10)); final int indent = Integer.parseInt(entry.substring(10, 20)); - ArchObject arch = mainControl.getMapArch(num, currentSquare); + GameObject arch = mainControl.getMapArch(num, currentSquare); //String label; // We must set a disabled Icon (even though we don't want it) Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-24 16:56:25 UTC (rev 400) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-24 17:15:52 UTC (rev 401) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.ArchObject; -import cfeditor.arch.ArchObjectStack; +import cfeditor.arch.GameObject; +import cfeditor.arch.ArchetypeSet; import cfeditor.filter.AttributeFilter; import cfeditor.map.MapControl; import cfeditor.map.MapModel; @@ -402,12 +402,12 @@ /** * Determine which map-squares need to be redrawn after inserting/deleting - * the given ArchObject. + * the given GameObject. * @param arch the arch that is inserted or deleted * @return a <code>Point</code> array containing the coords of the tiles * which need to be redrawn */ - @Nullable Point[] calcArchRedraw(ArchObject arch) { + @Nullable Point[] calcArchRedraw(GameObject arch) { if (arch == null) { // safety check return null; } @@ -453,7 +453,7 @@ int num = arch.getMultiRefCount(); // get number of parts redraw = new Point[num]; // create instance of needed size - for (ArchObject tmp = arch; num > 0 && tmp != null; + for (GameObject tmp = arch; num > 0 && tmp != null; num--, tmp = tmp.getMultiNext()) { redraw[num - 1] = new Point(tmp.getMapX(), tmp.getMapY()); } @@ -705,7 +705,7 @@ * "screenshot"-image, false for normal drawing */ public void paintComponent(final Graphics2D grfx, final boolean isSnapshot) { - final ArchObjectStack archlist = mainControl.getArchObjectStack(); + final ArchetypeSet archlist = mainControl.getArchObjectStack(); if (isPickmap) { // draw greenisch background for pickmaps @@ -731,7 +731,7 @@ } else { final Iterator it = _model.getArchObjects(x, y); while (it.hasNext()) { - final ArchObject node = (ArchObject) it.next(); + final GameObject node = (GameObject) it.next(); filter.objectInSquare(node); if (!filter.canShow(node)) { continue; @@ -771,7 +771,7 @@ } // at the end, we have to draw the oversized multipart images on top of the rest for (int i = 0; i < oversizedMultiHeads.size(); i++) { - final ArchObject node = (ArchObject) (oversizedMultiHeads.elementAt(i)); + final GameObject node = (GameObject) (oversizedMultiHeads.elementAt(i)); archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, node.getMapX() * 32 + bOffset, node.getMapY() * 32 + bOffset); } @@ -818,7 +818,7 @@ } else { grfx = backBuffer.getGraphics(); } - final ArchObjectStack archlist = mainControl.getArchObjectStack(); // arch stack + final ArchetypeSet archlist = mainControl.getArchObjectStack(); // arch stack // ---------- draw tile for rectangular view (non-iso) -------------- final CFilterControl filter = mainControl.getFilterControl(); @@ -837,7 +837,7 @@ // loop through all arches on that square and draw em final Iterator it = _model.getArchObjects(x, y); while (it.hasNext()) { - final ArchObject node = (ArchObject) it.next(); + final GameObject node = (GameObject) it.next(); filter.objectInSquare(node); if (!filter.canShow(node)) { @@ -1242,7 +1242,7 @@ } else { // delete the topmost arch (matching the view settings) // on that square and redraw the map - ArchObject tmpArch = mapControl.getBottomArchObject(temp); + GameObject tmpArch = mapControl.getBottomArchObject(temp); if (tmpArch != null) { // go to the topmost arch (end of the list) for (; tmpArch.getNext() != null; tmpArch = tmpArch.getNext()) { @@ -1294,7 +1294,7 @@ needRedraw = insertSelArchToMap(mapLoc, true); // get name of inserted arch (this is display in status bar while dragging) - ArchObject insArch; + GameObject insArch; if ((insArch = mainControl.getArchPanelSelection()) != null) { if (insArch.getObjName() != null && insArch.getObjName().length() > 0) { insertArchName = mainControl.getArchPanelSelection().getObjName(); @@ -1344,7 +1344,7 @@ renderer.setHighlightTile(/*((JComponent)renderer).getGraphics(), */mapLoc.x, mapLoc.y); if (renderer.isPickmap()) { - final ArchObject arch = mapControl.getBottomArchObject(mapLoc); + final GameObject arch = mapControl.getBottomArchObject(mapLoc); if (arch != null) { // an arch of a pickmap was selected mainControl.showArchPanelQuickObject(arch); @@ -1367,7 +1367,7 @@ // delete the topmost arch (matching the view settings) on that square // and redraw the map - ArchObject tmpArch = mapControl.getBottomArchObject(mapLoc); + GameObject tmpArch = mapControl.getBottomArchObject(mapLoc); if (tmpArch != null) { // go to the topmost arch (end of the list) for (; tmpArch.getNext() != null; tmpArch = tmpArch.getNext()) { @@ -1404,7 +1404,7 @@ // this is the arch that would get inserted from pickmap, but it also could // be a default arch (when pickmap has no selection) - ArchObject newarch = mainControl.getArchPanelSelection(); + GameObject newarch = mainControl.getArchPanelSelection(); if (!mainControl.getMainView().isPickmapActive() || mapControl.isPickmap() || (newarch != null && newarch.isDefaultArch())) { @@ -1428,7 +1428,7 @@ // check if there is already an arch of that kind final Iterator it = mapControl.getArchObjects(pos); while (it.hasNext()) { - final ArchObject t = (ArchObject) it.next(); + final GameObject t = (GameObject) it.next(); if (t.getNodeNr() == newarch.getNodeNr() && t.getArchTypNr() == newarch.getArchTypNr()) { insertAllowed = false; // there's a match - don't insert a second one @@ -1450,7 +1450,7 @@ // do nothing } else { // insertion successful, now get redraw info - final ArchObject newdef = mapControl.getTopArchObject(pos); // new inserted default arch + final GameObject newdef = mapControl.getTopArchObject(pos); // new inserted default arch if (newdef != null) { // now we've got the inserted arch, copy the custom stuff from pickmap newdef.setArchText(newarch.... [truncated message content] |
From: <chr...@us...> - 2006-09-24 17:38:49
|
Revision: 402 http://svn.sourceforge.net/gridarta/?rev=402&view=rev Author: christianhujer Date: 2006-09-24 10:36:47 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Renamed arch packages to gameobject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/ExitTypes.java trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/crossfire/src/cfeditor/MultiArchData.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/crossfire/src/cfeditor/filter/Filter.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/GameObjectIterator.java trunk/crossfire/src/cfeditor/gameobject/GameObjectIteratorDeleteGameMapObject.java trunk/crossfire/src/cfeditor/gameobject/GameObjectIteratorDeleteMapGame.java trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/crossfire/src/cfeditor/gui/ArchComboBox.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/crossfire/src/cfeditor/parameter/ArchParameter.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CArchQuickView.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchAttrib.java trunk/daimonin/src/daieditor/CFArchType.java trunk/daimonin/src/daieditor/CFArchTypeList.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CMapFileEncode.java trunk/daimonin/src/daieditor/CMapTileList.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/MultiArchData.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/ArchAttribType.java trunk/daimonin/src/daieditor/gameobject/ArchObjectParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/DuplicateArchException.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObjectContainer.java trunk/daimonin/src/daieditor/gameobject/NamedObject.java trunk/daimonin/src/daieditor/gameobject/NamedObjects.java trunk/daimonin/src/daieditor/gameobject/NamedTreeNode.java trunk/daimonin/src/daieditor/gameobject/RecursiveGameObjectIterator.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationParseException.java trunk/daimonin/src/daieditor/gameobject/anim/DuplicateAnimationException.java trunk/daimonin/src/daieditor/gameobject/face/DuplicateFaceException.java trunk/daimonin/src/daieditor/gameobject/face/FaceFacade.java trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/match/AndGameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/AttribGameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/GameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/GameObjectMatchers.java trunk/daimonin/src/daieditor/gameobject/match/MutableNameGameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/MutableOrGameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/NamedGameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/NotGameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/OrGameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/TypeNrsGameObjectMatcher.java trunk/daimonin/src/daieditor/gameobject/match/ViewGameObjectMatcherManager.java trunk/daimonin/src/daieditor/gui/ConnectionView.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java trunk/daimonin/src/daieditor/gui/map/MapViewSettings.java trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java trunk/daimonin/src/daieditor/map/ArchOutOfMapBoundsException.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapModel.java trunk/daimonin/src/daieditor/map/MapModelEvent.java trunk/daimonin/src/daieditor/map/MapSquare.java trunk/daimonin/src/daieditor/map/validation/ArchValidationError.java trunk/daimonin/src/daieditor/map/validation/ArchValidator.java trunk/daimonin/src/daieditor/map/validation/ArchesValidationError.java trunk/daimonin/src/daieditor/map/validation/DelegatingMapValidator.java trunk/daimonin/src/daieditor/map/validation/ValidationError.java trunk/daimonin/src/daieditor/map/validation/checks/BlockedMobOrSpawnPointChecker.java trunk/daimonin/src/daieditor/map/validation/checks/BlockedMobOrSpawnPointError.java trunk/daimonin/src/daieditor/map/validation/checks/ConnectedInsideContainerChecker.java trunk/daimonin/src/daieditor/map/validation/checks/ConnectedInsideContainerError.java trunk/daimonin/src/daieditor/map/validation/checks/ConnectedPickableChecker.java trunk/daimonin/src/daieditor/map/validation/checks/ConnectedPickableError.java trunk/daimonin/src/daieditor/map/validation/checks/DoubleArchChecker.java trunk/daimonin/src/daieditor/map/validation/checks/DoubleArchError.java trunk/daimonin/src/daieditor/map/validation/checks/DoubleLayerChecker.java trunk/daimonin/src/daieditor/map/validation/checks/DoubleLayerError.java trunk/daimonin/src/daieditor/map/validation/checks/EmptySpawnPointChecker.java trunk/daimonin/src/daieditor/map/validation/checks/EmptySpawnPointError.java trunk/daimonin/src/daieditor/map/validation/checks/ExitChecker.java trunk/daimonin/src/daieditor/map/validation/checks/ExitError.java trunk/daimonin/src/daieditor/map/validation/checks/MobOutsideSpawnPointChecker.java trunk/daimonin/src/daieditor/map/validation/checks/MobOutsideSpawnPointError.java trunk/daimonin/src/daieditor/map/validation/checks/SlayingChecker.java trunk/daimonin/src/daieditor/map/validation/checks/SlayingError.java trunk/daimonin/src/daieditor/map/validation/checks/SquareWithoutFloorChecker.java trunk/daimonin/src/daieditor/map/validation/checks/SysObjectOnLayerZeroChecker.java trunk/daimonin/src/daieditor/map/validation/checks/SysObjectOnLayerZeroError.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Added Paths: ----------- trunk/crossfire/src/cfeditor/gameobject/ trunk/daimonin/src/daieditor/gameobject/ trunk/src/app/net/sf/gridarta/gameobject/ Removed Paths: ------------- trunk/crossfire/src/cfeditor/arch/ trunk/daimonin/src/daieditor/arch/ trunk/src/app/net/sf/gridarta/arch/ Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.GameObject; -import cfeditor.arch.ArchetypeSet; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.ArchetypeSet; import cfeditor.map.MapModel; import java.io.FileNotFoundException; import java.io.IOException; Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.GameObject; -import cfeditor.arch.ArchetypeSet; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.EOFException; Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.GameObject; -import cfeditor.arch.ArchetypeSet; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-09-24 17:36:47 UTC (rev 402) @@ -7,7 +7,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.filter.ConfigEvent; import cfeditor.filter.ConfigListener; import cfeditor.filter.Filter; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,10 +24,10 @@ package cfeditor; -import cfeditor.arch.GameObject; -import cfeditor.arch.ArchObjectParser; -import cfeditor.arch.ArchetypeSet; -import cfeditor.arch.anim.AnimationObjects; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.ArchObjectParser; +import cfeditor.gameobject.ArchetypeSet; +import cfeditor.gameobject.anim.AnimationObjects; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import cfeditor.map.MapModel; Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchetypeSet; +import cfeditor.gameobject.ArchetypeSet; import cfeditor.menu.AggregateMenuLocation; import cfeditor.menu.BasicMenuEntry; import cfeditor.menu.CheckBoxMenuEntry; Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; import java.awt.BorderLayout; import java.awt.Dimension; Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.GameObject; -import cfeditor.arch.ArchetypeSet; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import java.io.BufferedReader; import java.io.File; Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import cfeditor.map.MapModel; import java.awt.Point; Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; import cfeditor.map.MapModel; import java.awt.BorderLayout; Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.GameObject; -import cfeditor.arch.ArchetypeSet; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.ArchetypeSet; import cfeditor.filter.AttributeFilter; import cfeditor.map.MapControl; import cfeditor.map.MapModel; Modified: trunk/crossfire/src/cfeditor/CNewMapDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.ArchetypeSet; +import cfeditor.gameobject.ArchetypeSet; import cfeditor.map.MapArchObject; import java.awt.BorderLayout; import java.awt.Dimension; Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.arch.GameObject; -import cfeditor.arch.ArchObjectParser; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.ArchObjectParser; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import java.io.File; Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.map.DefaultMapModel; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; Modified: trunk/crossfire/src/cfeditor/ExitTypes.java =================================================================== --- trunk/crossfire/src/cfeditor/ExitTypes.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/ExitTypes.java 2006-09-24 17:36:47 UTC (rev 402) @@ -2,7 +2,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import java.util.HashSet; import java.util.Set; Modified: trunk/crossfire/src/cfeditor/MapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; import cfeditor.menu.MenuHelper; import cfeditor.menu.MenuManager; Modified: trunk/crossfire/src/cfeditor/MultiArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiArchData.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/MultiArchData.java 2006-09-24 17:36:47 UTC (rev 402) @@ -25,7 +25,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import java.util.ArrayList; /** Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; import java.awt.Color; import java.awt.FlowLayout; Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package cfeditor; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Insets; Modified: trunk/crossfire/src/cfeditor/filter/AttributeFilter.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-09-24 17:36:47 UTC (rev 402) @@ -7,7 +7,7 @@ package cfeditor.filter; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.menu.BasicMenuEntry; import cfeditor.menu.FilterCheckBoxEntry; import java.util.HashMap; Modified: trunk/crossfire/src/cfeditor/filter/Filter.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/Filter.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/filter/Filter.java 2006-09-24 17:36:47 UTC (rev 402) @@ -7,7 +7,7 @@ package cfeditor.filter; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.menu.BasicMenuEntry; import org.jdom.Element; Modified: trunk/crossfire/src/cfeditor/filter/NamedFilterList.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-09-24 17:36:47 UTC (rev 402) @@ -7,7 +7,7 @@ package cfeditor.filter; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import cfeditor.menu.BasicMenuEntry; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; Copied: trunk/crossfire/src/cfeditor/gameobject (from rev 401, trunk/crossfire/src/cfeditor/arch) Modified: trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java 2006-09-24 17:36:47 UTC (rev 402) @@ -22,7 +22,7 @@ * */ -package cfeditor.arch; +package cfeditor.gameobject; import cfeditor.CMainControl; import cfeditor.IGUIConstants; @@ -36,7 +36,6 @@ import java.util.List; import java.util.Map; import org.apache.log4j.Logger; -import org.jdom.Attribute; import org.jdom.DataConversionException; import org.jdom.Document; import org.jdom.Element; Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchetypeSet.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-09-24 17:36:47 UTC (rev 402) @@ -23,7 +23,7 @@ * */ -package cfeditor.arch; +package cfeditor.gameobject; import cfeditor.CArchPanel; import cfeditor.CFTreasureListTree; Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/GameObject.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 17:36:47 UTC (rev 402) @@ -22,7 +22,7 @@ * */ -package cfeditor.arch; +package cfeditor.gameobject; import cfeditor.AutojoinList; import cfeditor.CFArchType; @@ -48,7 +48,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class GameObject implements Cloneable, net.sf.gridarta.arch.GameObject, Iterable<GameObject> { +public class GameObject implements Cloneable, net.sf.gridarta.gameobject.GameObject, Iterable<GameObject> { private static final Logger log = Logger.getLogger(GameObject.class); @@ -324,7 +324,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 net.sf.gridarta.arch.GameObject defarch) { + public String getAttributeString(String attr, @Nullable final net.sf.gridarta.gameobject.GameObject defarch) { String aText = archText.toString(); // The "real" Archtext from arch & defarch int j; attr = attr.trim() + " "; // attr must be followed by space @@ -377,7 +377,7 @@ } /** {@inheritDoc} */ - public int getAttributeInt(final String attr, final net.sf.gridarta.arch.GameObject defarch) { + public int getAttributeInt(final String attr, final net.sf.gridarta.gameobject.GameObject 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) { @@ -404,7 +404,7 @@ } /** {@inheritDoc} */ - public long getAttributeLong(final String attr, final net.sf.gridarta.arch.GameObject defarch) { + public long getAttributeLong(final String attr, final net.sf.gridarta.gameobject.GameObject defarch) { String aText = archText.toString(); // Add all attributes from defarch that don't already exist in aText if (defarch != null) { @@ -430,7 +430,7 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(final String attr, final net.sf.gridarta.arch.GameObject defarch) { + public double getAttributeDouble(final String attr, final net.sf.gridarta.gameobject.GameObject defarch) { String aText = archText.toString(); // Add all attributes from defarch that don't already exist in aText if (defarch != null) { Modified: trunk/crossfire/src/cfeditor/gameobject/GameObjectIterator.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/GameObjectIterator.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gameobject/GameObjectIterator.java 2006-09-24 17:36:47 UTC (rev 402) @@ -22,7 +22,7 @@ * */ -package cfeditor.arch; +package cfeditor.gameobject; import java.util.Iterator; import java.util.NoSuchElementException; Modified: trunk/crossfire/src/cfeditor/gameobject/GameObjectIteratorDeleteGameMapObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/GameObjectIteratorDeleteGameMapObject.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gameobject/GameObjectIteratorDeleteGameMapObject.java 2006-09-24 17:36:47 UTC (rev 402) @@ -1,6 +1,6 @@ /* $Id: GameObjectIteratorDeleteGameMapObject.java,v 1.1 2006/04/06 17:16:03 akirschbaum Exp $ */ -package cfeditor.arch; +package cfeditor.gameobject; import cfeditor.map.MapModel; import java.util.Iterator; Modified: trunk/crossfire/src/cfeditor/gameobject/GameObjectIteratorDeleteMapGame.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/GameObjectIteratorDeleteMapGame.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gameobject/GameObjectIteratorDeleteMapGame.java 2006-09-24 17:36:47 UTC (rev 402) @@ -1,6 +1,6 @@ /* $Id: GameObjectIteratorDeleteMapGame.java,v 1.1 2006/04/06 17:16:03 akirschbaum Exp $ */ -package cfeditor.arch; +package cfeditor.gameobject; import cfeditor.map.MapModel; import java.awt.Point; Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/anim/AnimationObject.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2006-09-24 17:36:47 UTC (rev 402) @@ -23,7 +23,7 @@ * */ -package cfeditor.arch.anim; +package cfeditor.gameobject.anim; /** * A single animation object. Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2006-09-24 17:36:47 UTC (rev 402) @@ -23,7 +23,7 @@ * */ -package cfeditor.arch.anim; +package cfeditor.gameobject.anim; import java.util.ArrayList; import java.util.Iterator; Modified: trunk/crossfire/src/cfeditor/gui/ArchComboBox.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ArchComboBox.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/gui/ArchComboBox.java 2006-09-24 17:36:47 UTC (rev 402) @@ -9,7 +9,7 @@ import cfeditor.CMainControl; import cfeditor.IGUIConstants; -import cfeditor.arch.GameObject; +import cfeditor.gameobject.GameObject; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-09-24 17:36:47 UTC (rev 402) @@ -27,10 +27,10 @@ import cfeditor.CMainControl; import cfeditor.ExitTypes; import cfeditor.IGUIConstants; -import cfeditor.arch.GameObject; -import cfeditor.arch.GameObjectIterator; -import cfeditor.arch.GameObjectIteratorDeleteGameMapObject; -import cfeditor.arch.GameObjectIteratorDeleteMapGame; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.GameObjectIterator; +import cfeditor.gameobject.GameObjectIteratorDeleteGameMapObject; +import cfeditor.gameobject.GameObjectIteratorDeleteMapGame; import cfeditor.filter.Filter; import cfeditor.filter.FilterConfig; import cfeditor.filter.NamedFilterConfig; Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-09-24 17:36:47 UTC (rev 402) @@ -31,9 +31,9 @@ import net.sf.gridarta.CUndoStack; import cfeditor.IGUIConstants; import cfeditor.GridderException; -import cfeditor.arch.GameObject; -import cfeditor.arch.GameObjectIterator; -import cfeditor.arch.GameObjectIteratorDeleteMapGame; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.GameObjectIterator; +import cfeditor.gameobject.GameObjectIteratorDeleteMapGame; import java.awt.Point; import java.io.File; import java.util.Iterator; Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-09-24 17:36:47 UTC (rev 402) @@ -1,8 +1,8 @@ package cfeditor.map; -import cfeditor.arch.GameObject; -import cfeditor.arch.GameObjectIterator; -import cfeditor.arch.GameObjectIteratorDeleteMapGame; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.GameObjectIterator; +import cfeditor.gameobject.GameObjectIteratorDeleteMapGame; import java.awt.Point; import org.jetbrains.annotations.Nullable; Modified: trunk/crossfire/src/cfeditor/parameter/ArchParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/ArchParameter.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/crossfire/src/cfeditor/parameter/ArchParameter.java 2006-09-24 17:36:47 UTC (rev 402) @@ -10,8 +10,8 @@ import cfeditor.CMainControl; import cfeditor.PluginParameter; import cfeditor.PluginParameterView; -import cfeditor.arch.GameObject; -import cfeditor.arch.ArchetypeSet; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.ArchetypeSet; import org.jdom.Element; import org.jetbrains.annotations.Nullable; Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import daieditor.gui.map.tools.ToolSelectorPane; import java.awt.BorderLayout; import java.util.ArrayList; Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package daieditor; -import daieditor.arch.GameObject; -import daieditor.arch.ArchetypeSet; +import daieditor.gameobject.GameObject; +import daieditor.gameobject.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; Modified: trunk/daimonin/src/daieditor/CArchQuickView.java =================================================================== --- trunk/daimonin/src/daieditor/CArchQuickView.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CArchQuickView.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,26 +24,26 @@ package daieditor; -import daieditor.arch.ArchAttribType; -import static daieditor.arch.ArchAttribType.ANIMNAME; -import static daieditor.arch.ArchAttribType.BITMASK; -import static daieditor.arch.ArchAttribType.BOOL; -import static daieditor.arch.ArchAttribType.BOOL_SPEC; -import static daieditor.arch.ArchAttribType.DBLLIST; -import static daieditor.arch.ArchAttribType.FACENAME; -import static daieditor.arch.ArchAttribType.FIXED; -import static daieditor.arch.ArchAttribType.FLOAT; -import static daieditor.arch.ArchAttribType.INT; -import static daieditor.arch.ArchAttribType.LIST; -import static daieditor.arch.ArchAttribType.LONG; -import static daieditor.arch.ArchAttribType.SPELL; -import static daieditor.arch.ArchAttribType.STRING; -import static daieditor.arch.ArchAttribType.TEXT; -import static daieditor.arch.ArchAttribType.TREASURE; -import static daieditor.arch.ArchAttribType.ZSPELL; -import daieditor.arch.GameObject; -import daieditor.arch.NamedObject; -import daieditor.arch.NamedObjects; +import daieditor.gameobject.ArchAttribType; +import static daieditor.gameobject.ArchAttribType.ANIMNAME; +import static daieditor.gameobject.ArchAttribType.BITMASK; +import static daieditor.gameobject.ArchAttribType.BOOL; +import static daieditor.gameobject.ArchAttribType.BOOL_SPEC; +import static daieditor.gameobject.ArchAttribType.DBLLIST; +import static daieditor.gameobject.ArchAttribType.FACENAME; +import static daieditor.gameobject.ArchAttribType.FIXED; +import static daieditor.gameobject.ArchAttribType.FLOAT; +import static daieditor.gameobject.ArchAttribType.INT; +import static daieditor.gameobject.ArchAttribType.LIST; +import static daieditor.gameobject.ArchAttribType.LONG; +import static daieditor.gameobject.ArchAttribType.SPELL; +import static daieditor.gameobject.ArchAttribType.STRING; +import static daieditor.gameobject.ArchAttribType.TEXT; +import static daieditor.gameobject.ArchAttribType.TREASURE; +import static daieditor.gameobject.ArchAttribType.ZSPELL; +import daieditor.gameobject.GameObject; +import daieditor.gameobject.NamedObject; +import daieditor.gameobject.NamedObjects; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; Modified: trunk/daimonin/src/daieditor/CFArchAttrib.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,23 +24,23 @@ package daieditor; -import daieditor.arch.ArchAttribType; -import static daieditor.arch.ArchAttribType.ANIMNAME; -import static daieditor.arch.ArchAttribType.BITMASK; -import static daieditor.arch.ArchAttribType.BOOL; -import static daieditor.arch.ArchAttribType.BOOL_SPEC; -import static daieditor.arch.ArchAttribType.DBLLIST; -import static daieditor.arch.ArchAttribType.FACENAME; -import static daieditor.arch.ArchAttribType.FIXED; -import static daieditor.arch.ArchAttribType.FLOAT; -import static daieditor.arch.ArchAttribType.INT; -import static daieditor.arch.ArchAttribType.LIST; -import static daieditor.arch.ArchAttribType.LONG; -import static daieditor.arch.ArchAttribType.SPELL; -import static daieditor.arch.ArchAttribType.STRING; -import static daieditor.arch.ArchAttribType.TEXT; -import static daieditor.arch.ArchAttribType.TREASURE; -import static daieditor.arch.ArchAttribType.ZSPELL; +import daieditor.gameobject.ArchAttribType; +import static daieditor.gameobject.ArchAttribType.ANIMNAME; +import static daieditor.gameobject.ArchAttribType.BITMASK; +import static daieditor.gameobject.ArchAttribType.BOOL; +import static daieditor.gameobject.ArchAttribType.BOOL_SPEC; +import static daieditor.gameobject.ArchAttribType.DBLLIST; +import static daieditor.gameobject.ArchAttribType.FACENAME; +import static daieditor.gameobject.ArchAttribType.FIXED; +import static daieditor.gameobject.ArchAttribType.FLOAT; +import static daieditor.gameobject.ArchAttribType.INT; +import static daieditor.gameobject.ArchAttribType.LIST; +import static daieditor.gameobject.ArchAttribType.LONG; +import static daieditor.gameobject.ArchAttribType.SPELL; +import static daieditor.gameobject.ArchAttribType.STRING; +import static daieditor.gameobject.ArchAttribType.TEXT; +import static daieditor.gameobject.ArchAttribType.TREASURE; +import static daieditor.gameobject.ArchAttribType.ZSPELL; import org.w3c.dom.Attr; import org.w3c.dom.Element; Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package daieditor; -import static daieditor.arch.ArchAttribType.TEXT; +import static daieditor.gameobject.ArchAttribType.TEXT; import java.util.ArrayList; import java.util.HashMap; import java.util.List; Modified: trunk/daimonin/src/daieditor/CFArchTypeList.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,9 +24,9 @@ package daieditor; -import daieditor.arch.GameObject; -import daieditor.arch.match.GameObjectMatchers; -import daieditor.arch.match.NamedGameObjectMatcher; +import daieditor.gameobject.GameObject; +import daieditor.gameobject.match.GameObjectMatchers; +import daieditor.gameobject.match.NamedGameObjectMatcher; import java.io.File; import java.io.IOException; import java.util.ArrayList; Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-09-24 17:36:47 UTC (rev 402) @@ -25,7 +25,7 @@ package daieditor; import static daieditor.CGUIUtils.getSysIcon; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import java.awt.BorderLayout; import static java.awt.Color.gray; import java.awt.Component; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-09-24 17:36:47 UTC (rev 402) @@ -28,14 +28,14 @@ import static daieditor.CMainView.MAP_TILE_LIST_BOTTOM_DEFAULT; import static daieditor.CMainView.MAP_TILE_LIST_BOTTOM_KEY; import static daieditor.IGUIConstants.TILE_EDIT_NONE; -import daieditor.arch.GameObject; -import daieditor.arch.ArchObjectParser; -import daieditor.arch.ArchetypeSet; -import daieditor.arch.anim.AnimationObjects; -import daieditor.arch.face.FaceFacade; -import daieditor.arch.face.FaceObjects; -import daieditor.arch.match.MutableOrGameObjectMatcher; -import daieditor.arch.match.ViewGameObjectMatcherManager; +import daieditor.gameobject.GameObject; +import daieditor.gameobject.ArchObjectParser; +import daieditor.gameobject.ArchetypeSet; +import daieditor.gameobject.anim.AnimationObjects; +import daieditor.gameobject.face.FaceFacade; +import daieditor.gameobject.face.FaceObjects; +import daieditor.gameobject.match.MutableOrGameObjectMatcher; +import daieditor.gameobject.match.ViewGameObjectMatcherManager; import daieditor.gui.MapFileFilter; import daieditor.gui.map.MapCursorControl; import daieditor.gui.map.MapPreviewAccessory; Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package daieditor; -import daieditor.arch.GameObject; -import daieditor.arch.ArchetypeSet; +import daieditor.gameobject.GameObject; +import daieditor.gameobject.ArchetypeSet; import daieditor.gui.AboutDialog; import daieditor.map.MapControl; import daieditor.map.validation.ErrorCollector; Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package daieditor; -import daieditor.arch.GameObject; -import daieditor.arch.ArchObjectParser; +import daieditor.gameobject.GameObject; +import daieditor.gameobject.ArchObjectParser; import daieditor.gui.ConnectionView; import daieditor.gui.ErrorListView; import daieditor.map.validation.ErrorCollector; Modified: trunk/daimonin/src/daieditor/CMapFileDecode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,8 +24,8 @@ package daieditor; -import daieditor.arch.GameObject; -import daieditor.arch.ArchObjectParser; +import daieditor.gameobject.GameObject; +import daieditor.gameobject.ArchObjectParser; import daieditor.map.MapArchObject; import java.io.BufferedReader; import java.io.File; Modified: trunk/daimonin/src/daieditor/CMapFileEncode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import daieditor.map.MapArchObject; import daieditor.map.MapModel; import daieditor.map.MapSquare; Modified: trunk/daimonin/src/daieditor/CMapTileList.java =================================================================== --- trunk/daimonin/src/daieditor/CMapTileList.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CMapTileList.java 2006-09-24 17:36:47 UTC (rev 402) @@ -25,7 +25,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import daieditor.map.MapControl; import daieditor.map.MapSquare; import java.awt.BorderLayout; Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import daieditor.gui.map.DefaultLevelRenderer; import daieditor.gui.map.MapUserListener; import daieditor.map.MapControl; Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import daieditor.map.MapArchObject; import daieditor.map.MapControl; import java.io.File; Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-09-24 17:36:47 UTC (rev 402) @@ -25,7 +25,7 @@ package daieditor; import static daieditor.CMainControl.rnd; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import daieditor.map.MapArchObject; import daieditor.map.MapControl; import daieditor.map.MapModel; Modified: trunk/daimonin/src/daieditor/MultiArchData.java =================================================================== --- trunk/daimonin/src/daieditor/MultiArchData.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/MultiArchData.java 2006-09-24 17:36:47 UTC (rev 402) @@ -25,7 +25,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import java.util.ArrayList; /** Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-09-24 17:36:47 UTC (rev 402) @@ -25,7 +25,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import daieditor.map.MapControl; import daieditor.map.MapSquare; import java.awt.FlowLayout; Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,7 +24,7 @@ package daieditor; -import daieditor.arch.GameObject; +import daieditor.gameobject.GameObject; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import java.awt.Color; import java.awt.FlowLayout; Copied: trunk/daimonin/src/daieditor/gameobject (from rev 401, trunk/daimonin/src/daieditor/arch) Modified: trunk/daimonin/src/daieditor/gameobject/ArchAttribType.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchAttribType.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/ArchAttribType.java 2006-09-24 17:36:47 UTC (rev 402) @@ -19,7 +19,7 @@ * */ -package daieditor.arch; +package daieditor.gameobject; /** * Enumeration for Archetype Attribute Types. Modified: trunk/daimonin/src/daieditor/gameobject/ArchObjectParser.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectParser.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/ArchObjectParser.java 2006-09-24 17:36:47 UTC (rev 402) @@ -23,13 +23,13 @@ * */ -package daieditor.arch; +package daieditor.gameobject; import daieditor.CMainControl; import daieditor.IGUIConstants; import daieditor.MultiPositionData; import daieditor.PathManager; -import daieditor.arch.anim.DuplicateAnimationException; +import daieditor.gameobject.anim.DuplicateAnimationException; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchetypeSet.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,21 +24,21 @@ * */ -package daieditor.arch; +package daieditor.gameobject; import daieditor.CFTreasureListTree; import net.sf.gridarta.io.CFileReader; import daieditor.CMainControl; import daieditor.CPickmapPanel; import daieditor.IGUIConstants; -import daieditor.arch.anim.AnimationObject; -import daieditor.arch.anim.AnimationObjects; -import daieditor.arch.anim.AnimationParseException; -import daieditor.arch.anim.DuplicateAnimationException; -import daieditor.arch.face.DuplicateFaceException; -import daieditor.arch.face.FaceFacade; -import daieditor.arch.face.FaceObject; -import daieditor.arch.face.FaceObjects; +import daieditor.gameobject.anim.AnimationObject; +import daieditor.gameobject.anim.AnimationObjects; +import daieditor.gameobject.anim.AnimationParseException; +import daieditor.gameobject.anim.DuplicateAnimationException; +import daieditor.gameobject.face.DuplicateFaceException; +import daieditor.gameobject.face.FaceFacade; +import daieditor.gameobject.face.FaceObject; +import daieditor.gameobject.face.FaceObjects; import daieditor.icons.ArchFaceProvider; import java.io.BufferedOutputStream; import java.io.BufferedReader; Modified: trunk/daimonin/src/daieditor/gameobject/DuplicateArchException.java =================================================================== --- trunk/daimonin/src/daieditor/arch/DuplicateArchException.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/DuplicateArchException.java 2006-09-24 17:36:47 UTC (rev 402) @@ -19,7 +19,7 @@ * */ -package daieditor.arch; +package daieditor.gameobject; /** * Exception that's thrown in case an arch name was not unique. Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/GameObject.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 17:36:47 UTC (rev 402) @@ -23,7 +23,7 @@ * */ -package daieditor.arch; +package daieditor.gameobject; import daieditor.CFArchType; import daieditor.CFArchTypeList; @@ -32,8 +32,8 @@ import daieditor.IGUIConstants; import daieditor.MultiArchData; import daieditor.ScriptArchData; -import daieditor.arch.anim.AnimationObject; -import daieditor.arch.anim.AnimationObjects; +import daieditor.gameobject.anim.AnimationObject; +import daieditor.gameobject.anim.AnimationObjects; import daieditor.map.MapSquare; import java.io.Serializable; import javax.swing.ImageIcon; @@ -54,7 +54,7 @@ * normal arches. * @todo this class is not always the best place for multipart object handling, see also {@link GameObjectContainer} for issues about this */ -public final class GameObject /*extends NamedObject*/ extends GameObjectContainer implements Cloneable, net.sf.gridarta.arch.GameObject, Serializable { +public final class GameObject /*extends NamedObject*/ extends GameObjectContainer implements Cloneable, net.sf.gridarta.gameobject.GameObject, Serializable { /** Serial Version. */ private static final long serialVersionUID = 1L; @@ -329,7 +329,7 @@ } /** {@inheritDoc} */ - @Deprecated public String getAttributeString(final String attr, final net.sf.gridarta.arch.GameObject defarch) { + @Deprecated public String getAttributeString(final String attr, final net.sf.gridarta.gameobject.GameObject defarch) { throw new Error("deprecated and not used in Daimonin"); } @@ -356,7 +356,7 @@ } /** {@inheritDoc} */ - public int getAttributeInt(final String attr, final net.sf.gridarta.arch.GameObject defarch) { + public int getAttributeInt(final String attr, final net.sf.gridarta.gameobject.GameObject 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) { @@ -383,7 +383,7 @@ } /** {@inheritDoc} */ - public long getAttributeLong(final String attr, final net.sf.gridarta.arch.GameObject defarch) { + public long getAttributeLong(final String attr, final net.sf.gridarta.gameobject.GameObject defarch) { String aText = archText.toString(); // Add all attributes from defarch that don't already exist in aText if (defarch != null) { @@ -409,7 +409,7 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(final String attr, final net.sf.gridarta.arch.GameObject defarch) { + public double getAttributeDouble(final String attr, final net.sf.gridarta.gameobject.GameObject defarch) { String aText = archText.toString(); // Add all attributes from defarch that don't already exist in aText if (defarch != null) { Modified: trunk/daimonin/src/daieditor/gameobject/GameObjectContainer.java =================================================================== --- trunk/daimonin/src/daieditor/arch/GameObjectContainer.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/GameObjectContainer.java 2006-09-24 17:36:47 UTC (rev 402) @@ -19,7 +19,7 @@ * */ -package daieditor.arch; +package daieditor.gameobject; import daieditor.map.MapSquare; import java.util.Iterator; Modified: trunk/daimonin/src/daieditor/gameobject/NamedObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/NamedObject.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/NamedObject.java 2006-09-24 17:36:47 UTC (rev 402) @@ -19,15 +19,15 @@ * */ -package daieditor.arch; +package daieditor.gameobject; import javax.swing.ImageIcon; import java.io.Serializable; /** * A <code>NamedObject</code> has a name and tree position source and provides an icon for display. - * <code>NamedObject</code> is the superclass of {@link daieditor.arch.face.FaceObject} and - * {@link daieditor.arch.anim.AnimationObject}. + * <code>NamedObject</code> is the superclass of {@link daieditor.gameobject.face.FaceObject} and + * {@link daieditor.gameobject.anim.AnimationObject}. * @author <a href="mailto:ch...@ri...">Chrsitian Hujer</a> */ public abstract class NamedObject implements Comparable<NamedObject>, Serializable { Modified: trunk/daimonin/src/daieditor/gameobject/NamedObjects.java =================================================================== --- trunk/daimonin/src/daieditor/arch/NamedObjects.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/NamedObjects.java 2006-09-24 17:36:47 UTC (rev 402) @@ -19,7 +19,7 @@ * */ -package daieditor.arch; +package daieditor.gameobject; import java.awt.Component; import java.awt.event.MouseAdapter; Modified: trunk/daimonin/src/daieditor/gameobject/NamedTreeNode.java =================================================================== --- trunk/daimonin/src/daieditor/arch/NamedTreeNode.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/NamedTreeNode.java 2006-09-24 17:36:47 UTC (rev 402) @@ -19,7 +19,7 @@ * */ -package daieditor.arch; +package daieditor.gameobject; import java.util.ArrayList; import static java.util.Arrays.binarySearch; Modified: trunk/daimonin/src/daieditor/gameobject/RecursiveGameObjectIterator.java =================================================================== --- trunk/daimonin/src/daieditor/arch/RecursiveGameObjectIterator.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/RecursiveGameObjectIterator.java 2006-09-24 17:36:47 UTC (rev 402) @@ -1,4 +1,4 @@ -package daieditor.arch; +package daieditor.gameobject; import java.util.Iterator; import java.util.Stack; Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/anim/AnimationObject.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2006-09-24 17:36:47 UTC (rev 402) @@ -24,10 +24,10 @@ * */ -package daieditor.arch.anim; +package daieditor.gameobject.anim; -import daieditor.arch.NamedObject; -import daieditor.arch.face.FaceFacade; +import daieditor.gameobject.NamedObject; +import daieditor.gameobject.face.FaceFacade; import java.util.ArrayList; import java.util.List; import java.io.Serializable; Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-09-24 17:36:47 UTC (rev 402) @@ -23,11 +23,11 @@ * */ -package daieditor.arch.anim; +package daieditor.gameobject.anim; import daieditor.PathManager; import net.sf.gridarta.io.CFileReader; -import daieditor.arch.NamedObjects; +import daieditor.gameobject.NamedObjects; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationParseException.java =================================================================== --- trunk/daimonin/src/daieditor/arch/anim/AnimationParseException.java 2006-09-24 17:15:52 UTC (rev 401) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationParseException.java 2006-09-24 17:36:47 UTC (rev 402) @@ -19,7 +19,7 @@ * */ -package daieditor.arch.anim; +package daieditor.gameobject.anim; import java.io.File; Modified: trunk/daimonin/src/daieditor/gameobject/anim/DuplicateAnimationException.java =================================================================== --- trunk/daimonin/src/daiedi... [truncated message content] |
From: <chr...@us...> - 2006-09-24 19:08:01
|
Revision: 403 http://svn.sourceforge.net/gridarta/?rev=403&view=rev Author: christianhujer Date: 2006-09-24 12:07:06 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Committing progress of clarifying terminology about GameObjectType, Archetype and GameObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapFileDecode.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/ReplaceDialog.java trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gui/ArchComboBox.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/parameter/ArchParameter.java trunk/daimonin/src/daieditor/CArchQuickView.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapFileEncode.java trunk/daimonin/src/daieditor/CMapTileList.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/ArchObjectParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/package.html Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-24 19:07:06 UTC (rev 403) @@ -125,7 +125,7 @@ jlist.nodenr[i] = nbuf[i]; // store nodenr. in the list archstack.getArch(nbuf[i]).setJoinList(jlist); // set the link in the def. arch if (log.isDebugEnabled()) { - log.debug("(" + i + ") arch: '" + archstack.getArch(nbuf[i]).getArchName() + "' -> nr: (" + nbuf[i] + ")"); + log.debug("(" + i + ") arch: '" + archstack.getArch(nbuf[i]).getArchetypeName() + "' -> nr: (" + nbuf[i] + ")"); } } @@ -140,7 +140,7 @@ // add a new archid to the buffer // try to parse the arch node_nr from the hashtable - final int entry = ArchetypeSet.getArchIndex(line); + final int entry = ArchetypeSet.getArchetypeIndex(line); if (entry != -1) { nbuf[count] = entry; @@ -334,7 +334,7 @@ if (arch.getNodeNr() != newNodenr) { // set new archtype arch.setNodeNr(newNodenr); - arch.setArchName(defarch.getArchName()); + arch.setArchetypeName(defarch.getArchetypeName()); // set face of new default arch arch.setFaceNr(defarch.getFaceNr()); Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-24 19:07:06 UTC (rev 403) @@ -199,7 +199,7 @@ for (int i = 0; i < (int) (list.length() / 10.0); i++) { numList[i] = Integer.parseInt(list.substring(10 * i, 5 + 10 * i)); - //log.debug(CMainControl.getInstance().getArchObjectStack().getArch(numList[i]).getArchName()); + //log.debug(CMainControl.getInstance().getArchObjectStack().getArch(numList[i]).getArchetypeName()); } return numList; @@ -277,7 +277,7 @@ mainControl.setStatusText(" " + value.toString() + " "); } mainControl.setPlainFont(this); - setText(arch.getArchName()); + setText(arch.getArchetypeName()); if (arch.getFaceFlag()) { setIcon(mainControl.getNofaceTileIcon()); Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-09-24 19:07:06 UTC (rev 403) @@ -127,15 +127,15 @@ } final GameObject arch = archPart.getHead(); - archArchNameText.setText("<html><font color=black>Arch: " + arch.getArchName() + "</font></html>"); + archArchNameText.setText("<html><font color=black>Arch: " + arch.getArchetypeName() + "</font></html>"); if (arch.getObjName() == null || arch.getObjName().length() <= 0) { - final GameObject def = arch.getDefaultArch(); + final GameObject def = arch.getArchetype(); if (def == null || def == arch) { archObjNameText.setText("<html><font color=black>Name: -none- </font></html>"); } else if (def.getObjName() != null && def.getObjName().length() > 0) { archObjNameText.setText("<html><font color=black>Name: " + def.getObjName() + "</font></html>"); - } else if (def.getArchName() != null && def.getArchName().length() > 0) { - archObjNameText.setText("<html><font color=black>Name: " + def.getArchName() + "</font></html>"); + } else if (def.getArchetypeName() != null && def.getArchetypeName().length() > 0) { + archObjNameText.setText("<html><font color=black>Name: " + def.getArchetypeName() + "</font></html>"); } else { archObjNameText.setText("<html><font color=black>Name: -none- </font></html>"); } Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 19:07:06 UTC (rev 403) @@ -180,7 +180,7 @@ // reference to the GameObject arch = aobj.getHead(); - defarch = arch.getDefaultArch(); + defarch = arch.getArchetype(); /* set frame icon if (arch.getFaceNr() >= 0) { @@ -488,7 +488,7 @@ } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { nameTF = new JTextField(defarch.getObjName(), 16); } else { - nameTF = new JTextField(defarch.getArchName(), 16); + nameTF = new JTextField(defarch.getArchetypeName(), 16); } nameTF.setEditable(false); layout3.add(nameTF); @@ -504,7 +504,7 @@ final JPanel layout4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); layout4.add(new JLabel("Default Arch: ")); // create label - defarchTF = new JTextField(defarch.getArchName(), 16); + defarchTF = new JTextField(defarch.getArchetypeName(), 16); defarchTF.setEditable(false); layout4.add(defarchTF); @@ -771,7 +771,7 @@ } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { dtxt = defarch.getObjName(); } else { - dtxt = defarch.getArchName(); + dtxt = defarch.getArchetypeName(); } } else if (type.getAttr()[i].getNameOld().equalsIgnoreCase("face")) { if (arch.getFaceName() != null && arch.getFaceName().length() > 0) { @@ -1179,7 +1179,7 @@ * @return true if the settings were applied, false if error occurred */ private boolean applySettings() { - final String oldArchText = arch.getArchText(); // the old ArchText + final String oldArchText = arch.getObjectText(); // the old ArchText final String oldMsg = arch.getMsgText(); // old arch msg final CFArchType typeStruct = typelist.getTypeOfArch(arch); // the type structure for this arch @@ -1263,7 +1263,7 @@ } else { newName = ""; } - } else if (!inline.equalsIgnoreCase(defarch.getArchName())) { + } else if (!inline.equalsIgnoreCase(defarch.getArchetypeName())) { newName = inline; } else { newName = ""; @@ -1370,7 +1370,7 @@ errors = arch.getSyntaxErrors(typeStruct); // --- parsing succeeded, now we write it into the arch/map --- - arch.setArchText(newArchText); + arch.setObjectText(newArchText); //arch.setArchTypNr(); if (newName != null) { if (newName.length() == 0) { @@ -1436,8 +1436,8 @@ } // if the archtext changed, set the map changed flag - if ((oldArchText != null && !oldArchText.equals(arch.getArchText())) || - (oldArchText == null && arch.getArchText() != null) || + if ((oldArchText != null && !oldArchText.equals(arch.getObjectText())) || + (oldArchText == null && arch.getObjectText() != null) || (oldMsg != null && !oldMsg.equals(arch.getMsgText())) || (oldMsg == null && arch.getMsgText() != null)) { mainControl.getCurrentMap().setLevelChangedFlag(); Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-24 19:07:06 UTC (rev 403) @@ -533,7 +533,7 @@ CFArchType tmp = head.getNext(); // tmp cycles through all types CFArchType type = tmp; // return value: the type of the arch, first one (misc) if no other found - final GameObject defarch = arch.getDefaultArch(); + final GameObject defarch = arch.getArchetype(); boolean typeFound = false; for (int i = 0; tmp != null && !typeFound; tmp = tmp.getNext(), i++) { Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-09-24 19:07:06 UTC (rev 403) @@ -107,7 +107,7 @@ // Initialise the application mainControl.init(doShow); mainControl.refreshMenusAndToolbars(); - mainControl.getArchObjectStack().loadArches(); + mainControl.getArchObjectStack().loadArchetypes(); System.gc(); // process commandline parameters: Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-24 19:07:06 UTC (rev 403) @@ -983,7 +983,7 @@ } } else if (content.getType() != TreasureObj.FOLDER) { // normal arch: display the face icon - final int num = ArchetypeSet.getArchIndex(content.getName()); + final int num = ArchetypeSet.getArchetypeIndex(content.getName()); if (num != -1 && ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_COMPLETE) { final GameObject arch = CMainControl.getInstance().getArch(num); if (arch != null) { Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 19:07:06 UTC (rev 403) @@ -318,7 +318,7 @@ return; } - archList.collectArches(); + archList.collectArchetypes(); } /** @@ -1048,10 +1048,10 @@ // first: attach our map sucker to a default arch we have loaded for (final Iterator<GameObject> it = objects.iterator(); it.hasNext();) { final GameObject arch = it.next(); - final int index1 = ArchetypeSet.getArchIndex(arch.getArchName()); + final int index1 = ArchetypeSet.getArchetypeIndex(arch.getArchetypeName()); if (index1 == -1) { // we had an unknown arch here!! - // showMessage("Error Loading Map File "+file.getName(), "\n Found Unknown Arch < "+arch.getArchName()+" >"); + // showMessage("Error Loading Map File "+file.getName(), "\n Found Unknown Arch < "+arch.getArchetypeName()+" >"); // return false; } else { arch.setNodeNr(index1); // our default arch! Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 19:07:06 UTC (rev 403) @@ -276,7 +276,7 @@ inv = inv.getHead(); final GameObject invnew; - if (arch.isDefaultArch()) { + if (arch.isArchetype()) { // create a new copy of a default arch invnew = mainControl.getArchObjectStack().newArchObjectInstance(arch.getNodeNr()); } else { @@ -313,7 +313,7 @@ return; } - final String oldArchText = arch.getArchText(); + final String oldArchText = arch.getObjectText(); final String oldMsg = arch.getMsgText(); // We update all panels: name, face, msg and archText (more to come...) @@ -326,7 +326,7 @@ } else { arch.setObjName(archNameField.getText()); // overrule in map arch } - } else if (archNameField.getText().compareTo(arch.getArchName()) == 0) { + } else if (archNameField.getText().compareTo(arch.getArchetypeName()) == 0) { arch.setObjName(null); } else { // def is null, something is in panel, so we set it arch.setObjName(archNameField.getText()); // overrule in map arch @@ -413,7 +413,7 @@ // read from archEdit (bottom right textwin) only the attributes // that differ from the default arch. These get stored into // the arche's archText (and finally in the map). - arch.setArchText(defarch.diffArchText(archEdit.getText(), false)); + arch.setObjectText(defarch.diffArchText(archEdit.getText(), false)); // we look for 'type' in the ArchText. In future maybe type should get // a seperate textfield @@ -425,8 +425,8 @@ arch.calculateEditType(mainControl.getCurrentMap().getActiveEditType()); // if the archtext changed, set the map changed flag - if ((oldArchText != null && !oldArchText.equals(arch.getArchText())) || - (oldArchText == null && arch.getArchText() != null) || + if ((oldArchText != null && !oldArchText.equals(arch.getObjectText())) || + (oldArchText == null && arch.getObjectText() != null) || (oldMsg != null && !oldMsg.equals(arch.getMsgText())) || (oldMsg == null && arch.getMsgText() != null)) { mainControl.getCurrentMap().setLevelChangedFlag(); @@ -733,8 +733,8 @@ archNameField.setForeground(Color.black); if (mainControl.getArch(arch.getNodeNr()).getObjName() == null) { // arch name - if (arch.getArchName() != null) { - archNameField.setText(arch.getArchName()); + if (arch.getArchetypeName() != null) { + archNameField.setText(arch.getArchetypeName()); } else { archNameField.setText(""); } @@ -766,7 +766,7 @@ if (arch.getNodeNr() != -1) { archTypeText.setText("Type: " + mainControl.getArchObjectParser().getArchTypeName(arch.getArchTypNr()) - + " (" + arch.getArchTypNr() + ") [" + arch.getArchName() + "]"); + + " (" + arch.getArchTypNr() + ") [" + arch.getArchetypeName() + "]"); } else { archTypeText.setText("Type: <unknown>"); } @@ -791,8 +791,8 @@ // blue: the "special" attributes, differ from the default archetype StyleConstants.setForeground(currentAttributes, Color.blue); - if (arch.getArchText() != null) { - doc.insertString(doc.getLength(), arch.getArchText(), currentAttributes); + if (arch.getObjectText() != null) { + doc.insertString(doc.getLength(), arch.getObjectText(), currentAttributes); } // doc.insertString(doc.getLength(), "ID#"+arch.getMyID()+ " inv#: "+arch.countInvObjects()+"\n", currentAttributes); @@ -800,8 +800,8 @@ // black: the attributes from the default archetype // that don't exist among the "special" ones StyleConstants.setForeground(currentAttributes, Color.black); - if (arch.getArchText() != null && mainControl.getArchObjectStack().getArch(arch.getNodeNr()) != null) { - doc.insertString(doc.getLength(), arch.diffArchText(mainControl.getArchObjectStack().getArch(arch.getNodeNr()).getArchText(), true), currentAttributes); + if (arch.getObjectText() != null && mainControl.getArchObjectStack().getArch(arch.getNodeNr()) != null) { + doc.insertString(doc.getLength(), arch.diffArchText(mainControl.getArchObjectStack().getArch(arch.getNodeNr()).getObjectText(), true), currentAttributes); } } catch (final BadLocationException e) { // TODO Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-09-24 19:07:06 UTC (rev 403) @@ -161,7 +161,7 @@ arch = new GameObject(); // create a new instance // our arch! it has a name! - arch.setArchName(thisLine.substring(x, thisLine.length())); + arch.setArchetypeName(thisLine.substring(x, thisLine.length())); // ok, we have setup our arch, now check for inventory if (container != null) { @@ -241,7 +241,7 @@ arch.addEventScript(type, path); } } else { - log.warn("Arch " + arch.getArchName() + " has incorrect event code '" + thisLine + "'"); + log.warn("Arch " + arch.getArchetypeName() + " has incorrect event code '" + thisLine + "'"); arch.addArchText(thisLine + "\n"); // keep line, it might have a meaning after all } } else if (thisLine.regionMatches(0, "x ", 0, 2)) { Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-09-24 19:07:06 UTC (rev 403) @@ -138,7 +138,7 @@ * @return true if arch was written successfully */ boolean writeMapArch(final GameObject arch, final boolean isInventory) { - final GameObject defarch = arch.getDefaultArch(); + final GameObject defarch = arch.getArchetype(); // Collect all fields to write. final Map<String, String> fields = new HashMap<String, String>(); // String key -> String value @@ -181,12 +181,12 @@ if (defarch != null && arch.getArchTypNr() != defarch.getArchTypNr()) { // this arch has special type - if (arch.getArchText().indexOf("type ") >= 0) { + if (arch.getObjectText().indexOf("type ") >= 0) { // oh oh - there might also be a type in the archtext which // is conflicting. remove the type from the archtext // open a reading stream for the archText - final StringReader sread = new StringReader(arch.getArchText().toString()); + final StringReader sread = new StringReader(arch.getObjectText().toString()); final BufferedReader sstream = new BufferedReader(sread); String newArchtext = ""; @@ -212,9 +212,9 @@ sread.close(); if (newArchtext.trim().length() == 0) { - arch.setArchText(""); + arch.setObjectText(""); } else { - arch.setArchText(newArchtext.trim() + "\n"); + arch.setObjectText(newArchtext.trim() + "\n"); } } catch (final IOException e) { log.error("getSyntaxErrors: Cannot close StringReader"); @@ -225,7 +225,7 @@ fields.put("type", Integer.toString(arch.getArchTypNr())); } - final String text = arch.getArchText(); + final String text = arch.getObjectText(); if (!text.equals("")) { final String[] tmp = text.split("\n"); for (final String aTmp : tmp) { @@ -257,7 +257,7 @@ // Actually write the fields. try { - bufferedWriter.write("arch " + arch.getArchName() + "\n"); + bufferedWriter.write("arch " + arch.getArchetypeName() + "\n"); for (int i = 0; i < keys.length; i++) { final String value = (String) fields.get(keys[i]); if (value != null) { Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-24 19:07:06 UTC (rev 403) @@ -452,7 +452,7 @@ if (defname != null && defname.length() > 0) { setText(defname); // default name } else { - setText(arch.getArchName()); // arch name + setText(arch.getArchetypeName()); // arch name } } Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-24 19:07:06 UTC (rev 403) @@ -1298,10 +1298,10 @@ if ((insArch = mainControl.getArchPanelSelection()) != null) { if (insArch.getObjName() != null && insArch.getObjName().length() > 0) { insertArchName = mainControl.getArchPanelSelection().getObjName(); - } else if (insArch.getArchName() != null && insArch.getArchName().length() > 0) { - insertArchName = mainControl.getArchPanelSelection().getArchName(); - } else if ((insArch = insArch.getDefaultArch()) != null) { - insertArchName = mainControl.getArchPanelSelection().getArchName(); + } else if (insArch.getArchetypeName() != null && insArch.getArchetypeName().length() > 0) { + insertArchName = mainControl.getArchPanelSelection().getArchetypeName(); + } else if ((insArch = insArch.getArchetype()) != null) { + insertArchName = mainControl.getArchPanelSelection().getArchetypeName(); } else { insertArchName = "unknown"; } @@ -1407,7 +1407,7 @@ GameObject newarch = mainControl.getArchPanelSelection(); if (!mainControl.getMainView().isPickmapActive() || mapControl.isPickmap() || - (newarch != null && newarch.isDefaultArch())) { + (newarch != null && newarch.isArchetype())) { // insert default arch from archlist: if (!mapControl.addArchToMap(mainControl.getPanelArch(), pos, allowMany ? -1 : drawInternCount, MapModel.JOIN_ENABLE)) { // mainControl.getMainView().mapPanel.setMapArchList(null); @@ -1453,7 +1453,7 @@ final GameObject newdef = mapControl.getTopArchObject(pos); // new inserted default arch if (newdef != null) { // now we've got the inserted arch, copy the custom stuff from pickmap - newdef.setArchText(newarch.getArchText()); + newdef.setObjectText(newarch.getObjectText()); newdef.setObjName(newarch.getObjName()); newdef.resetMsgText(); newdef.addMsgText(newarch.getMsgText()); @@ -1519,7 +1519,7 @@ final GameObject newdef = mapControl.getTopArchObject(pos); // new inserted default arch if (newdef != null) { // now we've got the inserted arch, copy the custom stuff from pickmap - newdef.setArchText(newarch.getArchText()); + newdef.setObjectText(newarch.getObjectText()); newdef.setObjName(newarch.getObjName()); newdef.resetMsgText(); newdef.addMsgText(newarch.getMsgText()); Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-24 19:07:06 UTC (rev 403) @@ -357,11 +357,11 @@ */ private void addArchToMap(final MapControl mapControl, final GameObject arch, final Point pos, final int intern, final boolean fillBelow) { final GameObject newHead; - if (arch.isDefaultArch()) { + if (arch.isArchetype()) { mapControl.addArchToMap(arch.getNodeNr(), pos, intern, false, fillBelow); } else { newHead = arch.createClone(pos.x, pos.y); - for (GameObject tmp = arch.getDefaultArch().getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { + for (GameObject tmp = arch.getArchetype().getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { final GameObject newTail = mainControl.getArchObjectStack().newArchObjectInstance(tmp.getNodeNr()); final Point mapPos = new Point(pos.x + newTail.getMultiX(), pos.y + newTail.getMultiY()); Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-09-24 19:07:06 UTC (rev 403) @@ -329,8 +329,8 @@ while (it.hasNext()) { final GameObject node = it.next(); if (node.isHead() && - ((matchCriteria == MATCH_ARCH_NAME && node.getArchName() != null && - node.getArchName().equalsIgnoreCase(matchString)) || + ((matchCriteria == MATCH_ARCH_NAME && node.getArchetypeName() != null && + node.getArchetypeName().equalsIgnoreCase(matchString)) || (matchCriteria == MATCH_OBJ_NAME && node.getBestName().equalsIgnoreCase(matchString)))) { // first, delete the old arch Modified: trunk/crossfire/src/cfeditor/filter/AttributeFilter.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-09-24 19:07:06 UTC (rev 403) @@ -61,7 +61,7 @@ final Set<Map.Entry<String, String>> pairs = attrList.entrySet(); if (!pairs.isEmpty()) { hasChecked = true; - final GameObject def = object.getDefaultArch(); + final GameObject def = object.getArchetype(); for (final Map.Entry<String, String> ent : pairs) { final String key = ent.getKey(); final String val = ent.getValue(); Modified: trunk/crossfire/src/cfeditor/filter/NamedFilterList.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-09-24 19:07:06 UTC (rev 403) @@ -103,7 +103,7 @@ public boolean match(final FilterConfig config, final GameObject object) { try { if (log.isDebugEnabled()) { - log.debug("match called on " + object.getArchName()); + log.debug("match called on " + object.getArchetypeName()); } final NamedFilterConfig nfc = (NamedFilterConfig) config; for (final String name: subFilters.keySet()) { Modified: trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java 2006-09-24 19:07:06 UTC (rev 403) @@ -245,9 +245,9 @@ } if (archName == null) { - arch.setArchName(thisLine.substring(7)); + arch.setArchetypeName(thisLine.substring(7)); } else { - arch.setArchName(archName); + arch.setArchetypeName(archName); } } } else { @@ -259,9 +259,9 @@ } } else if (animflag) { if (thisLine.startsWith("mina")) { - mainControl.getAnimationObject().addAnimObject(arch.getArchName(), arch.getAnimText()); + mainControl.getAnimationObject().addAnimObject(arch.getArchetypeName(), arch.getAnimText()); - arch.addArchText("animation " + arch.getArchName() + "\n"); + arch.addArchText("animation " + arch.getArchetypeName() + "\n"); // here we must add this to AnimationObject // and add Animation cmd here! animflag = false; @@ -279,7 +279,7 @@ } else if (thisLine.startsWith("end")) { //if (arch.getArchTypNr() == 0) { if (log.isDebugEnabled()) { - log.debug("Arch " + arch.getArchName() + " has no type info!"); + log.debug("Arch " + arch.getArchetypeName() + " has no type info!"); } //} // we got full arch @@ -292,7 +292,7 @@ mainControl.incArchObjCount(); // add arch to the archpanel - only if it is not the map arch - if (!arch.getArchName().equals(STARTARCH_NAME)) { + if (!arch.getArchetypeName().equals(STARTARCH_NAME)) { if (!ArchetypeSet.isLoadedFromArchive() || archName != null) { // loading from individual files, so we simply add it to list // ArchetypeSet.loadArchFromFiles() takes care of the panels @@ -341,7 +341,7 @@ if (archName != null) { arch.setArtifact(true); // here we add all unchanged arch text lines from defArch back to arch - arch.addArchText(arch.diffArchText(defArch.getArchText(), true)); + arch.addArchText(arch.diffArchText(defArch.getObjectText(), true)); return arch; } archlast = arch; @@ -359,29 +359,29 @@ loreflag = true; } else if (thisLine.startsWith("visibility ")) { if (log.isDebugEnabled()) { - log.debug("Remove visibility: " + arch.getArchName()); + log.debug("Remove visibility: " + arch.getArchetypeName()); } } else if (thisLine.startsWith("magicmap ")) { if (log.isDebugEnabled()) { - log.debug("Remove magicmap: " + arch.getArchName()); + log.debug("Remove magicmap: " + arch.getArchetypeName()); } } else if (thisLine.startsWith("color_fg ")) { if (log.isDebugEnabled()) { - log.debug("Remove color_fg: " + arch.getArchName()); + log.debug("Remove color_fg: " + arch.getArchetypeName()); } } else if (thisLine.startsWith("color_bg ")) { if (log.isDebugEnabled()) { - log.debug("Remove color_bg: " + arch.getArchName()); + log.debug("Remove color_bg: " + arch.getArchetypeName()); } } else if (thisLine.startsWith("x ")) { - if (!archmore && !arch.getArchName().equals(STARTARCH_NAME)) { - log.warn("Find x cmd in single tile or head (add it to arch text): " + arch.getArchName()); + if (!archmore && !arch.getArchetypeName().equals(STARTARCH_NAME)) { + log.warn("Find x cmd in single tile or head (add it to arch text): " + arch.getArchetypeName()); arch.addArchText(thisLine + "\n"); } arch.setMultiX(Integer.parseInt(thisLine.substring(2))); } else if (thisLine.startsWith("y ")) { - if (!archmore && !arch.getArchName().equals(STARTARCH_NAME)) { - log.warn("Find y cmd in single tile or head (add it to arch text): " + arch.getArchName()); + if (!archmore && !arch.getArchetypeName().equals(STARTARCH_NAME)) { + log.warn("Find y cmd in single tile or head (add it to arch text): " + arch.getArchetypeName()); arch.addArchText(thisLine + "\n"); } arch.setMultiY(Integer.parseInt(thisLine.substring(2))); @@ -390,10 +390,10 @@ final int i = Integer.parseInt(thisLine.substring(5)); arch.setArchTypNr(i); if (i == 0) { - log.warn("Arch " + arch.getArchName() + " type number is zero. (" + thisLine.substring(5) + ")"); + log.warn("Arch " + arch.getArchetypeName() + " type number is zero. (" + thisLine.substring(5) + ")"); } } catch (final Exception e) { - log.warn("Arch " + arch.getArchName() + " has a invalid type nr. (" + thisLine.substring(5) + ")"); + log.warn("Arch " + arch.getArchetypeName() + " has a invalid type nr. (" + thisLine.substring(5) + ")"); arch.addArchText(thisLine + "\n"); } } else if (thisLine.startsWith("face ")) { @@ -432,7 +432,7 @@ * @param arch default arch to be parsed */ public static void postParseDefArch(final GameObject arch) { - final String text = arch.getArchText(); + final String text = arch.getObjectText(); arch.resetArchText(); final int len = text.length(); @@ -496,7 +496,7 @@ return; } - final String text = arch.getArchText(); + final String text = arch.getObjectText(); final int len = text.length(); final GameObject defarch = mainControl.getArch(arch.getNodeNr()); Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-09-24 19:07:06 UTC (rev 403) @@ -61,7 +61,7 @@ import net.sf.gridarta.io.CFileReader; /** - * The <code>ArchetypeSet</code> contains all the default arches. + * The <code>ArchetypeSet</code> contains all the Archetypes. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ @@ -69,7 +69,7 @@ private static final Logger log = Logger.getLogger(ArchetypeSet.class); - // load status: is archstack fully loaded? + // load status: is the ArchetypeSet fully loaded? public static final int IS_EMPTY = 0; public static final int IS_LOADING = 1; @@ -79,13 +79,13 @@ private static int loadStatus = IS_EMPTY; /** - * true when arches were loaded from the big collected archive files, - * false when arches were loaded from individual archfiles + * true when Archetypes were loaded from the big collected archive files, + * false when Archetypes were loaded from individual .arc-files */ private static boolean loadedFromArchive = false; // this is the static part.. i want fast access later - private final ArchObjectNode[] archNodeList = new ArchObjectNode[10000]; + private final ArchtypeNode[] archNodeList = new ArchtypeNode[10000]; private final FaceObject[] faceObjects = new FaceObject[10000]; @@ -94,9 +94,9 @@ // in the table is faster than in the static arrays, we can change this private static final Map<String, Integer> faceMap = new HashMap<String, Integer>(); - private static final Map<String, Integer> archMap = new HashMap<String, Integer>(); + private static final Map<String, Integer> archetypeMap = new HashMap<String, Integer>(); - private int archNodeListCount; // ALL default arches loaded + private int archetypeNodeListCount; // ALL default arches loaded private int archObjCount; // all objects, multi tile arches = 1 object @@ -107,15 +107,15 @@ private int folderLevel; /** - * Create the GameObject stack. + * Create the ArchetypeSet. * @param mainControl reference to CMainControl */ public ArchetypeSet(final CMainControl mainControl) { this.mainControl = mainControl; - archNodeListCount = 0; + archetypeNodeListCount = 0; faceListCount = 0; archObjCount = 0; - GameObject.setArchStack(this); // add static reference to GameObject + GameObject.setArchetypeSet(this); // add static reference to GameObject } public void incArchObjCount() { @@ -148,12 +148,12 @@ } /** Returns the index of an arch in the arch map or -1. - * @param archName name of arch to get index for + * @param archetypeName name of arch to get index for * @return index of arch in map or -1 if arch is not in map * @deprecated the index system is slow and unmaintainable and therefore will be removed */ - @Deprecated public static int getArchIndex(final String archName) { - return archMap.containsKey(archName) ? archMap.get(archName) : -1; + @Deprecated public static int getArchetypeIndex(final String archetypeName) { + return archetypeMap.containsKey(archetypeName) ? archetypeMap.get(archetypeName) : -1; } @Nullable public ImageIcon getFace(final int i) { @@ -173,43 +173,54 @@ } public int getArchCount() { - return archNodeListCount; + return archetypeNodeListCount; } public int getFaceCount() { return faceListCount; } - @Nullable public ArchObjectNode getNextNode(final ArchObjectNode node) { + @Nullable public ArchtypeNode getNextNode(final ArchtypeNode node) { if (node == null) { return archNodeList[0]; } - final int i = node.arch.getNodeNr(); - if (i + 1 < archNodeListCount) { + final int i = node.archtypeData.getNodeNr(); + if (i + 1 < archetypeNodeListCount) { return archNodeList[i + 1]; } return null; } + /** + * Get the Archetype with the specified internal index as GameObject (not yet instanciated). + * @param i internal Archetype index + * @return GameObject with Archetype information + * @see #newArchObjectInstance(int) for a similar method that instanciates. + */ @Nullable public GameObject getArch(final int i) { - if (i >= 0 && i < archNodeListCount) { - return archNodeList[i].arch; + if (i >= 0 && i < archetypeNodeListCount) { + return archNodeList[i].archtypeData; } return null; } + /** + * Create a GameObject for the specified Archetype internal index. + * @param i internal Archetype index + * @return GameObject instanciated from the specified Archetype + */ @Nullable public GameObject newArchObjectInstance(final int i) { - if (i < 0 && i >= archNodeListCount) { + if (i < 0 && i >= archetypeNodeListCount) { return null; } - final GameObject template = archNodeList[i].arch; + final GameObject template = archNodeList[i].archtypeData; final GameObject arch = new GameObject(); - arch.setArchName(template.getArchName()); + arch.setArchetypeName(template.getArchetypeName()); if (!template.getFaceFlag()) { arch.setFaceNr(template.getFaceNr()); } @@ -222,21 +233,21 @@ /** * Adds an GameObject to the stack. - * Only invoke this method if the GameObject is a default arch. + * Only invoke this method if the GameObject is an Archetype. * Do not invoke this method on map arches. * @param data GameObject with DefaultArch to add * @todo check whether the GameObject is a default arch and reject no default arches with an exception */ public void addArchToList(final GameObject data) { - final ArchObjectNode newnode = new ArchObjectNode(data); - archMap.put(data.getArchName(), archNodeListCount); - archNodeList[archNodeListCount++] = newnode; - newnode.arch.setNodeNr(archNodeListCount - 1); - assert newnode.arch.isDefaultArch(); + final ArchtypeNode newnode = new ArchtypeNode(data); + archetypeMap.put(data.getArchetypeName(), archetypeNodeListCount); + archNodeList[archetypeNodeListCount++] = newnode; + newnode.archtypeData.setNodeNr(archetypeNodeListCount - 1); + assert newnode.archtypeData.isArchetype(); } /** load the arches */ - public void loadArches() { + public void loadArchetypes() { final Date timeStart = new Date(); // get starting time loadStatus = IS_LOADING; // status: loading log.info("Start to collect arches..."); @@ -252,7 +263,7 @@ if (mainControl.isArchLoadedFromCollection()) { loadArchFromCollected(); // collect arches & images from collection } else { - loadArchFromFiles(f, 0); // collect arches & images from individual files + loadArchetypesFromFiles(f, 0); // collect arches & images from individual files } CMainStatusbar.getInstance().setText(" Sorting..."); @@ -321,7 +332,7 @@ * @param f file path where we currently are * @param index counter for arches */ - private void loadArchFromFiles(final File f, int index) { + private void loadArchetypesFromFiles(final File f, int index) { final String name = f.getName(); loadedFromArchive = false; // don't load from the collected files @@ -343,7 +354,7 @@ if (children != null) { Arrays.sort(children); for (int i = 0; i < children.length; i++) { - loadArchFromFiles(new File(f, children[i]), index); + loadArchetypesFromFiles(new File(f, children[i]), index); } } folderLevel--; @@ -618,14 +629,14 @@ int i, s; // run through arches - for (s = 0; s < archNodeListCount; s++) { - final String aname = archNodeList[s].arch.getFaceName(); + for (s = 0; s < archetypeNodeListCount; s++) { + final String aname = archNodeList[s].archtypeData.getFaceName(); if (aname != null) { final Integer num = (Integer) faceMap.get(aname); if (num != null) { - archNodeList[s].arch.setFaceNr(num); + archNodeList[s].archtypeData.setFaceNr(num); } - archNodeList[s].arch.setFaceFlag(false); + archNodeList[s].archtypeData.setFaceFlag(false); } } } @@ -634,8 +645,8 @@ * Wrapper method for arch collecting. Either Crossfire or Daimonin method * for collecting arches is chosen here. */ - public void collectArches() { - collectCFArches(); + public void collectArchetypes() { + collectCrossfireArchetypes(); } /** @@ -644,12 +655,12 @@ * variable included which is used in the editor to categorize the arches. * <p/> Output is: "archetypes", "crossfire.png" */ - private void collectCFArches() { + private void collectCrossfireArchetypes() { CMainStatusbar.getInstance().setText("Collect Archfile: write archetypes"); // open the process bar final CollectProgressBar pbar = new CollectProgressBar(mainControl.getArchObjectStack().getArchCount(), - "Collecting Arches..."); + "Collecting Archetypes..."); File dfile; try { @@ -692,7 +703,7 @@ log.error("Collect Error: Multipart Tail in Panel found!"); } - out.writeBytes("Object " + arch.getArchName() + "\n"); + out.writeBytes("Object " + arch.getArchetypeName() + "\n"); if (arch.getObjName() != null) { out.writeBytes("name " + arch.getObjName() + "\n"); @@ -712,8 +723,8 @@ out.writeBytes("msg\n" + arch.getMsgText().trim() + "\nendmsg\n"); } - out.writeBytes(arch.getArchText()); - if (arch.getArchText().lastIndexOf(0x0a) != arch.getArchText().length() - 1) { + out.writeBytes(arch.getObjectText()); + if (arch.getObjectText().lastIndexOf(0x0a) != arch.getObjectText().length() - 1) { out.writeBytes("\n"); } @@ -734,14 +745,14 @@ log.warn("Multipart object is too short!"); final GameObject before = mainControl.getArch(numList[i]); if (before != null) { - log.warn("-> " + multiparts + " tails expected for multipart: '" + before.getArchName() + "',"); - log.warn(" but arch '" + tail.getArchName() + "' follows on position " + j + " and it's not a tail."); + log.warn("-> " + multiparts + " tails expected for multipart: '" + before.getArchetypeName() + "',"); + log.warn(" but arch '" + tail.getArchetypeName() + "' follows on position " + j + " and it's not a tail."); } } out.writeBytes("More\n"); - out.writeBytes("Object " + tail.getArchName() + "\n"); + out.writeBytes("Object " + tail.getArchetypeName() + "\n"); if (tail.getObjName() != null) { out.writeBytes("name " + tail.getObjName() + "\n"); @@ -756,8 +767,8 @@ // special: add a string-attribute with the display-category //out.writeBytes("editor_folder "+node.getTitle()+"/"+catList[i]+"\n"); - out.writeBytes(tail.getArchText()); - if (tail.getArchText().lastIndexOf(0x0a) != tail.getArchText().length() - 1) { + out.writeBytes(tail.getObjectText()); + if (tail.getObjectText().lastIndexOf(0x0a) != tail.getObjectText().length() - 1) { out.writeBytes("\n"); } @@ -782,17 +793,17 @@ boolean maparchFound = false; for (int i = 0; i < mainControl.getArchCount() && !maparchFound; i++) { arch = mainControl.getArch(i); - if (arch.getArchName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { + if (arch.getArchetypeName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { // process map arch maparchFound = true; count++; - out.writeBytes("Object " + arch.getArchName() + "\n"); + out.writeBytes("Object " + arch.getArchetypeName() + "\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().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { + if (arch.getArchetypeName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { out.writeBytes("x " + arch.getMultiX() + "\n"); out.writeBytes("y " + arch.getMultiY() + "\n"); } @@ -807,8 +818,8 @@ out.writeBytes("type " + arch.getArchTypNr() + "\n"); } - out.writeBytes(arch.getArchText()); - if (arch.getArchText().lastIndexOf(0x0a) != arch.getArchText().length() - 1) { + out.writeBytes(arch.getObjectText()); + if (arch.getObjectText().lastIndexOf(0x0a) != arch.getObjectText().length() - 1) { out.writeBytes("\n"); } @@ -818,7 +829,7 @@ // check if we still missed any arches if (count - mainControl.getArchCount() != 0) { - log.warn((mainControl.getArchCount() - count) + " arches have been missed during collect!"); + log.warn((mainControl.getArchCount() - count) + " archetypes have been missed during collect!"); } pbar.setValue(count); @@ -963,7 +974,7 @@ log.error("Exception collecting images", e); } - CMainStatusbar.getInstance().setText("Collect Arches: done."); + CMainStatusbar.getInstance().setText("Collect Archetypes: done."); } /** @@ -1053,17 +1064,17 @@ } } // class CollectProgressBar - public class ArchObjectNode { + public class ArchtypeNode { - final GameObject arch; + final GameObject archtypeData; - final ArchObjectNode next; + final ArchtypeNode next; - public ArchObjectNode(final GameObject data) { - this.arch = data; + public ArchtypeNode(final GameObject data) { + this.archtypeData = data; this.next = null; } - } // class ArchObjectNode + } // class ArchtypeNode } // class ArchetypeSet Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 17:36:47 UTC (rev 402) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 19:07:06 UTC (rev 403) @@ -55,8 +55,8 @@ /** 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 ArchetypeSet archstack; + /** Static reference to the ArchetypeSet (Archetypes). */ + private static ArchetypeSet archetypeSet; /** Static reference to the typeList (find syntax errors). */ private static CFArchTypeList typeList; @@ -68,20 +68,24 @@ private String faceName; // face name : 1 - private String archName; // arch Name + /** + * The name of the Archetype this GameObject is based on. + * It is the String value of the attribute <code>arch</code> that also starts a GameObject. + */ + private String archetypeName; // arch Name /** The name of this object. */ private String objName; /** - * The archText. + * The objectText. * <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. */ - private StringBuffer archText; + private StringBuffer objectText; /** * The msgText. @@ -104,8 +108,8 @@ private int nodenr; // we are (internal) arch nr in node list // the nodenr determines the (default) archetype - /** The default arch. */ - private GameObject defaultArch; + /** The Archetype of this GameObject. */ + private GameObject archetype; /** Map x position if on map. */ private int mapx; @@ -178,10 +182,10 @@ myId = myIdCounter++; // increase ID counter for every new arch created - archName = null; - archText = new StringBuffer(""); + archetypeName = null; + objectText = new StringBuffer(""); msgText = animText = loreText = null; - archTextCount = 0; // lines inserted in archText + archTextCount = 0; // lines inserted in objectText objName = null; @@ -203,9 +207,12 @@ editType = 0; } - // set static references: arch stack and typeList - public static void setArchStack(final ArchetypeSet stack) { - archstack = stack; + /** + * Set the ArchetypeSet to get information on Archetypes. + * @param archetypeSet ArchetypeSet + */ + public static void setArchetypeSet(final ArchetypeSet archetypeSet) { + GameObject.archetypeSet = archetypeSet; } public static void setTypeList(final CFArchTypeList tlist) { @@ -222,26 +229,19 @@ return editType; } - /** - * Get the default arch of this arch. - * @return the default <code>GameObject</code> for this arch - */ - public GameObject getDefaultArch() { - return defaultArch; + /** {@inheritDoc} */ + public GameObject getArchetype() { + return archetype; } - /** - * Check whether this GameObject is a default arch. - * @return <code>true</code> when this GameObject is a default arch (from - * the {@link ArchetypeSet}), otherwise <code>false</code> - */ - public boolean isDefaultArch() { - return defaultArch == this; + /** {@inheritDoc} */ + public boolean isArchetype() { + return archetype == this; } /** * Get the EditType of an GameObject (e.g. floor, monster, etc). These are - * determined by the various attributes of the arch (->archText). + * determined by the various attributes of the arch (->objectText). * @param checkType bitmask containing the edit type(s) to be calculated * @return new editType for this arch */ @@ -315,76 +315,68 @@ return editType; } - /** - * 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 <string>" - * @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(String attr, @Nullable final net.sf.gridarta.gameobject.GameObject defarch) { - String aText = archText.toString(); // The "real" Archtext from arch & defarch + /** {@inheritDoc} */ + public String getAttributeString(String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + String aText = objectText.toString(); // The "real" Archtext from arch & archetype int j; - attr = attr.trim() + " "; // attr must be followed by space + attributeName = attributeName.trim() + " "; // attributeName must be followed by space String result = ""; - if (defarch == getDefaultArch()) { - result = getCachedAttributeValue(attr); + if (archetype == getArchetype()) { + result = getCachedAttributeValue(attributeName); if (result != null) { return result; ... [truncated message content] |
From: <chr...@us...> - 2006-09-24 19:27:47
|
Revision: 405 http://svn.sourceforge.net/gridarta/?rev=405&view=rev Author: christianhujer Date: 2006-09-24 12:27:28 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Some unification work of cf/dai GameObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapFileEncode.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 19:13:06 UTC (rev 404) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 19:27:28 UTC (rev 405) @@ -42,6 +42,7 @@ import javax.swing.JList; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * The <code>GameObject</code> class handles the Crossfire arch objects. @@ -109,7 +110,7 @@ // the nodenr determines the (default) archetype /** The Archetype of this GameObject. */ - private GameObject archetype; + @NotNull private GameObject archetype; /** Map x position if on map. */ private int mapx; @@ -219,32 +220,41 @@ typeList = tlist; } - /** - * Returns edit Type. - * @return edit Type - */ - // edit type is the editable value from arch - // here it is used to identify the layer type - public int getEditType() { - return editType; - } - /** {@inheritDoc} */ public GameObject getArchetype() { return archetype; } + /** {@inheritDoc} + * @note DO NOT INVOKE DIRECTLY YET! + */ + public void setArchetype(final GameObject archetype) { + this.archetype = archetype; + } + + /** {@inheritDoc} + * @note DO NOT INVOKE DIRECTLY YET! + */ + public void setArchetype(final net.sf.gridarta.gameobject.GameObject archetype) { + this.archetype = (GameObject) archetype; + } + /** {@inheritDoc} */ public boolean isArchetype() { return archetype == this; } - /** - * Get the EditType of an GameObject (e.g. floor, monster, etc). These are - * determined by the various attributes of the arch (->objectText). - * @param checkType bitmask containing the edit type(s) to be calculated - * @return new editType for this arch - */ + /** {@inheritDoc} */ + public int getEditType() { + return editType; + } + + /** {@inheritDoc} */ + public void setEditType(final int editType) { + this.editType = editType; + } + + /** {@inheritDoc} */ public int calculateEditType(final int checkType) { // 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, @@ -369,7 +379,7 @@ } /** {@inheritDoc} */ - public int getAttributeInt(final String attributeName, final net.sf.gridarta.gameobject.GameObject archetype) { + public int getAttributeInt(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -396,7 +406,7 @@ } /** {@inheritDoc} */ - public long getAttributeLong(final String attributeName, final net.sf.gridarta.gameobject.GameObject archetype) { + public long getAttributeLong(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -422,7 +432,7 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(final String attributeName, final net.sf.gridarta.gameobject.GameObject archetype) { + public double getAttributeDouble(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -447,14 +457,6 @@ return getAttributeDouble(attributeName, queryArchetype ? archetype : null); } - /** - * Sets edit Type. - * @param editType edit Type. - */ - public void setEditType(final int editType) { - this.editType = editType; - } - /** {@inheritDoc} */ public GameObject getContainer() { return env; @@ -906,20 +908,6 @@ setArchetype(archetypeSet.getArch(nodenr)); } - /** {@inheritDoc} - * @note DO NOT INVOKE DIRECTLY YET! - */ - public void setArchetype(final GameObject archetype) { - this.archetype = archetype; - } - - /** {@inheritDoc} - * @note DO NOT INVOKE DIRECTLY YET! - */ - public void setArchetype(final net.sf.gridarta.gameobject.GameObject archetype) { - this.archetype = (GameObject) archetype; - } - /* Get Node number. Node number is the index of the default arch node list */ public int getNodeNr() { return nodenr; Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-24 19:13:06 UTC (rev 404) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-24 19:27:28 UTC (rev 405) @@ -1229,7 +1229,7 @@ errors = arch.getSyntaxErrors(typeStruct); // --- parsing succeeded, now we write it into the arch/map --- - arch.setArchText(newArchText); + arch.setObjectText(newArchText); //arch.setArchTypNr(); if (newName != null) { if (newName.length() == 0) { Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-09-24 19:13:06 UTC (rev 404) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-09-24 19:27:28 UTC (rev 405) @@ -398,7 +398,7 @@ // read from archEdit (bottom right textwin) only the attributes // that differ from the default arch. These get stored into // the arche's archText (and finally in the map). - arch.setArchText(defarch.diffArchText(archEdit.getText(), false)); + arch.setObjectText(defarch.diffArchText(archEdit.getText(), false)); /* check we have a face and set the real face obj for fast access */ final String face = arch.getAttributeString("face", false); Modified: trunk/daimonin/src/daieditor/CMapFileEncode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-09-24 19:13:06 UTC (rev 404) +++ trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-09-24 19:27:28 UTC (rev 405) @@ -147,7 +147,7 @@ newArchText.append(line).append('\n'); } } - arch.setArchText(newArchText.toString()); + arch.setObjectText(newArchText.toString()); } // now append the type to the archtext Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 19:13:06 UTC (rev 404) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 19:27:28 UTC (rev 405) @@ -81,10 +81,10 @@ private String animName; /** - * The archText with the differences from the default arch. - * @note Every line in the archText must end on '\n', including the last line. + * The objectText with the differences from the default arch. + * @note Every line in the objectText must end on '\n', including the last line. */ - @NotNull private StringBuffer archText; + @NotNull private StringBuffer objectText; /** * The msgText. @@ -182,7 +182,7 @@ /** Create an GameObject. */ public GameObject() { - archText = new StringBuffer(); + objectText = new StringBuffer(); faceobjdesc = FaceDesc.FACE_NOT_FOUND; archType = TYPE_UNSET; // type must be set script = new ScriptArchData(this); @@ -192,16 +192,6 @@ typeList = tlist; } - /** - * Returns edit Type. - * @return edit Type - */ - // edit type is the editable value from arch - // here it is used to identify the layer type - public int getEditType() { - return editType; - } - /** {@inheritDoc} */ public GameObject getArchetype() { return archetype; @@ -247,11 +237,18 @@ return archetype == other.archetype; } + /** {@inheritDoc} */ + public int getEditType() { + return editType; + } + + /** {@inheritDoc} */ + public void setEditType(final int editType) { + this.editType = editType; + } + /** - * Get the EditType of an GameObject (e.g. floor, monster, etc). These are - * determined by the various attributes of the arch (->archText). - * @param checkType bitmask containing the edit type(s) to be calculated - * @return new editType for this arch + * {@inheritDoc} * @deprecated use arch object matchers, this method will be removed */ @Deprecated public int calculateEditType(final int checkType) { @@ -324,13 +321,13 @@ } /** {@inheritDoc} */ - @Deprecated public String getAttributeString(final String attributeName, final net.sf.gridarta.gameobject.GameObject archetype) { + public String getAttributeString(String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { throw new Error("deprecated and not used in Daimonin"); } /** {@inheritDoc} */ public String getAttributeString(final String attributeName, final boolean queryArchetype) { - String aText = archText.toString(); // The "real" Archtext from arch & archetype + String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (queryArchetype) { aText += diffArchText(archetype.getObjectText(), true); @@ -351,8 +348,8 @@ } /** {@inheritDoc} */ - public int getAttributeInt(final String attributeName, final net.sf.gridarta.gameobject.GameObject archetype) { - String aText = archText.toString(); // The "real" Archtext from arch & rchetypea + public int getAttributeInt(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (archetype != null) { aText += diffArchText(archetype.getObjectText(), true); @@ -378,8 +375,8 @@ } /** {@inheritDoc} */ - public long getAttributeLong(final String attributeName, final net.sf.gridarta.gameobject.GameObject archetype) { - String aText = archText.toString(); + public long getAttributeLong(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { aText += diffArchText(archetype.getObjectText(), true); @@ -404,8 +401,8 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(final String attributeName, final net.sf.gridarta.gameobject.GameObject archetype) { - String aText = archText.toString(); + public double getAttributeDouble(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { aText += diffArchText(archetype.getObjectText(), true); @@ -429,14 +426,6 @@ return getAttributeDouble(attributeName, queryArchetype ? archetype : null); } - /** - * Sets edit Type. - * @param editType edit Type. - */ - public void setEditType(final int editType) { - this.editType = editType; - } - /** {@inheritDoc} */ public GameObjectContainer getContainer() { return container; @@ -887,26 +876,26 @@ * @param text text to add */ public void addArchText(final String text) { - archText.append(text); + objectText.append(text); } /** * Set <var>text</var> as arch text of this arch. - * @param archText text to set as arch text + * @param objectText text to set as arch text */ - public void setArchText(final String archText) { + public void setObjectText(final String objectText) { resetArchText(); - this.archText.append(archText); + this.objectText.append(objectText); } /** {@inheritDoc} */ public String getObjectText() { - return archText.toString(); + return objectText.toString(); } /** Clears the arch text of this arch. */ public void resetArchText() { - archText.delete(0, archText.length()); + objectText.delete(0, objectText.length()); } /** @@ -1161,8 +1150,8 @@ final GameObject clone = clone(); // The clone is a new object! // Clone Recursion for complex types - if (archText != null) { // Arch Text differences - clone.archText = new StringBuffer(archText); + if (objectText != null) { // Arch Text differences + clone.objectText = new StringBuffer(objectText); } if (msgText != null) { // Message text clone.msgText = new StringBuffer(msgText); @@ -1258,8 +1247,8 @@ } /** - * This method checks the archText for syntax errors. More precisely: It - * reads every line in the archText and looks if it matches the + * This method checks the objectText for syntax errors. More precisely: It + * reads every line in the objectText and looks if it matches the * type-definitions (-> see CFArchTypeList) for this arch. If there is no * match, the line is considered wrong. Of course the type-definitions will * never be perfect, this should be kept in mind. @@ -1275,9 +1264,9 @@ final CFArchType type = archType != null ? archType : typeList.getTypeOfArch(this); - if (typeList != null && archText != null && archText.length() > 0) { + if (typeList != null && objectText != null && objectText.length() > 0) { final StringBuilder errors = new StringBuilder(); // return value: all error lines - for (String rawLine : archText.toString().split("\n")) { + for (String rawLine : objectText.toString().split("\n")) { final String line = rawLine.trim(); // get only the key-part of the attribute. final String attrKey = line.contains(" ") ? line.substring(0, line.indexOf(" ")) : line; Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-09-24 19:13:06 UTC (rev 404) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-09-24 19:27:28 UTC (rev 405) @@ -487,7 +487,7 @@ final GameObject newdef = mapModel.getMapSquare(p).getLast(); if (newdef != null) { // now we've got the inserted arch, copy the custom stuff from pickmap - newdef.setArchText(newarch.getObjectText()); + newdef.setObjectText(newarch.getObjectText()); newdef.setObjName(newarch.getObjName()); newdef.resetMsgText(); newdef.addMsgText(newarch.getMsgText()); @@ -539,7 +539,7 @@ final GameObject newdef = mapModel.getMapSquare(p).getLast(); if (newdef != null) { // now we've got the inserted arch, copy the custom stuff from pickmap - newdef.setArchText(newarch.getObjectText()); + newdef.setObjectText(newarch.getObjectText()); newdef.setObjName(newarch.getObjName()); newdef.resetMsgText(); newdef.addMsgText(newarch.getMsgText()); Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-09-24 19:13:06 UTC (rev 404) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-09-24 19:27:28 UTC (rev 405) @@ -163,4 +163,24 @@ */ boolean isArchetype(); + /** + * Returns the edit type. + * @return edit type + */ + int getEditType(); + + /** + * Sets the edit type of this GameObject. + * @param editType edit type of this GameObject. + */ + void setEditType(int editType); + + /** + * Get the EditType of an GameObject (e.g. floor, monster, etc). These are + * determined by the various attributes of the arch (->objectText). + * @param checkType bitmask containing the edit type(s) to be calculated + * @return new editType for this arch + */ + int calculateEditType(int checkType); + } // interface GameObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-09-24 19:47:02
|
Revision: 406 http://svn.sourceforge.net/gridarta/?rev=406&view=rev Author: christianhujer Date: 2006-09-24 12:46:33 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Some unification work of cf/dai GameObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/CArchQuickView.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CMapFileEncode.java trunk/daimonin/src/daieditor/CMapTileList.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/ArchObjectParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/match/MutableNameGameObjectMatcher.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 19:46:33 UTC (rev 406) @@ -79,26 +79,18 @@ private String objName; /** - * The objectText. - * <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 objectText with the differences from the Archetype. + * @note Every line in the objectText must end on '\n', including the last line. */ - private StringBuffer objectText; + @NotNull private StringBuffer objectText; /** * 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; + @Nullable private StringBuffer msgText; private StringBuffer animText; // anim text buffer @@ -144,23 +136,26 @@ private boolean noface; // if true, arch has no face as default + /** + * If this flag is set, the arch is not a "real" arch but comes from the + * artifacts file. Such GameObject instances are not included in the arch + * collection, since the artifacts file is the same for editor and server. + */ + private boolean artifact; + private int facenr; // the index of faceImages[] private boolean editflag; // if true, object is in a editor - // for example in the map arch panel - private boolean artifact; // if set, this is not a "real" arch - // It will NOT be included in the arch collection - private GameObject next; // to chain ArchObjects in maps private GameObject prev; // same /** - * Enclosing container; if null, this object is not in a container but in a - * map. + * Container of this GameObject. + * The Crossfire implementation only knows <code>null</code> (map or unlinked) or being an inventory item. */ - private GameObject env = null; + private GameObject container = null; /** * All inventory objects. Set to {@link Collections#EMPTY_LIST} @@ -459,7 +454,7 @@ /** {@inheritDoc} */ public GameObject getContainer() { - return env; + return container; } /** {@inheritDoc} */ @@ -610,7 +605,7 @@ */ public void addInvObj(final GameObject arch) { // arch must not be already in a container - if (arch.env != null) { + if (arch.container != null) { throw new IllegalArgumentException(); } @@ -619,7 +614,7 @@ } inv.add(arch); - arch.env = this; + arch.container = this; arch.setMapX(getMapX()); arch.setMapY(getMapY()); @@ -633,17 +628,17 @@ } // object must be in a container - if (env == null) { + if (container == null) { throw new IllegalArgumentException(); } // remove this object from its parent container - if (!env.inv.remove(this)) { + if (!container.inv.remove(this)) { throw new AssertionError(); } - if (env.inv.size() == 0) { - env.inv = Collections.EMPTY_LIST; + if (container.inv.size() == 0) { + container.inv = Collections.EMPTY_LIST; } } Modified: trunk/daimonin/src/daieditor/CArchQuickView.java =================================================================== --- trunk/daimonin/src/daieditor/CArchQuickView.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/CArchQuickView.java 2006-09-24 19:46:33 UTC (rev 406) @@ -112,7 +112,7 @@ if (def == null || def == arch) { objName = null; } else if ((objName = def.getObjName()) != null && objName.length() != 0) { - } else if ((objName = def.getArchName()) != null && objName.length() != 0) { + } else if ((objName = def.getArchetypeName()) != null && objName.length() != 0) { } else { objName = null; } @@ -125,7 +125,7 @@ } archObjNameText.setText(objName); - archArchNameText.setText(arch.getArchName()); + archArchNameText.setText(arch.getArchetypeName()); archTypeText.setText(mainControl.getTypeList().getArchTypeName(arch.getArchTypNr()) + " (" + arch.getArchTypNr() + ')'); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-24 19:46:33 UTC (rev 406) @@ -453,14 +453,14 @@ } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { nameTF = new JTextField(defarch.getObjName(), 16); } else { - nameTF = new JTextField(defarch.getArchName(), 16); + nameTF = new JTextField(defarch.getArchetypeName(), 16); } nameTF.setEditable(false); header.add(nameTF, gbc); gbc.gridy++; header.add(buildTypesBox(), gbc); // build type-selection box gbc.gridy++; - defarchTF = new JTextField(defarch.getArchName(), 16); + defarchTF = new JTextField(defarch.getArchetypeName(), 16); defarchTF.setEditable(false); header.add(defarchTF, gbc); @@ -676,7 +676,7 @@ } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { dtxt = defarch.getObjName(); } else { - dtxt = defarch.getArchName(); + dtxt = defarch.getArchetypeName(); } } else if ("face".equalsIgnoreCase(nameOld)) { if (arch.getFaceRealName() != null && arch.getFaceRealName().length() > 0) { @@ -1103,7 +1103,7 @@ } else { newName = ""; } - } else if (!inline.equalsIgnoreCase(defarch.getArchName())) { + } else if (!inline.equalsIgnoreCase(defarch.getArchetypeName())) { newName = inline; } else { newName = ""; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-09-24 19:46:33 UTC (rev 406) @@ -1294,9 +1294,9 @@ //noinspection ForLoopWithMissingComponent for (final Iterator<GameObject> it = objects.iterator(); it.hasNext();) { final GameObject arch = it.next(); - final GameObject defarch = archetypeSet.getArch(arch.getArchName()); + final GameObject defarch = archetypeSet.getArch(arch.getArchetypeName()); if (defarch == null) { - noarch.append(arch.getArchName()).append('\n'); + noarch.append(arch.getArchetypeName()).append('\n'); noarchcount++; it.remove(); } @@ -1906,7 +1906,7 @@ * if so, use the pickmap as random arch seed for the filler. */ if (arch != null) { - title.append("with arch ").append(arch.getArchName()); + title.append("with arch ").append(arch.getArchetypeName()); } else { pmap = CPickmapPanel.getInstance().getCurrentPickmap(); if (pmap != null) { Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-09-24 19:46:33 UTC (rev 406) @@ -355,7 +355,7 @@ } else { arch.setObjName(archNameField.getText()); // overrule in map arch } - } else if (archNameField.getText().compareTo(arch.getArchName()) == 0) { + } else if (archNameField.getText().compareTo(arch.getArchetypeName()) == 0) { arch.setObjName(null); } else { // def is null, something is in panel, so we set it arch.setObjName(archNameField.getText()); // overrule in map arch @@ -843,8 +843,8 @@ archNameField.setForeground(black); if (defarch.getObjName() == null) { // arch name - if (arch.getArchName() != null) { - archNameField.setText(arch.getArchName()); + if (arch.getArchetypeName() != null) { + archNameField.setText(arch.getArchetypeName()); } else { archNameField.setText(""); } @@ -882,8 +882,8 @@ } if (arch.isInContainer()) { final GameObject cont = (GameObject) arch.getContainer(); - if (cont.getArchName() != null) { - specialText.append(" (env: ").append(cont.getArchName()).append(')'); + if (cont.getArchetypeName() != null) { + specialText.append(" (env: ").append(cont.getArchetypeName()).append(')'); } else { specialText.append(" (env: ><)"); } @@ -893,7 +893,7 @@ final StringBuilder typeText = new StringBuilder(); if (defarch != null) { - typeText.append("Type: ").append(mainControl.getTypeList().getArchTypeName(arch.getArchTypNr())).append(" (").append(arch.getArchTypNr()).append(") [").append(arch.getArchName()).append(']'); + typeText.append("Type: ").append(mainControl.getTypeList().getArchTypeName(arch.getArchTypNr())).append(" (").append(arch.getArchTypNr()).append(") [").append(arch.getArchetypeName()).append(']'); } else { typeText.append("Type: <unknown>"); } Modified: trunk/daimonin/src/daieditor/CMapFileDecode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-09-24 19:46:33 UTC (rev 406) @@ -134,7 +134,7 @@ // if this is still -1 in the post parse, we have no direction command loaded arch.setDirection(-1); // our arch! it has a name! - arch.setArchName(thisLine.substring("arch ".length()).trim()); + arch.setArchetypeName(thisLine.substring("arch ".length()).trim()); } } else { Modified: trunk/daimonin/src/daieditor/CMapFileEncode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-09-24 19:46:33 UTC (rev 406) @@ -115,7 +115,7 @@ final GameObject defarch = arch.getArchetype(); // ok, we start with the standard parts... this is valid for all types - writer.write("arch " + arch.getArchName() + '\n'); + writer.write("arch " + arch.getArchetypeName() + '\n'); if (arch.getObjName() != null) { writer.write("name " + arch.getObjName() + '\n'); } Modified: trunk/daimonin/src/daieditor/CMapTileList.java =================================================================== --- trunk/daimonin/src/daieditor/CMapTileList.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/CMapTileList.java 2006-09-24 19:46:33 UTC (rev 406) @@ -205,7 +205,7 @@ if (newarch == null) { archname = null; } else { - archname = newarch.getArchName(); + archname = newarch.getArchetypeName(); } } @@ -461,7 +461,7 @@ if (defname != null && defname.length() > 0) { setText(defname); // default name } else { - setText(arch.getArchName()); // arch name + setText(arch.getArchetypeName()); // arch name } } } Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-09-24 19:46:33 UTC (rev 406) @@ -461,7 +461,7 @@ */ private void addArchToMap(final MapControl mapControl, final GameObject arch, final Point pos, final boolean allowDouble, final boolean fillBelow) { if (arch.isArchetype()) { - mapControl.getMapModel().addArchToMap(arch.getArchName(), pos, allowDouble, fillBelow); + mapControl.getMapModel().addArchToMap(arch.getArchetypeName(), pos, allowDouble, fillBelow); } else { final GameObject newHead = arch.createClone(pos.x, pos.y); for (GameObject tmp = arch.getArchetype().getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-09-24 19:46:33 UTC (rev 406) @@ -316,7 +316,7 @@ for (MapSquare square : entireMap ? mapControl.getMapModel() : mapViewIFrame.getView().getSelectedSquares()) { for (GameObject node : square) { if (!node.isMulti() - && (matchCriteria == MATCH_ARCH_NAME && node.getArchName() != null && node.getArchName().equalsIgnoreCase(matchString) + && (matchCriteria == MATCH_ARCH_NAME && node.getArchetypeName() != null && node.getArchetypeName().equalsIgnoreCase(matchString) || matchCriteria == MATCH_OBJ_NAME && node.getBestName().equalsIgnoreCase(matchString))) { if (replaceListSize > 0 && !deleteOnly) { GameObject randomArch; Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-09-24 19:46:33 UTC (rev 406) @@ -588,7 +588,7 @@ ScriptedEvent(final int eventType, final String pluginName, final String filePath, final String options) { event = new GameObject(); // FIXME: This arch has no default arch event.setArchTypNr(118); - event.setArchName("event_obj"); + event.setArchetypeName("event_obj"); event.setArchetype(CMainControl.getInstance().getArchObjectStack().getArch("event_obj")); event.setObjectFace(); setEventData(eventType, pluginName, filePath, options); Modified: trunk/daimonin/src/daieditor/gameobject/ArchObjectParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchObjectParser.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/gameobject/ArchObjectParser.java 2006-09-24 19:46:33 UTC (rev 406) @@ -183,9 +183,9 @@ } if (archName == null) { - arch.setArchName(thisLine.substring(7)); + arch.setArchetypeName(thisLine.substring(7)); } else { - arch.setArchName(archName); + arch.setArchetypeName(archName); } multiShapeID = 0; @@ -200,15 +200,15 @@ } else if (animflag) { if (thisLine.startsWith("mina")) { try { - mainControl.getAnimationObjects().addAnimPath(arch.getArchName(), path.concat(arch.getArchName())); - mainControl.getAnimationObjects().addAnimationObject(arch.getArchName(), animText.toString()); + mainControl.getAnimationObjects().addAnimPath(arch.getArchetypeName(), path.concat(arch.getArchetypeName())); + mainControl.getAnimationObjects().addAnimationObject(arch.getArchetypeName(), animText.toString()); } catch (final DuplicateAnimationException e) { // TODO: Report to the user log.log(Level.WARNING, "duplicateAnimation", e); } - arch.addArchText("animation " + arch.getArchName() + "\n"); - arch.setAnimName(arch.getArchName()); + arch.addArchText("animation " + arch.getArchetypeName() + "\n"); + arch.setAnimName(arch.getArchetypeName()); // here we must add this to AnimationObject // and add Animation cmd here! @@ -220,7 +220,7 @@ log.log(Level.WARNING, "inventoryInDefArch", thisLine); } else if (thisLine.startsWith("end")) { //if (arch.getArchTypNr() == 0) { - //System.err.println("Arch "+ arch.getArchName()+" has no type info!"); + //System.err.println("Arch "+ arch.getArchetypeName()+" has no type info!"); //} // we got full arch parsearch = false; // we write this sucker @@ -233,7 +233,7 @@ if (firstArch.getMultiRefCount() == 2) { firstArch.setMultiShapeID(multiShapeID); } else if (multiShapeID != firstArch.getMultiShapeID()) { - log.log(Level.WARNING, "defArchWithInvalidMpartNr", new Object[]{arch.getArchName(), firstArch.getArchName(), Integer.toString(multiShapeID), Integer.toString(firstArch.getMultiShapeID())}); + log.log(Level.WARNING, "defArchWithInvalidMpartNr", new Object[]{arch.getArchetypeName(), firstArch.getArchetypeName(), Integer.toString(multiShapeID), Integer.toString(firstArch.getMultiShapeID())}); } } else { mainControl.incArchObjCount(); @@ -243,7 +243,7 @@ if (!ArchetypeSet.isLoadedFromArchive() || archName != null) { // loading from individual files, so we simply add it to list // ArchetypeSet.loadArchFromFiles() takes care of the panels - mainControl.addArchPanelArch(arch.getArchName(), index); + mainControl.addArchPanelArch(arch.getArchetypeName(), index); } else { // loading from collected files, so we need process panels here // FIXME this sucks. This takes 50% of the time of collecting arches!!! @@ -287,7 +287,7 @@ isNewCategory = false; oldCat = newCat; } - mainControl.addArchPanelArch(arch.getArchName(), index); + mainControl.addArchPanelArch(arch.getArchetypeName(), index); } } } @@ -327,23 +327,23 @@ animflag = true; animText = new StringBuilder(); } else if (thisLine.startsWith("visibility ")) { - // System.err.println("Remove visibility: "+arch.getArchName()); + // System.err.println("Remove visibility: "+arch.getArchetypeName()); } else if (thisLine.startsWith("magicmap ")) { - // System.err.println("Remove magicmap: "+arch.getArchName()); + // System.err.println("Remove magicmap: "+arch.getArchetypeName()); } else if (thisLine.startsWith("color_fg ")) { - // System.err.println("Remove color_fg: "+arch.getArchName()); + // System.err.println("Remove color_fg: "+arch.getArchetypeName()); } else if (thisLine.startsWith("color_bg ")) { - // System.err.println("Remove color_bg: "+arch.getArchName()); + // System.err.println("Remove color_bg: "+arch.getArchetypeName()); } else if (thisLine.startsWith("x ")) { - if (!archmore && !arch.getArchName().equals(STARTARCH_NAME)) { - log.log(Level.WARNING, "foundCoordInDefArchSingleTileOrHead", new Object[]{"x", arch.getArchName()}); + if (!archmore && !arch.getArchetypeName().equals(STARTARCH_NAME)) { + log.log(Level.WARNING, "foundCoordInDefArchSingleTileOrHead", new Object[]{"x", arch.getArchetypeName()}); arch.addArchText(thisLine + "\n"); } else { arch.setMultiX(Integer.parseInt(thisLine.substring(2))); } } else if (thisLine.startsWith("y ")) { - if (!archmore && !arch.getArchName().equals(STARTARCH_NAME)) { - log.log(Level.WARNING, "foundCoordInDefArchSingleTileOrHead", new Object[]{"y", arch.getArchName()}); + if (!archmore && !arch.getArchetypeName().equals(STARTARCH_NAME)) { + log.log(Level.WARNING, "foundCoordInDefArchSingleTileOrHead", new Object[]{"y", arch.getArchetypeName()}); arch.addArchText(thisLine + "\n"); } else { arch.setMultiY(Integer.parseInt(thisLine.substring(2))); @@ -353,17 +353,17 @@ final int i = Integer.parseInt(thisLine.substring(5)); arch.setArchTypNr(i); if (i == 0) { - log.log(Level.WARNING, "defArchWithZeroType", arch.getArchName()); + log.log(Level.WARNING, "defArchWithZeroType", arch.getArchetypeName()); } } catch (final NumberFormatException e) { - log.log(Level.WARNING, "defArchWithInvalidTypeNr", new Object[]{arch.getArchName(), thisLine.substring(5)}); + log.log(Level.WARNING, "defArchWithInvalidTypeNr", new Object[]{arch.getArchetypeName(), thisLine.substring(5)}); arch.addArchText(thisLine + "\n"); } } else if (thisLine.startsWith("direction ")) { try { arch.setDirection(Integer.parseInt(thisLine.substring(10))); } catch (final NumberFormatException e) { - log.log(Level.WARNING, "defArchWithInvalidDirection", new Object[]{arch.getArchName(), thisLine.substring(10)}); + log.log(Level.WARNING, "defArchWithInvalidDirection", new Object[]{arch.getArchetypeName(), thisLine.substring(10)}); } arch.addArchText(thisLine + "\n"); } else if (thisLine.startsWith("face ")) { @@ -387,10 +387,10 @@ multiShapeID = Integer.parseInt(thisLine.substring(9).trim()); if (multiShapeID <= 0 || multiShapeID >= MultiPositionData.Y_DIM) { - System.err.println("WARNING: Arch " + arch.getArchName() + " mpart_id number is '" + thisLine.substring(9) + '\''); + System.err.println("WARNING: Arch " + arch.getArchetypeName() + " mpart_id number is '" + thisLine.substring(9) + '\''); } } catch (final NumberFormatException e) { - System.err.println("WARNING: Arch " + arch.getArchName() + " has a invalid mpart_id (" + thisLine.substring(9) + ')'); + System.err.println("WARNING: Arch " + arch.getArchetypeName() + " has a invalid mpart_id (" + thisLine.substring(9) + ')'); arch.addArchText(thisLine + "\n"); } } else if (thisLine.startsWith("mpart_nr ")) { @@ -399,7 +399,7 @@ final int i = Integer.parseInt(thisLine.substring(9).trim()); arch.setMultiPartNr(i); } catch (final NumberFormatException e) { - System.err.println("WARNING: Arch " + arch.getArchName() + " has a invalid mpart_nr (" + thisLine.substring(9) + ')'); + System.err.println("WARNING: Arch " + arch.getArchetypeName() + " has a invalid mpart_nr (" + thisLine.substring(9) + ')'); arch.addArchText(thisLine + "\n"); } } else { Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-09-24 19:46:33 UTC (rev 406) @@ -184,12 +184,12 @@ * @todo check whether the GameObject is a default arch and reject no default arches with an exception */ public void addArchToList(final GameObject data) /*throws DuplicateArchException*/ { - if (arches.containsKey(data.getArchName())) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateArch", data.getArchName(), currentFile); + if (arches.containsKey(data.getArchetypeName())) { + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateArch", data.getArchetypeName(), currentFile); //throw new DuplicateArchException(data); } else { archObjects.add(data); - arches.put(data.getArchName(), data); + arches.put(data.getArchetypeName(), data); } } @@ -569,15 +569,15 @@ artifactCount++; continue; } - if (arch.getArchName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { + if (arch.getArchetypeName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { // process map arch - out.append("Object ").append(arch.getArchName()).append('\n'); + out.append("Object ").append(arch.getArchetypeName()).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)) { + if (arch.getArchetypeName().equals(ArchObjectParser.STARTARCH_NAME)) { out.append("x ").append(Integer.toString(arch.getMultiX())).append('\n'); out.append("y ").append(Integer.toString(arch.getMultiY())).append('\n'); } @@ -603,7 +603,7 @@ continue; //ACTION_FACTORY.showMessageDialog(pbar.getParentComponent(), WARNING_MESSAGE, "archCollectWarningMultipartTailInPanel"); } - out.append("Object ").append(arch.getArchName()).append('\n'); + out.append("Object ").append(arch.getArchetypeName()).append('\n'); if (arch.getObjName() != null) { out.append("name ").append(arch.getObjName()).append('\n'); @@ -652,7 +652,7 @@ out.append("More\n"); - out.append("Object ").append(tail.getArchName()).append('\n'); + out.append("Object ").append(tail.getArchetypeName()).append('\n'); if (tail.getObjName() != null) { out.append("name ").append(tail.getObjName()).append('\n'); Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 19:46:33 UTC (rev 406) @@ -72,7 +72,7 @@ private String faceRealName; /** Arch name. */ - private String archName; + private String archetypeName; /** The name of this object. */ private String objName; @@ -81,7 +81,7 @@ private String animName; /** - * The objectText with the differences from the default arch. + * The objectText with the differences from the Archetype. * @note Every line in the objectText must end on '\n', including the last line. */ @NotNull private StringBuffer objectText; @@ -136,6 +136,15 @@ */ private ScriptArchData script; + private boolean noface; + + /** + * If this flag is set, the arch is not a "real" arch but comes from the + * artifacts file. Such GameObject instances are not included in the arch + * collection, since the artifacts file is the same for editor and server. + */ + private boolean artifact; + /** State where the face comes from. */ private FaceDesc faceobjdesc; @@ -147,16 +156,7 @@ private int direction; - private boolean noface; - /** - * If this flag is set, the arch is not a "real" arch but comes from the - * artifacts file. Such GameObject instances are not included in the arch - * collection, since the artifacts file is the same for editor and server. - */ - private boolean artifact; - - /** * Container of this GameObject. * There are two possibilities for the container: * <ul> @@ -800,18 +800,18 @@ /** * Sets arch name. - * @param archName arch name + * @param archetypeName arch name */ - public void setArchName(final String archName) { - this.archName = archName != null ? archName.intern() : null; + public void setArchetypeName(final String archetypeName) { + this.archetypeName = archetypeName != null ? archetypeName.intern() : null; } /** * Returns arch name. * @return the arch name */ - public String getArchName() { - return archName; + public String getArchetypeName() { + return archetypeName; } /** @@ -824,10 +824,10 @@ return objName; } else if (archetype != null && archetype.objName != null && archetype.objName.length() > 0) { return archetype.objName; - } else if (archName != null && archName.length() > 0) { - return archName; - } else if (archetype != null && archetype.archName != null) { - return archetype.archName; + } else if (archetypeName != null && archetypeName.length() > 0) { + return archetypeName; + } else if (archetype != null && archetype.archetypeName != null) { + return archetype.archetypeName; } return "???"; // this case should actually never happen @@ -1188,7 +1188,7 @@ /** @return true when this arch has one or more scripted events defined */ public boolean isScripted() { - for (GameObject tmp : this) { + for (final GameObject tmp : this) { if (tmp.archType == 118) { return true; } @@ -1323,7 +1323,7 @@ return archetype.createArch(); } final GameObject arch = new GameObject(); - arch.setArchName(archName); + arch.setArchetypeName(archetypeName); arch.setArchetype(this); arch.setObjectFace(); arch.setMultiX(multiX); Modified: trunk/daimonin/src/daieditor/gameobject/match/MutableNameGameObjectMatcher.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/match/MutableNameGameObjectMatcher.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/gameobject/match/MutableNameGameObjectMatcher.java 2006-09-24 19:46:33 UTC (rev 406) @@ -47,7 +47,7 @@ /** {@inheritDoc} */ public boolean isMatching(final GameObject arch) { - return name.matches(arch.getArchName()); + return name.matches(arch.getArchetypeName()); } /** Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-09-24 19:46:33 UTC (rev 406) @@ -234,7 +234,7 @@ if (!allowDouble) { for (final GameObject node : mapGrid[mapT.x][mapT.y]) { - if (node.getArchName().equals(tail.getArchName())) { + if (node.getArchetypeName().equals(tail.getArchetypeName())) { return false; } } @@ -307,7 +307,7 @@ if (newarch == null || newarch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchName(); + archname = newarch.getArchetypeName(); } // insert a new instance of the default arch (number 'archnr') if (!addArchToMap(archname, pos, true, false)) { @@ -340,7 +340,7 @@ final GameObject invnew; // new arch to be inserted if (newarch == null || newarch.isArchetype()) { if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchName(); + archname = newarch.getArchetypeName(); } // create a new copy of a default arch invnew = getDefaultArch(archname).createArch(); Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-09-24 19:27:28 UTC (rev 405) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-09-24 19:46:33 UTC (rev 406) @@ -480,7 +480,7 @@ // insert multi tile from pickmap: newarch = newarch.getHead(); // first insert default arch from archlist - if (!mapModel.addArchToMap(newarch.getArchName(), p, allowMany, false)) { + if (!mapModel.addArchToMap(newarch.getArchetypeName(), p, allowMany, false)) { // do nothing } else { // insertion successful, now get redraw info @@ -532,7 +532,7 @@ } // first insert default arch from archlist - if (!allSpacesFree || !mapModel.addArchToMap(newarch.getArchName(), p, true, false)) { + if (!allSpacesFree || !mapModel.addArchToMap(newarch.getArchetypeName(), p, true, false)) { // do nothing } else { // insertion successful, now get redraw info This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-09-24 19:59:39
|
Revision: 407 http://svn.sourceforge.net/gridarta/?rev=407&view=rev Author: christianhujer Date: 2006-09-24 12:59:24 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Declared nullability of reference types used by Gridarta GameObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 19:46:33 UTC (rev 406) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 19:59:24 UTC (rev 407) @@ -155,7 +155,7 @@ * Container of this GameObject. * The Crossfire implementation only knows <code>null</code> (map or unlinked) or being an inventory item. */ - private GameObject container = null; + @Nullable private GameObject container = null; /** * All inventory objects. Set to {@link Collections#EMPTY_LIST} @@ -321,7 +321,7 @@ } /** {@inheritDoc} */ - public String getAttributeString(String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + @NotNull public String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype int j; attributeName = attributeName.trim() + " "; // attributeName must be followed by space @@ -364,17 +364,17 @@ } /** {@inheritDoc} */ - public String getAttributeString(final String attributeName, final boolean queryArchetype) { + @NotNull public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { return getAttributeString(attributeName, queryArchetype ? archetype : null); } /** {@inheritDoc} */ - public String getAttributeString(final String attributeName) { + @NotNull public String getAttributeString(@NotNull final String attributeName) { return getAttributeString(attributeName, true); } /** {@inheritDoc} */ - public int getAttributeInt(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -396,12 +396,12 @@ } /** {@inheritDoc} */ - public int getAttributeInt(final String attributeName, final boolean queryArchetype) { + public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { return getAttributeInt(attributeName, queryArchetype ? archetype : null); } /** {@inheritDoc} */ - public long getAttributeLong(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -422,12 +422,12 @@ } /** {@inheritDoc} */ - public long getAttributeLong(final String attributeName, final boolean queryArchetype) { + public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { return getAttributeLong(attributeName, queryArchetype ? archetype : null); } /** {@inheritDoc} */ - public double getAttributeDouble(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -448,17 +448,17 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(final String attributeName, final boolean queryArchetype) { + public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { return getAttributeDouble(attributeName, queryArchetype ? archetype : null); } /** {@inheritDoc} */ - public GameObject getContainer() { + @Nullable public GameObject getContainer() { return container; } /** {@inheritDoc} */ - public GameObject getTopContainer() { + @NotNull public GameObject getTopContainer() { GameObject tmpArch; for (tmpArch = this; tmpArch.getContainer() != null; @@ -987,7 +987,7 @@ } /** {@inheritDoc} */ - public String getObjectText() { + @NotNull public String getObjectText() { return objectText.toString(); } Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 19:46:33 UTC (rev 406) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 19:59:24 UTC (rev 407) @@ -321,12 +321,12 @@ } /** {@inheritDoc} */ - public String getAttributeString(String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + @NotNull public String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { throw new Error("deprecated and not used in Daimonin"); } /** {@inheritDoc} */ - public String getAttributeString(final String attributeName, final boolean queryArchetype) { + @NotNull public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (queryArchetype) { @@ -343,12 +343,12 @@ } /** {@inheritDoc} */ - public String getAttributeString(final String attributeName) { + @NotNull public String getAttributeString(@NotNull final String attributeName) { return getAttributeString(attributeName, true); } /** {@inheritDoc} */ - public int getAttributeInt(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -370,12 +370,12 @@ } /** {@inheritDoc} */ - public int getAttributeInt(final String attributeName, final boolean queryArchetype) { + public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { return getAttributeInt(attributeName, queryArchetype ? archetype : null); } /** {@inheritDoc} */ - public long getAttributeLong(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -396,12 +396,12 @@ } /** {@inheritDoc} */ - public long getAttributeLong(final String attributeName, final boolean queryArchetype) { + public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { return getAttributeLong(attributeName, queryArchetype ? archetype : null); } /** {@inheritDoc} */ - public double getAttributeDouble(final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -422,17 +422,17 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(final String attributeName, final boolean queryArchetype) { + public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { return getAttributeDouble(attributeName, queryArchetype ? archetype : null); } /** {@inheritDoc} */ - public GameObjectContainer getContainer() { + @NotNull public GameObjectContainer getContainer() { return container; } /** {@inheritDoc} */ - public GameObject getTopContainer() { + @NotNull public GameObject getTopContainer() { return isInContainer() ? ((GameObject) container).getTopContainer() : this; } @@ -889,7 +889,7 @@ } /** {@inheritDoc} */ - public String getObjectText() { + @NotNull public String getObjectText() { return objectText.toString(); } Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-09-24 19:46:33 UTC (rev 406) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-09-24 19:59:24 UTC (rev 407) @@ -1,5 +1,8 @@ package net.sf.gridarta.gameobject; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + /** * This interface serves as a common interface for GameObjects for Daimonin and Crossfire to allow classes that use GameObjects being reused and moved to Gridarta. * @@ -18,7 +21,7 @@ * Returns the object text of this game object as String. * @return the object text */ - String getObjectText(); + @NotNull String getObjectText(); /** * Get the requested attribute value of this GameObject as {@link String}. @@ -33,7 +36,7 @@ * @return Attribute value or empty String if not found. * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. */ - @Deprecated String getAttributeString(String attributeName, GameObject archetype); + @Deprecated @NotNull String getAttributeString(@NotNull String attributeName, @Nullable GameObject archetype); /** * Get the requested attribute value of this GameObject as {@link String}. @@ -50,7 +53,7 @@ * @return Attribute value or empty String ("") if no such attribute * @see #getAttributeString(String) */ - String getAttributeString(String attributeName, boolean queryArchetype); + @NotNull String getAttributeString(@NotNull String attributeName, boolean queryArchetype); /** * Get the requested attribute value of this GameObject as {@link String}. @@ -63,7 +66,7 @@ * @return Attribute value or empty String ("") if no such attribute * @see #getAttributeString(String, boolean) */ - String getAttributeString(String attributeName); + @NotNull String getAttributeString(@NotNull String attributeName); /** * Get the requested attribute value of this GameObject as <code>int</code>. @@ -73,7 +76,7 @@ * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. * @see #getAttributeString(String, GameObject) */ - @Deprecated int getAttributeInt(String attributeName, GameObject archetype); + @Deprecated int getAttributeInt(@NotNull String attributeName, @Nullable GameObject archetype); /** * Get the requested attribute value of this GameObject as <code>int</code>. @@ -82,7 +85,7 @@ * @return attribute value or zero if not found. * @see #getAttributeString(String, boolean) */ - int getAttributeInt(String attributeName, boolean queryArchetype); + int getAttributeInt(@NotNull String attributeName, boolean queryArchetype); /** * Get the requested attribute value of this GameObject as <code>long</code>. @@ -92,7 +95,7 @@ * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. * @see #getAttributeString(String, GameObject) */ - @Deprecated long getAttributeLong(String attributeName, GameObject archetype); + @Deprecated long getAttributeLong(@NotNull String attributeName, @Nullable GameObject archetype); /** * Get the requested attribute value of this GameObject as <code>int</code>. @@ -101,7 +104,7 @@ * @return attribute value or zero if not found. * @see #getAttributeString(String, boolean) */ - long getAttributeLong(String attributeName, boolean queryArchetype); + long getAttributeLong(@NotNull String attributeName, boolean queryArchetype); /** * Get the requested attribute value of this GameObject as <code>double</code>. @@ -111,7 +114,7 @@ * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. * @see #getAttributeString(String, net.sf.gridarta.gameobject.GameObject) */ - @Deprecated double getAttributeDouble(String attributeName, GameObject archetype); + @Deprecated double getAttributeDouble(@NotNull String attributeName, @Nullable GameObject archetype); /** * Get the requested attribute value of this GameObject as <code>int</code>. @@ -120,26 +123,26 @@ * @return attribute value or zero if not found. * @see #getAttributeString(String, boolean) */ - double getAttributeDouble(String attributeName, boolean queryArchetype); + double getAttributeDouble(@NotNull String attributeName, boolean queryArchetype); /** * Returns container of this GameObject. * There are two possibilities for the container: * <ul> * <li>Another GameObject, which means this object is in the inventory of that GameObject.</li> - * <li>A MapSquare, which means that this GameObject is top level on that MapSquare.</li> + * <li>A MapSquare, which means that this GameObject is top level on that MapSquare (Crossfire returns <code>null</code> for this).</li> * </ul> * @return container of this GameObject. */ - Object getContainer(); // todo: change return type to something more specific. + @Nullable Object getContainer(); // todo: change return type to something more specific. /** * Get the topmost container of this GameObject (in Game sense, which * means being in a MapSquare isn't, but being in an GameObject is). - * @return the topmost container but always GameObject, never MapSquare - * @todo document what happens if this object is topmost + * @return the topmost container but always GameObject, never MapSquare. + * If this object is topmost itself, it returns itself. */ - GameObject getTopContainer(); + @NotNull GameObject getTopContainer(); /** * Get the Archetype this GameObject is based on. @@ -147,7 +150,7 @@ * @note currently this method returns the GameObject that reflects the Archetype data because there is no separate Archetype class. * This will change in future, and you should be aware of this fact. */ - GameObject getArchetype(); + @NotNull GameObject getArchetype(); /** * Set the Archetype of this GameObject. @@ -155,7 +158,7 @@ * @note currently this method takes a GameObject that reflects the Archetype data because there is no separate Archetype class. * This will change in future, and you should be aware of this fact. */ - void setArchetype(final GameObject archetype); + void setArchetype(@NotNull final GameObject archetype); /** * Returns whether this GameObject is an Archetype. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-09-24 20:12:42
|
Revision: 409 http://svn.sourceforge.net/gridarta/?rev=409&view=rev Author: christianhujer Date: 2006-09-24 13:12:32 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Minor documentation improvements. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 20:05:19 UTC (rev 408) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 20:12:32 UTC (rev 409) @@ -45,7 +45,7 @@ import org.jetbrains.annotations.NotNull; /** - * The <code>GameObject</code> class handles the Crossfire arch objects. + * The <code>GameObject</code> class handles the Crossfire GameObjects. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 20:05:19 UTC (rev 408) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 20:12:32 UTC (rev 409) @@ -42,7 +42,7 @@ import org.jetbrains.annotations.NotNull; /** - * The <code>GameObject</code> class handles the Daimonin arch objects. + * The <code>GameObject</code> class handles the Daimonin GameObjects. * Usually, an GameObject that is really used is derived from a (replacable) default arch. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> @@ -1313,9 +1313,8 @@ } /** - * Create a new GameObject from this default GameObject. If this GameObject - * is not a default GameObject, this method recursively forwards to the - * default GameObject. + * Create a new GameObject from this Archetype. + * If this GameObject is not an Archetype, this method recursively forwards to its Archetype. * @return new GameObject */ public GameObject createArch() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-09-24 20:55:28
|
Revision: 412 http://svn.sourceforge.net/gridarta/?rev=412&view=rev Author: christianhujer Date: 2006-09-24 13:55:15 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Extracted MapType enum to a gridarta enum, added COPYBUFFER value. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CNewMapDialog.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/map/MapType.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-09-24 20:45:55 UTC (rev 411) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-09-24 20:55:15 UTC (rev 412) @@ -117,6 +117,7 @@ import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.MainControl; import net.sf.gridarta.CUndoStack; +import net.sf.gridarta.map.MapType; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.ActionMethod; @@ -891,12 +892,12 @@ * @param filename desired filename for the new map, null if not specified */ public void newLevelWanted(final String filename) { - CNewMapDialog.showNewMapDialog(this, mainView, filename, CNewMapDialog.MapType.GAMEMAP); + CNewMapDialog.showNewMapDialog(this, mainView, filename, MapType.GAMEMAP); } /** Invoked when user wants to open a new pickmap. */ public void addNewPickmap() { - CNewMapDialog.showNewMapDialog(this, mainView, null, CNewMapDialog.MapType.PICKMAP); + CNewMapDialog.showNewMapDialog(this, mainView, null, MapType.PICKMAP); } /** Modified: trunk/daimonin/src/daieditor/CNewMapDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-09-24 20:45:55 UTC (rev 411) +++ trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-09-24 20:55:15 UTC (rev 412) @@ -30,12 +30,9 @@ import daieditor.map.MapArchObject; import java.awt.Component; import java.awt.FlowLayout; -import java.awt.GridLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; -import java.text.SimpleDateFormat; -import java.util.Date; import java.util.prefs.Preferences; import static java.util.prefs.Preferences.userNodeForPackage; import javax.swing.Box; @@ -52,6 +49,7 @@ import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; import net.sf.gridarta.Size2D; +import net.sf.gridarta.map.MapType; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; @@ -79,16 +77,6 @@ */ private boolean mapSizeDefault = true; - /** Map types. */ - public enum MapType { - - /** Map Type for normal game maps. */ - GAMEMAP, - - /** Map Type for pickmaps. */ - PICKMAP - } // enum MapType - /** Preferences. */ private static final Preferences prefs = userNodeForPackage(CMainControl.class); Added: trunk/src/app/net/sf/gridarta/map/MapType.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapType.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/MapType.java 2006-09-24 20:55:15 UTC (rev 412) @@ -0,0 +1,43 @@ +package net.sf.gridarta.map; + +/** + * Map types. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public enum MapType { + + /** Map Type for normal game maps. */ + GAMEMAP(true), + + /** Map Type for pickmaps. */ + PICKMAP(true), + + /** Map Type for copy buffers. */ + COPYBUFFER(false); + + /** + * Whether multiparts in this map type should be expanded. + * @value <code>true</code> to expand multiparts + * @value <code>false</code> for not expanding + */ + private final boolean expandMulti; + + /** + * Create a MapType enum constant. + * @param expandMulti whether multiparts in this map type should be expanded. + * <code>true</code> to expand multiparts + * <code>false</code> for not expanding + */ + MapType(final boolean expandMulti) { + this.expandMulti = expandMulti; + } + + /** + * Return whether multiparts in this map type should be expanded. + * @return <code>true</code> to expand multiparts, <code>false</code> for not expanding + */ + public boolean isExpandMulti() { + return expandMulti; + } + +} // enum MapType Property changes on: trunk/src/app/net/sf/gridarta/map/MapType.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-09-24 23:05:53
|
Revision: 422 http://svn.sourceforge.net/gridarta/?rev=422&view=rev Author: christianhujer Date: 2006-09-24 16:04:34 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Ran IntelliJ IDEA import optimization over all .java files. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/FaceObject.java trunk/crossfire/src/cfeditor/MultiPositionData.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/parameter/ArchParameter.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CNewMapDialog.java trunk/daimonin/src/daieditor/CPreview.java trunk/daimonin/src/daieditor/MultiPositionData.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/Spells.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObjectContainer.java trunk/daimonin/src/daieditor/gameobject/NamedObject.java trunk/daimonin/src/daieditor/gameobject/RecursiveGameObjectIterator.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gui/DirectionLayout.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapModel.java trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java trunk/src/app/net/sf/gridarta/io/CFileReader.java trunk/src/app/net/sf/gridarta/map/AbstractMapArchObject.java trunk/src/app/net/sf/gridarta/map/MapArchObject.java trunk/src/app/net/sf/gridarta/map/MapModel.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditMenuBar.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java trunk/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java trunk/src/test/net/sf/gridarta/Size2DTest.java trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,14 +24,14 @@ package cfeditor; +import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.map.MapModel; import java.io.FileNotFoundException; import java.io.IOException; +import net.sf.gridarta.io.CFileReader; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.io.CFileReader; /** * The <code>AutojoinList</code> class contains a list of (typically wall-)arches which Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.gameobject.GameObject; import cfeditor.gameobject.ArchetypeSet; +import cfeditor.gameobject.GameObject; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -66,7 +66,6 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; -import cfeditor.GridderException; import net.sf.gridarta.help.Help; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-24 23:04:34 UTC (rev 422) @@ -39,6 +39,7 @@ import java.util.Vector; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.io.CFileReader; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.DataConversionException; @@ -46,7 +47,6 @@ import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; -import net.sf.gridarta.io.CFileReader; /** * This class handles all the CFArchTypes and makes them conveniently Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,8 +24,8 @@ package cfeditor; -import cfeditor.gameobject.GameObject; import cfeditor.gameobject.ArchetypeSet; +import cfeditor.gameobject.GameObject; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -52,7 +52,6 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreePath; -import cfeditor.GridderException; import net.sf.gridarta.help.Help; import net.sf.gridarta.io.CFileReader; import org.apache.log4j.Logger; Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-09-24 23:04:34 UTC (rev 422) @@ -7,7 +7,6 @@ package cfeditor; -import cfeditor.gameobject.GameObject; import cfeditor.filter.ConfigEvent; import cfeditor.filter.ConfigListener; import cfeditor.filter.Filter; @@ -15,6 +14,7 @@ import cfeditor.filter.NamedFilterEvent; import cfeditor.filter.NamedFilterList; import cfeditor.filter.NamedFilterListener; +import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; import cfeditor.menu.BasicMenuEntry; import javax.swing.JComponent; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,9 +24,9 @@ package cfeditor; -import cfeditor.gameobject.GameObject; import cfeditor.gameobject.ArchObjectParser; import cfeditor.gameobject.ArchetypeSet; +import cfeditor.gameobject.GameObject; import cfeditor.gameobject.anim.AnimationObjects; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; @@ -36,8 +36,8 @@ import java.awt.Rectangle; import java.awt.Toolkit; import java.io.File; -import java.io.IOException; import java.io.FileNotFoundException; +import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; @@ -53,18 +53,17 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.filechooser.FileFilter; -import cfeditor.GridderException; -import net.sf.gridarta.Size2D; -import net.sf.gridarta.MainControl; import net.sf.gridarta.CUndoStack; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.util.filter.file.EndingFileFilter; import org.apache.log4j.Logger; -import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * The main controller of the level editor. Basically the main application. Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,8 +24,8 @@ package cfeditor; +import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; -import cfeditor.gameobject.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-09-24 23:04:34 UTC (rev 422) @@ -28,15 +28,15 @@ import cfeditor.map.MapArchObject; import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; +import net.sf.gridarta.io.CFileReader; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.io.CFileReader; /** * This class handles the reading of a mapfile and parsing the data Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-09-24 23:04:34 UTC (rev 422) @@ -52,7 +52,6 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; -import cfeditor.GridderException; import net.sf.gridarta.Size2D; import net.sf.gridarta.help.Help; Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,9 +24,9 @@ package cfeditor; +import cfeditor.filter.AttributeFilter; +import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; -import cfeditor.gameobject.ArchetypeSet; -import cfeditor.filter.AttributeFilter; import cfeditor.map.MapControl; import cfeditor.map.MapModel; import com.visualtek.png.PNGEncoder; Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,8 +24,8 @@ package cfeditor; +import cfeditor.gameobject.ArchObjectParser; import cfeditor.gameobject.GameObject; -import cfeditor.gameobject.ArchObjectParser; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import java.io.File; Modified: trunk/crossfire/src/cfeditor/FaceObject.java =================================================================== --- trunk/crossfire/src/cfeditor/FaceObject.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/FaceObject.java 2006-09-24 23:04:34 UTC (rev 422) @@ -26,14 +26,13 @@ import com.sixlegs.image.png.PngImage; import java.awt.Toolkit; -import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.lang.ref.Reference; import java.lang.ref.SoftReference; import javax.swing.ImageIcon; +import net.sf.gridarta.io.CFileInputStream; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.io.CFileInputStream; /** * The <code>FaceObject</code> Modified: trunk/crossfire/src/cfeditor/MultiPositionData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-09-24 23:04:34 UTC (rev 422) @@ -28,8 +28,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.StringTokenizer; +import net.sf.gridarta.io.CFileReader; import org.apache.log4j.Logger; -import net.sf.gridarta.io.CFileReader; /** * The MultiPositionData class stores an array of numbers which is required Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-09-24 23:04:34 UTC (rev 422) @@ -47,8 +47,8 @@ import javax.swing.JPanel; import javax.swing.JTextField; import static javax.swing.WindowConstants.HIDE_ON_CLOSE; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.japi.util.Arrays2; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; Modified: trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java 2006-09-24 23:04:34 UTC (rev 422) @@ -35,6 +35,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.sf.gridarta.io.CFileReader; import org.apache.log4j.Logger; import org.jdom.DataConversionException; import org.jdom.Document; @@ -42,7 +43,6 @@ import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.io.CFileReader; /** * The <code>ArchObjectParser</code> class handles the parsing of arches. It is Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-09-24 23:04:34 UTC (rev 422) @@ -55,10 +55,10 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingConstants; +import net.sf.gridarta.io.CFileInputStream; +import net.sf.gridarta.io.CFileReader; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.io.CFileInputStream; -import net.sf.gridarta.io.CFileReader; /** * The <code>ArchetypeSet</code> contains all the Archetypes. Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-24 23:04:34 UTC (rev 422) @@ -41,8 +41,8 @@ import java.util.List; import javax.swing.JList; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; /** * The <code>GameObject</code> class handles the Crossfire GameObjects. Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-09-24 23:04:34 UTC (rev 422) @@ -27,14 +27,14 @@ import cfeditor.CMainControl; import cfeditor.ExitTypes; import cfeditor.IGUIConstants; +import cfeditor.filter.Filter; +import cfeditor.filter.FilterConfig; +import cfeditor.filter.NamedFilterConfig; +import cfeditor.filter.NamedFilterList; import cfeditor.gameobject.GameObject; import cfeditor.gameobject.GameObjectIterator; import cfeditor.gameobject.GameObjectIteratorDeleteGameMapObject; import cfeditor.gameobject.GameObjectIteratorDeleteMapGame; -import cfeditor.filter.Filter; -import cfeditor.filter.FilterConfig; -import cfeditor.filter.NamedFilterConfig; -import cfeditor.filter.NamedFilterList; import java.awt.Point; import java.util.Iterator; import java.util.List; Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-09-24 23:04:34 UTC (rev 422) @@ -27,10 +27,9 @@ import cfeditor.CMainControl; import cfeditor.CMainStatusbar; import cfeditor.CMapViewBasic; +import cfeditor.GridderException; +import cfeditor.IGUIConstants; import cfeditor.MapViewIFrame; -import net.sf.gridarta.CUndoStack; -import cfeditor.IGUIConstants; -import cfeditor.GridderException; import cfeditor.gameobject.GameObject; import cfeditor.gameobject.GameObjectIterator; import cfeditor.gameobject.GameObjectIteratorDeleteMapGame; @@ -38,6 +37,7 @@ import java.io.File; import java.util.Iterator; import java.util.List; +import net.sf.gridarta.CUndoStack; import net.sf.gridarta.Size2D; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/parameter/ArchParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/ArchParameter.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/crossfire/src/cfeditor/parameter/ArchParameter.java 2006-09-24 23:04:34 UTC (rev 422) @@ -10,8 +10,8 @@ import cfeditor.CMainControl; import cfeditor.PluginParameter; import cfeditor.PluginParameterView; +import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; -import cfeditor.gameobject.ArchetypeSet; import org.jdom.Element; import org.jetbrains.annotations.Nullable; Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-09-24 23:04:34 UTC (rev 422) @@ -31,13 +31,13 @@ import java.util.List; import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.JSplitPane; 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 net.sf.gridarta.gui.GSplitPane; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.gui.GSplitPane; /** * The <code>CArchPanel</code> holds the tile palette. Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,8 +24,8 @@ package daieditor; +import daieditor.gameobject.ArchetypeSet; import daieditor.gameobject.GameObject; -import daieditor.gameobject.ArchetypeSet; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-09-24 23:04:34 UTC (rev 422) @@ -28,9 +28,9 @@ import static daieditor.CMainView.MAP_TILE_LIST_BOTTOM_DEFAULT; import static daieditor.CMainView.MAP_TILE_LIST_BOTTOM_KEY; import static daieditor.IGUIConstants.TILE_EDIT_NONE; -import daieditor.gameobject.GameObject; import daieditor.gameobject.ArchObjectParser; import daieditor.gameobject.ArchetypeSet; +import daieditor.gameobject.GameObject; import daieditor.gameobject.anim.AnimationObjects; import daieditor.gameobject.face.FaceFacade; import daieditor.gameobject.face.FaceObjects; @@ -70,7 +70,6 @@ import daieditor.map.validation.checks.SquareWithoutFloorChecker; import daieditor.map.validation.checks.SysObjectOnLayerZeroChecker; import daieditor.map.validation.checks.TilePathsChecker; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import java.awt.Image; import java.awt.Point; import java.awt.Toolkit; @@ -97,8 +96,8 @@ import static java.util.prefs.Preferences.userNodeForPackage; import javax.swing.AbstractAction; import javax.swing.ImageIcon; +import javax.swing.JComponent; import javax.swing.JFileChooser; -import javax.swing.JComponent; import static javax.swing.JOptionPane.CANCEL_OPTION; import static javax.swing.JOptionPane.CLOSED_OPTION; import static javax.swing.JOptionPane.ERROR_MESSAGE; @@ -114,10 +113,11 @@ import static javax.swing.JOptionPane.showMessageDialog; import static javax.swing.KeyStroke.getKeyStroke; import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.CUndoStack; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.HideFileFilterProxy; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.CUndoStack; import net.sf.gridarta.map.MapType; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.ActionMethod; Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,8 +24,8 @@ package daieditor; +import daieditor.gameobject.ArchetypeSet; import daieditor.gameobject.GameObject; -import daieditor.gameobject.ArchetypeSet; import daieditor.gui.AboutDialog; import daieditor.map.MapControl; import daieditor.map.validation.ErrorCollector; Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,8 +24,8 @@ package daieditor; +import daieditor.gameobject.ArchObjectParser; import daieditor.gameobject.GameObject; -import daieditor.gameobject.ArchObjectParser; import daieditor.gui.ConnectionView; import daieditor.gui.ErrorListView; import daieditor.map.validation.ErrorCollector; Modified: trunk/daimonin/src/daieditor/CMapFileDecode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-09-24 23:04:34 UTC (rev 422) @@ -24,8 +24,8 @@ package daieditor; +import daieditor.gameobject.ArchObjectParser; import daieditor.gameobject.GameObject; -import daieditor.gameobject.ArchObjectParser; import daieditor.map.MapArchObject; import java.io.BufferedReader; import java.io.File; @@ -35,9 +35,9 @@ import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; +import net.sf.gridarta.io.CFileReader; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; -import net.sf.gridarta.io.CFileReader; /** * A MapFileDecoder reads a map file and provides access to the information read from the map file. Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-09-24 23:04:34 UTC (rev 422) @@ -50,11 +50,11 @@ import javax.swing.JScrollPane; import javax.swing.JViewport; import net.sf.gridarta.Size2D; +import net.sf.gridarta.gui.MapView; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.gridarta.gui.map.MapGrid; -import net.sf.gridarta.gui.MapView; import org.jetbrains.annotations.Nullable; /** Modified: trunk/daimonin/src/daieditor/CNewMapDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-09-24 23:04:34 UTC (rev 422) @@ -38,13 +38,13 @@ import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; +import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JFormattedTextField; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; -import javax.swing.JCheckBox; import javax.swing.border.CompoundBorder; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; Modified: trunk/daimonin/src/daieditor/CPreview.java =================================================================== --- trunk/daimonin/src/daieditor/CPreview.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/CPreview.java 2006-09-24 23:04:34 UTC (rev 422) @@ -45,8 +45,8 @@ import javax.swing.JScrollPane; import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.ActionMethod; -import static net.sf.japi.swing.ActionFactory.getFactory; /** * The map preview of the level editor. Modified: trunk/daimonin/src/daieditor/MultiPositionData.java =================================================================== --- trunk/daimonin/src/daieditor/MultiPositionData.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/MultiPositionData.java 2006-09-24 23:04:34 UTC (rev 422) @@ -29,8 +29,8 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import net.sf.gridarta.io.CFileReader; import org.apache.log4j.Logger; -import net.sf.gridarta.io.CFileReader; /** * The MultiPositionData class stores an array of numbers which is required Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-09-24 23:04:34 UTC (rev 422) @@ -25,7 +25,6 @@ package daieditor; import daieditor.gameobject.GameObject; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Insets; @@ -48,6 +47,7 @@ import javax.swing.JPanel; import javax.swing.JTextField; import static javax.swing.WindowConstants.HIDE_ON_CLOSE; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.util.Arrays2; Modified: trunk/daimonin/src/daieditor/Spells.java =================================================================== --- trunk/daimonin/src/daieditor/Spells.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/Spells.java 2006-09-24 23:04:34 UTC (rev 422) @@ -39,11 +39,11 @@ import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import javax.xml.parsers.DocumentBuilder; +import net.sf.gridarta.io.CFileReader; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.util.filter.file.FilenameFileFilter; import net.sf.japi.xml.NodeListIterator; -import net.sf.gridarta.io.CFileReader; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-09-24 23:04:34 UTC (rev 422) @@ -27,7 +27,6 @@ package daieditor.gameobject; import daieditor.CFTreasureListTree; -import net.sf.gridarta.io.CFileReader; import daieditor.CMainControl; import daieditor.CPickmapPanel; import daieditor.IGUIConstants; @@ -60,6 +59,7 @@ import java.util.Map; import java.util.TreeMap; import javax.swing.ImageIcon; +import net.sf.gridarta.io.CFileReader; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.Progress; Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-09-24 23:04:34 UTC (rev 422) @@ -38,8 +38,8 @@ import java.io.Serializable; import javax.swing.ImageIcon; import javax.swing.JList; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; /** * The <code>GameObject</code> class handles the Daimonin GameObjects. Modified: trunk/daimonin/src/daieditor/gameobject/GameObjectContainer.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObjectContainer.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gameobject/GameObjectContainer.java 2006-09-24 23:04:34 UTC (rev 422) @@ -22,15 +22,15 @@ package daieditor.gameobject; import daieditor.map.MapSquare; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.ArrayList; import java.util.ListIterator; -import java.io.Serializable; -import java.io.ObjectInputStream; -import java.io.IOException; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; /** * Base class for classes that contain GameObjects as children in the sense of containment. Modified: trunk/daimonin/src/daieditor/gameobject/NamedObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/NamedObject.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gameobject/NamedObject.java 2006-09-24 23:04:34 UTC (rev 422) @@ -21,8 +21,8 @@ package daieditor.gameobject; +import java.io.Serializable; import javax.swing.ImageIcon; -import java.io.Serializable; /** * A <code>NamedObject</code> has a name and tree position source and provides an icon for display. Modified: trunk/daimonin/src/daieditor/gameobject/RecursiveGameObjectIterator.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/RecursiveGameObjectIterator.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gameobject/RecursiveGameObjectIterator.java 2006-09-24 23:04:34 UTC (rev 422) @@ -1,8 +1,8 @@ package daieditor.gameobject; +import java.util.EmptyStackException; import java.util.Iterator; import java.util.Stack; -import java.util.EmptyStackException; /** * Iterator for recursively iterating over ArchObjectContainers. Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2006-09-24 23:04:34 UTC (rev 422) @@ -28,9 +28,9 @@ import daieditor.gameobject.NamedObject; import daieditor.gameobject.face.FaceFacade; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import java.io.Serializable; import javax.swing.ImageIcon; /** Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-09-24 23:04:34 UTC (rev 422) @@ -26,7 +26,6 @@ package daieditor.gameobject.anim; import daieditor.PathManager; -import net.sf.gridarta.io.CFileReader; import daieditor.gameobject.NamedObjects; import java.io.BufferedReader; import java.io.File; @@ -37,6 +36,7 @@ import java.io.Reader; import java.util.HashMap; import java.util.Map; +import net.sf.gridarta.io.CFileReader; import org.jetbrains.annotations.Nullable; Modified: trunk/daimonin/src/daieditor/gui/DirectionLayout.java =================================================================== --- trunk/daimonin/src/daieditor/gui/DirectionLayout.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gui/DirectionLayout.java 2006-09-24 23:04:34 UTC (rev 422) @@ -35,7 +35,6 @@ import java.awt.Insets; import java.awt.LayoutManager2; import java.io.Serializable; -import static java.lang.Math.max; /** * This class implements a layout that is similar to {@link java.awt.BorderLayout} but implements those directions used in Daimonin. Modified: trunk/daimonin/src/daieditor/gui/map/MapTilePane.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2006-09-24 23:04:34 UTC (rev 422) @@ -26,7 +26,6 @@ import daieditor.CMainControl; import daieditor.IGUIConstants; import daieditor.PathManager; -import net.sf.gridarta.io.CFileReader; import daieditor.gui.DirectionLayout; import daieditor.map.MapArchObject; import daieditor.map.MapControl; @@ -59,6 +58,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.sf.gridarta.Size2D; +import net.sf.gridarta.io.CFileReader; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import org.jetbrains.annotations.Nullable; Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-09-24 23:04:34 UTC (rev 422) @@ -28,8 +28,8 @@ import daieditor.CFArchTypeList; import daieditor.CMainControl; import daieditor.IGUIConstants; +import daieditor.gameobject.ArchObjectParser; import daieditor.gameobject.GameObject; -import daieditor.gameobject.ArchObjectParser; import java.awt.Point; import java.awt.Toolkit; import java.util.ArrayList; Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-09-24 23:04:34 UTC (rev 422) @@ -25,10 +25,10 @@ package daieditor.map; import daieditor.CMainControl; -import daieditor.MapViewIFrame; import daieditor.CPickmapPanel; import daieditor.CopyBuffer; import daieditor.IGUIConstants; +import daieditor.MapViewIFrame; import daieditor.gameobject.GameObject; import daieditor.gui.map.LevelRenderer; import daieditor.gui.map.SimpleLevelRenderer; @@ -45,8 +45,8 @@ import java.util.List; import javax.imageio.ImageIO; import javax.swing.ImageIcon; +import net.sf.gridarta.CUndoStack; import net.sf.gridarta.Size2D; -import net.sf.gridarta.CUndoStack; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapGrid; import net.sf.japi.swing.ActionFactory; Modified: trunk/daimonin/src/daieditor/map/MapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapModel.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/map/MapModel.java 2006-09-24 23:04:34 UTC (rev 422) @@ -2,10 +2,10 @@ import daieditor.gameobject.GameObject; import java.awt.Point; +import java.io.Serializable; import java.util.Iterator; -import java.io.Serializable; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; /** * Interface for MapModels. Modified: trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java =================================================================== --- trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java 2006-09-24 23:04:34 UTC (rev 422) @@ -1,7 +1,7 @@ package daieditor.map.validation.checks; +import daieditor.map.MapArchObject; import daieditor.map.MapModel; -import daieditor.map.MapArchObject; import daieditor.map.validation.AbstractValidator; import daieditor.map.validation.ErrorCollector; import daieditor.map.validation.MapValidator; Modified: trunk/src/app/net/sf/gridarta/io/CFileReader.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/CFileReader.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/app/net/sf/gridarta/io/CFileReader.java 2006-09-24 23:04:34 UTC (rev 422) @@ -32,7 +32,6 @@ import java.io.InputStreamReader; import java.io.Reader; import java.io.UnsupportedEncodingException; -import net.sf.gridarta.io.CFileInputStream; /** * Class for opening and reading a buffered stream to an ASCII resource-file. Modified: trunk/src/app/net/sf/gridarta/map/AbstractMapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapArchObject.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapArchObject.java 2006-09-24 23:04:34 UTC (rev 422) @@ -1,7 +1,7 @@ package net.sf.gridarta.map; +import net.sf.gridarta.Size2D; import org.jetbrains.annotations.NotNull; -import net.sf.gridarta.Size2D; /** * Base implementation of {@link MapArchObject} that covers similarities between Crossfire maps and Daimonin maps. Modified: trunk/src/app/net/sf/gridarta/map/MapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapArchObject.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/app/net/sf/gridarta/map/MapArchObject.java 2006-09-24 23:04:34 UTC (rev 422) @@ -1,7 +1,7 @@ package net.sf.gridarta.map; +import net.sf.gridarta.Size2D; import org.jetbrains.annotations.NotNull; -import net.sf.gridarta.Size2D; /** * Interface for MapArchObjects. Modified: trunk/src/app/net/sf/gridarta/map/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapModel.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/app/net/sf/gridarta/map/MapModel.java 2006-09-24 23:04:34 UTC (rev 422) @@ -1,9 +1,9 @@ package net.sf.gridarta.map; +import java.awt.Point; +import net.sf.gridarta.Size2D; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import net.sf.gridarta.Size2D; -import java.awt.Point; /** * A MapModel reflects the data of a map. Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2006-09-24 23:04:34 UTC (rev 422) @@ -23,7 +23,6 @@ package net.sf.gridarta.textedit.scripteditor; -import net.sf.gridarta.textedit.textarea.JEditTextArea; import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -32,6 +31,7 @@ import javax.swing.JFileChooser; import javax.swing.JOptionPane; import net.sf.gridarta.MainControl; +import net.sf.gridarta.textedit.textarea.JEditTextArea; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditMenuBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditMenuBar.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditMenuBar.java 2006-09-24 23:04:34 UTC (rev 422) @@ -23,8 +23,6 @@ package net.sf.gridarta.textedit.scripteditor; -import net.sf.gridarta.textedit.textarea.InputHandler; -import net.sf.gridarta.textedit.textarea.JEditTextArea; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -33,6 +31,8 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.KeyStroke; +import net.sf.gridarta.textedit.textarea.InputHandler; +import net.sf.gridarta.textedit.textarea.JEditTextArea; /** * This class implements the MenuBar of the script editor. Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2006-09-24 23:04:34 UTC (rev 422) @@ -23,9 +23,6 @@ package net.sf.gridarta.textedit.scripteditor; -import net.sf.gridarta.textedit.textarea.JEditTextArea; -import net.sf.gridarta.textedit.textarea.LuaTokenMarker; -import net.sf.gridarta.textedit.textarea.SyntaxDocument; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.WindowAdapter; @@ -43,6 +40,9 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.text.BadLocationException; +import net.sf.gridarta.textedit.textarea.JEditTextArea; +import net.sf.gridarta.textedit.textarea.LuaTokenMarker; +import net.sf.gridarta.textedit.textarea.SyntaxDocument; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java 2006-09-24 23:04:34 UTC (rev 422) @@ -9,8 +9,6 @@ package net.sf.gridarta.textedit.textarea; -import net.sf.gridarta.textedit.scripteditor.CFPythonPopup; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import java.awt.Component; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; @@ -28,6 +26,8 @@ import java.util.Map; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; +import net.sf.gridarta.textedit.scripteditor.CFPythonPopup; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/src/test/net/sf/gridarta/Size2DTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/Size2DTest.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/test/net/sf/gridarta/Size2DTest.java 2006-09-24 23:04:34 UTC (rev 422) @@ -1,9 +1,9 @@ package test.net.sf.gridarta; import net.sf.gridarta.Size2D; -import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import org.junit.Test; /** * Test for {@link Size2D}. Modified: trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java 2006-09-24 22:49:38 UTC (rev 421) +++ trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java 2006-09-24 23:04:34 UTC (rev 422) @@ -3,8 +3,8 @@ import java.io.File; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.japi.util.filter.file.AbstractFileFilter; +import static org.junit.Assert.fail; import org.junit.Test; -import static org.junit.Assert.fail; /** * Test for {@link HideFileFilterProxy}. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-09-27 17:34:41
|
Revision: 426 http://svn.sourceforge.net/gridarta/?rev=426&view=rev Author: akirschbaum Date: 2006-09-27 10:34:32 -0700 (Wed, 27 Sep 2006) Log Message: ----------- Remove spurious error message ("Wrong formatted HTML!") when displaying help. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/src/app/net/sf/gridarta/help/Help.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-09-26 18:39:02 UTC (rev 425) +++ trunk/crossfire/ChangeLog 2006-09-27 17:34:32 UTC (rev 426) @@ -1,3 +1,8 @@ +2006-09-27 Andreas Kirschbaum + + * Remove spurious error message ("Wrong formatted HTML!") when + displaying help. + 2006-09-26 Andreas Kirschbaum * Make inventory display of multi-part objects in map tile panel Modified: trunk/src/app/net/sf/gridarta/help/Help.java =================================================================== --- trunk/src/app/net/sf/gridarta/help/Help.java 2006-09-26 18:39:02 UTC (rev 425) +++ trunk/src/app/net/sf/gridarta/help/Help.java 2006-09-27 17:34:32 UTC (rev 426) @@ -68,10 +68,7 @@ fname = "start.html"; } final HtmlPane html; - if (fname.startsWith("<HTML>") || fname.startsWith("<html")) { - if (fname.startsWith("<HTML")) { - System.err.println("Wrong formatted HTML!"); - } + if (fname.startsWith("<HTML>") || fname.startsWith("<html>")) { html = new HtmlPane("text/html", fname); // direct text } else { html = new HtmlPane(fname); // read html file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-09-27 17:39:52
|
Revision: 427 http://svn.sourceforge.net/gridarta/?rev=427&view=rev Author: akirschbaum Date: 2006-09-27 10:39:43 -0700 (Wed, 27 Sep 2006) Log Message: ----------- Fix object attributes dialog: do not ignore changed string attributes if old and new value only differs in case. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-09-27 17:34:32 UTC (rev 426) +++ trunk/crossfire/ChangeLog 2006-09-27 17:39:43 UTC (rev 427) @@ -1,5 +1,8 @@ 2006-09-27 Andreas Kirschbaum + * Fix object attributes dialog: do not ignore changed string + attributes if old and new value only differs in case. + * Remove spurious error message ("Wrong formatted HTML!") when displaying help. Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-27 17:34:32 UTC (rev 426) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-27 17:39:43 UTC (rev 427) @@ -1257,12 +1257,12 @@ if (attr.ref.getNameOld().equalsIgnoreCase("name")) { // special case #1: "name"-textfield if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - if (!inline.equalsIgnoreCase(defarch.getObjName())) { + if (!inline.equals(defarch.getObjName())) { newName = inline; } else { newName = ""; } - } else if (!inline.equalsIgnoreCase(defarch.getArchetypeName())) { + } else if (!inline.equals(defarch.getArchetypeName())) { newName = inline; } else { newName = ""; @@ -1270,13 +1270,13 @@ } else if (attr.ref.getNameOld().equalsIgnoreCase("face")) { // special case #2: "face"-textfield if (defarch.getFaceName() != null && defarch.getFaceName().length() > 0 && - !inline.equalsIgnoreCase(defarch.getFaceName())) { + !inline.equals(defarch.getFaceName())) { newFace = inline; } else { newFace = ""; } } else { - if (!inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), null))) { + if (!inline.equals(defarch.getAttributeString(attr.ref.getNameOld(), null))) { newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-27 17:34:32 UTC (rev 426) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-27 17:39:43 UTC (rev 427) @@ -1098,18 +1098,18 @@ if ("name".equalsIgnoreCase(attr.ref.getNameOld())) { // special case #1: "name"-textfield if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - if (!inline.equalsIgnoreCase(defarch.getObjName())) { + if (!inline.equals(defarch.getObjName())) { newName = inline; } else { newName = ""; } - } else if (!inline.equalsIgnoreCase(defarch.getArchetypeName())) { + } else if (!inline.equals(defarch.getArchetypeName())) { newName = inline; } else { newName = ""; } } else if ("animation".equalsIgnoreCase(attr.ref.getNameOld())) { - if (inline.length() > 0 && !inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), false))) { + if (inline.length() > 0 && !inline.equals(defarch.getAttributeString(attr.ref.getNameOld(), false))) { newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; arch.setAnimName(inline); } else { @@ -1125,7 +1125,7 @@ } newFace = inline; } else { - if (!inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), false))) { + if (!inline.equals(defarch.getAttributeString(attr.ref.getNameOld(), false))) { newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-09-29 22:23:39
|
Revision: 433 http://svn.sourceforge.net/gridarta/?rev=433&view=rev Author: akirschbaum Date: 2006-09-29 15:23:07 -0700 (Fri, 29 Sep 2006) Log Message: ----------- Replace node number by archetype name for unique identification key of archetypes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.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/gameobject/ArchObjectParser.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gui/ArchComboBox.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/crossfire/src/cfeditor/parameter/ArchParameter.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-09-29 22:23:07 UTC (rev 433) @@ -44,7 +44,7 @@ private static final String filename = "autojoin.txt"; // file with autojoin lists - // bitmask constants for nodenr index + // bitmask constants for archnames index private static final int NORTH = 1; private static final int EAST = 2; @@ -61,13 +61,13 @@ //index: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 //means: 0, N, E, NE, S, NS, ES, NES, W, WN, WE, WNE, SW, SWN, ESW, NESW // (0 = no connection, N = north, E = east, S = south, W = west) - private int[] nodenr; + private String[] archnames; /** Konstructor */ public AutojoinList() { stack = null; // pointer to stack of default arches next = null; // pointer to next element - nodenr = null; // this array gets initialized in loadList (when needed) + archnames = null; // this array gets initialized in loadList (when needed) } /** @@ -88,7 +88,7 @@ try { String line; // line of file boolean sectionFlag = false; // true while section (start ... end) read - final int[] nbuf = new int[16]; // buffer for nodenumbers of 16 arches + final String[] nbuf = new String[16]; // buffer for archetype names of 16 arches int count = 0; // counter index AutojoinList jlist = this; // index of the linked list of AutojoinLists // (starting at 'this') @@ -120,12 +120,12 @@ } jlist.stack = archstack; // set link to arch stack - jlist.nodenr = new int[16]; // array to store the nodenrs. + jlist.archnames = new String[16]; // array to store the archetype names for (int i = 0; i < 16; i++) { - jlist.nodenr[i] = nbuf[i]; // store nodenr. in the list + jlist.archnames[i] = nbuf[i]; // store archetype name in the list archstack.getArch(nbuf[i]).setJoinList(jlist); // set the link in the def. arch if (log.isDebugEnabled()) { - log.debug("(" + i + ") arch: '" + archstack.getArch(nbuf[i]).getArchetypeName() + "' -> nr: (" + nbuf[i] + ")"); + log.debug("(" + i + ") arch: '" + archstack.getArch(nbuf[i]).getArchetypeName() + "' -> (" + nbuf[i] + ")"); } } @@ -139,12 +139,11 @@ } else if (count < 16) { // add a new archid to the buffer - // try to parse the arch node_nr from the hashtable - final int entry = ArchetypeSet.getArchetypeIndex(line); - if (entry != -1) { - nbuf[count] = entry; + final GameObject arch = archstack.getArch(line); + if (arch != null) { + nbuf[count] = line; - if (!archstack.getArch(nbuf[count]).isMulti()) { + if (!arch.isMulti()) { count++; // no multipart, this one's okay } else { log.warn("In file " + filename + ": Arch '" + line + "' is a multipart."); @@ -181,21 +180,21 @@ /** * Do autojoining on insertion of a default arch on the map. * All arches around the insert point get adjusted, and the - * node_nr of the correct arch to be inserted is returned. + * archetype name of the correct arch to be inserted is returned. * This method must be called from the appropriate element of the * AutojoinList, best use the link from the default arch. * @param x Location of the insert point on the map * @param y Location of the insert point on the map * @param map Data model of the map - * @return node_nr of the (def.) arch to be inserted at x, y - * -1 if there's already an arch of this list on x, y + * @return the archetype name of the (default) arch to be inserted at x, y + * <code>null</code> if there's already an arch of this list on x, y */ - public int joinInsert(final MapModel map, final int x, final int y) { + public String joinInsert(final MapModel map, final int x, final int y) { int newIndex = 0; // return value, see above // if there already is an arch of this list at x, y -> abort if (findArchOfJoinlist(map, x, y) != null) { - return -1; // we don't want same arches over each other + return null; // we don't want same arches over each other } // now do the joining in all four directions: @@ -203,32 +202,32 @@ 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)]); + connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), SOUTH)]); } } 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)]); + connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), WEST)]); } } 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)]); + connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), NORTH)]); } } 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)]); + connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), EAST)]); } } - return nodenr[newIndex]; + return archnames[newIndex]; } /** @@ -246,47 +245,45 @@ // do the joining in all four directions: if (map.isPointValid(x, y - 1)) { if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { - connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), SOUTH)]); + connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), SOUTH)]); } } if (map.isPointValid(x + 1, y)) { if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { - connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), WEST)]); + connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), WEST)]); } } if (map.isPointValid(x, y + 1)) { if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { - connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), NORTH)]); + connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), NORTH)]); } } if (map.isPointValid(x - 1, y)) { if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { - connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), EAST)]); + connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), EAST)]); } } } /** - * Looking up the given node in the nodenr-array of this class. + * Looking up the given node in the archnames-array of this class. * @param node node to lookup * @return index of the node in the array. */ - private int getIndex(final int node) { + private int getIndex(final String archname) { int i; - for (i = 0; i < 16 && node != nodenr[i]; i++) { - ; + for (i = 0; i < 16; i++) { + if (archnames[i].equals(archname)) { + return i; + } } - if (node != nodenr[i]) { - log.warn("Error in AutojoinList.get_index: index not found"); - return 0; - } - - return i; + log.warn("Error in AutojoinList.get_index: index not found"); + return 0; } /** Checks if the index (=bitmask) contains the following direction */ @@ -316,7 +313,7 @@ GameObject tmpArch = map.getTopArchObject(x, y); // we look through the arches at the given location (top to bottom): for (; tmpArch != null; tmpArch = tmpArch.getPrev()) { - if (stack.getArch(tmpArch.getNodeNr()).getJoinList() == this) { + if (stack.getArch(tmpArch.getArchetypeName()).getJoinList() == this) { return tmpArch; // we found an arch } } @@ -328,13 +325,12 @@ * Add/remove a certain connection of the given arch * by changing archtype and face. */ - private void connectArch(final GameObject arch, final int newNodenr) { - final GameObject defarch = stack.getArch(newNodenr); // new default arch + private void connectArch(final GameObject arch, final String archname) { + final GameObject defarch = stack.getArch(archname); // new default arch - if (arch.getNodeNr() != newNodenr) { + if (!arch.getArchetypeName().equals(archname)) { // set new archtype - arch.setNodeNr(newNodenr); - arch.setArchetypeName(defarch.getArchetypeName()); + arch.setArchetypeName(archname); // set face of new default arch arch.setFaceNr(defarch.getFaceNr()); Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-09-29 22:23:07 UTC (rev 433) @@ -56,7 +56,7 @@ /** The "Import..." button. */ - private int selectedArch; + private String selectedArch; /** Panel holding both archlist and pickmaps. */ private final JTabbedPane archAndPickPane; @@ -85,7 +85,7 @@ public CArchPanel(final CMainControl mainControl) { this.mainControl = mainControl; final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - selectedArch = -1; + selectedArch = null; setLayout(new BorderLayout()); tabDesktop = new JTabbedPane(SwingConstants.TOP); @@ -161,8 +161,8 @@ return selectedPanel.addArchPanelCombo(name); } - public void addArchPanelArch(final int archnr, final int index) { - selectedPanel.addArchPanelArch(archnr, index); + public void addArchPanelArch(final String archname, final int index) { + selectedPanel.addArchPanelArch(archname, index); } public void disableTabPane() { @@ -223,12 +223,12 @@ settings.setProperty(ARCHPANEL_LOCATION_KEY, String.valueOf(splitPane.getDividerLocation())); } - public int getPanelArch() { + public String getPanelArch() { return selectedArch; } - public void setPanelArch(final int arch) { - selectedArch = arch; + public void setPanelArch(final String archname) { + selectedArch = archname; } void refresh() { Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-29 22:23:07 UTC (rev 433) @@ -125,8 +125,8 @@ int index = theList.getSelectedIndex(); if (index != -1) { - index = Integer.parseInt(theList.getSelectedValue().toString()); - arch = mainControl.getArchObjectStack().getArch(index); + final String archname = theList.getSelectedValue().toString(); + arch = mainControl.getArchObjectStack().getArch(archname); } return arch; } @@ -136,8 +136,8 @@ if (index != -1) { try { - index = Integer.parseInt(theList.getSelectedValue().toString()); - arch = mainControl.getArchObjectStack().getArch(index); + final String archname = theList.getSelectedValue().toString(); + arch = mainControl.getArchObjectStack().getArch(archname); } catch (final NullPointerException e) { /* log.info("NullPointerException in showArchListObject()!", e); @@ -153,17 +153,18 @@ /** * Add this arch to list of (this) Jlist list. - * @param archnr nr of the arch to add - * @param index index of subdir where to add + * @param archname name of the arch to add + * @param index index of subdir where to add */ - public void addArchPanelArch(final int archnr, final int index) { - final String def = "00000"; - String num = Integer.toString(archnr); + public void addArchPanelArch(final String archname, final int index) { + final String def = " "; + assert def.length() == 45; + assert archname.length() <= def.length(); - list.append(def.substring(0, 5 - num.length())); - list.append(num); + list.append(archname); + list.append(def.substring(0, 45 - archname.length())); - num = Integer.toString(index); + final String num = Integer.toString(index); list.append(def.substring(0, 5 - num.length())); list.append(num); @@ -194,11 +195,11 @@ * to know to which categories the arches belong to: * @return an array of nodenumbers from all arches in this panel */ - public int[] getListNodeNrArray() { - final int[] numList = new int[(int) (list.length() / 10.0)]; + public String[] getListArchNameArray() { + final String[] numList = new String[(int) (list.length() / 50.0)]; - for (int i = 0; i < (int) (list.length() / 10.0); i++) { - numList[i] = Integer.parseInt(list.substring(10 * i, 5 + 10 * i)); + for (int i = 0; i < (int) (list.length() / 50.0); i++) { + numList[i] = list.substring(50 * i, 45 + 50 * i).trim(); //log.debug(CMainControl.getInstance().getArchObjectStack().getArch(numList[i]).getArchetypeName()); } @@ -209,14 +210,14 @@ * this is only needed when arche collection is run, so we want * to know to which categories the arches belong to: * @return an array of the categories of all arches in this panel<br> - * note that the same indices are used for same arches in 'getListNodeNrArray()' + * note that the same indices are used for same arches in 'getListArchNameArray()' */ public String[] getListCategoryArray() { - final String[] catList = new String[(int) (list.length() / 10.0)]; + final String[] catList = new String[(int) (list.length() / 50.0)]; - for (int i = 0; i < (int) (list.length() / 10.0); i++) { + for (int i = 0; i < (int) (list.length() / 50.0); i++) { try { - final int index = Integer.parseInt(list.substring(5 + 10 * i, 10 + 10 * i)); + final int index = Integer.parseInt(list.substring(45 + 50 * i, 50 + 50 * i)); catList[i] = jbox.getItemAt(index).toString().trim(); } catch (final NullPointerException e) { log.warn("Nullpointer in getListCategoryArray()!", e); @@ -239,15 +240,15 @@ for (int i = 0; i < listcounter; i++) { if (index >= 0) { if (index == 0) { - // this.model.addElement(this.list.substring(offset, offset+5)+" I:"+this.list.substring(offset+5, offset+10)); - model.addElement(list.substring(offset, offset + 5)); + // this.model.addElement(this.list.substring(offset, offset+5)+" I:"+this.list.substring(offset+45, offset+50)); + model.addElement(list.substring(offset, offset + 45).trim()); } else { - if (index == Integer.parseInt(list.substring(offset + 5, offset + 10))) { - model.addElement(list.substring(offset, offset + 5)); + if (index == Integer.parseInt(list.substring(offset + 45, offset + 50))) { + model.addElement(list.substring(offset, offset + 45).trim()); } } } - offset += 10; + offset += 50; } } @@ -271,10 +272,10 @@ /* We additionally set the JLabels icon property here. */ - final GameObject arch = mainControl.getArchObjectStack().getArch(Integer.parseInt(value.toString())); + final GameObject arch = mainControl.getArchObjectStack().getArch(value.toString()); if (isSelected) { - archPanel.setPanelArch(Integer.parseInt(value.toString())); - mainControl.setStatusText(" " + value.toString() + " "); + archPanel.setPanelArch(value.toString()); + mainControl.setStatusText(" " + value + " "); } mainControl.setPlainFont(this); setText(arch.getArchetypeName()); Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-29 22:23:07 UTC (rev 433) @@ -982,9 +982,9 @@ } } else if (content.getType() != TreasureObj.FOLDER) { // normal arch: display the face icon - final int num = ArchetypeSet.getArchetypeIndex(content.getName()); - if (num != -1 && ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_COMPLETE) { - final GameObject arch = CMainControl.getInstance().getArch(num); + if (ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_COMPLETE) { + final String archname = content.getName(); + final GameObject arch = CMainControl.getInstance().getArch(archname); if (arch != null) { if (!arch.getFaceFlag()) { setIcon(CMainControl.getInstance().getFace(arch.getFaceNr())); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-29 22:23:07 UTC (rev 433) @@ -407,8 +407,8 @@ return archList.getArchCount(); } - public GameObject getArch(final int i) { - return archList.getArch(i); + public GameObject getArch(final String archname) { + return archList.getArch(archname); } public CopyBuffer getCopyBuffer() { @@ -590,12 +590,12 @@ return JFontChooser.msgToHtml(msg, getPlainFont()); } - boolean addArchToMap(final int archnr, final Point pos, final int intern, final boolean join) { - return currentMap.addArchToMap(archnr, pos, intern, join); + boolean addArchToMap(final String archname, final Point pos, final int intern, final boolean join) { + return currentMap.addArchToMap(archname, pos, intern, join); } - boolean insertArchToMap(final GameObject newarch, final int archnr, final GameObject next, final Point pos, final boolean join) { - return currentMap.insertArchToMap(newarch, archnr, next, pos, join); + boolean insertArchToMap(final GameObject newarch, final String archname, final GameObject next, final Point pos, final boolean join) { + return currentMap.insertArchToMap(newarch, archname, next, pos, join); } public void deleteMapArch(final int index, final Point pos, final boolean refreshMap, final boolean join) { @@ -626,12 +626,12 @@ return mainView.addArchPanelCombo(name); } - public void addArchPanelArch(final int archnr, final int index) { - mainView.addArchPanelArch(archnr, index); + public void addArchPanelArch(final String archname, final int index) { + mainView.addArchPanelArch(archname, index); } // selected arch in arch panel - public int getPanelArch() { + public String getPanelArch() { return mainView.getPanelArch(); } @@ -1017,7 +1017,7 @@ if (typelist.isEmpty()) { // types.txt is missing! showMessage("File Missing", "The definitions-file \"types.txt\" is missing! The\nattribute interface doesn't work without that file."); - } else if (arch != null && arch.getNodeNr() != -1) { + } else if (arch != null && arch.getArchetypeName() != null) { final CAttribDialog dwin = new CAttribDialog(typelist, arch, this); } } @@ -1047,13 +1047,13 @@ // first: attach our map sucker to a default arch we have loaded for (final Iterator<GameObject> it = objects.iterator(); it.hasNext();) { final GameObject arch = it.next(); - final int index1 = ArchetypeSet.getArchetypeIndex(arch.getArchetypeName()); - if (index1 == -1) { + final GameObject defarch = archList.getArch(arch.getArchetypeName()); + if (defarch == null) { // we had an unknown arch here!! // showMessage("Error Loading Map File "+file.getName(), "\n Found Unknown Arch < "+arch.getArchetypeName()+" >"); // return false; } else { - arch.setNodeNr(index1); // our default arch! + arch.setArchetype(defarch); } // 2nd: attach the right face... // if there was no special face added in map, get it from def object @@ -1324,10 +1324,10 @@ return; } - final String path = exit.getAttributeString("slaying", getArch(exit.getNodeNr())); + final String path = exit.getAttributeString("slaying", getArch(exit.getArchetypeName())); final Point exitPos = new Point(); - exitPos.x = exit.getAttributeInt("hp", getArch(exit.getNodeNr())); - exitPos.y = exit.getAttributeInt("sp", getArch(exit.getNodeNr())); + exitPos.x = exit.getAttributeInt("hp", getArch(exit.getArchetypeName())); + exitPos.y = exit.getAttributeInt("sp", getArch(exit.getArchetypeName())); if (path.length() == 0 || (currentMap.getMapFile() != null && path.equals(currentMap.getMapFile().getName()))) { @@ -1897,4 +1897,8 @@ return null; } + public GameObject[] getArchList() { + return archList.getArchList(); + } + } // class CMainControl Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-09-29 22:23:07 UTC (rev 433) @@ -370,12 +370,12 @@ return archPanel.addArchPanelCombo(name); } - public void addArchPanelArch(final int archnr, final int index) { - archPanel.addArchPanelArch(archnr, index); + public void addArchPanelArch(final String archname, final int index) { + archPanel.addArchPanelArch(archname, index); } // selected arch in arch panel - public int getPanelArch() { + public String getPanelArch() { return archPanel.getPanelArch(); } Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-09-29 22:23:07 UTC (rev 433) @@ -278,7 +278,7 @@ final GameObject invnew; if (arch.isArchetype()) { // create a new copy of a default arch - invnew = mainControl.getArchObjectStack().newArchObjectInstance(arch.getNodeNr()); + invnew = mainControl.getArchObjectStack().newArchObjectInstance(arch.getArchetypeName()); } else { // create clone from a pickmap invnew = arch.createClone(inv.getMapX(), inv.getMapY()); @@ -308,7 +308,7 @@ // are taken instead: final GameObject arch = activeArch.getHead(); - final GameObject defarch = mainControl.getArch(arch.getNodeNr()); + final GameObject defarch = mainControl.getArch(arch.getArchetypeName()); if (defarch == null) { // hm, this should NOT happen return; } @@ -700,13 +700,13 @@ // no text, we try to set the default text final boolean hasMessage; - if (arch.getMsgText() == null && arch.getNodeNr() != -1) { + if (arch.getMsgText() == null && arch.getArchetypeName() != null) { archTextArea.setForeground(Color.black); - if (mainControl.getArch(arch.getNodeNr()).getMsgText() == null) { + if (mainControl.getArch(arch.getArchetypeName()).getMsgText() == null) { archTextArea.setText(""); hasMessage = false; } else { - archTextArea.setText(mainControl.getArch(arch.getNodeNr()).getMsgText()); + archTextArea.setText(mainControl.getArch(arch.getArchetypeName()).getMsgText()); hasMessage = true; } } else { @@ -723,15 +723,15 @@ } else if (arch.getFaceName() != null) { // custom face archFaceField.setForeground(Color.blue); archFaceField.setText(arch.getFaceName()); - } else if (arch.getNodeNr() != -1) { + } else if (arch.getArchetypeName() != null) { archFaceField.setForeground(Color.black); - archFaceField.setText(mainControl.getArch(arch.getNodeNr()).getFaceName()); + archFaceField.setText(mainControl.getArch(arch.getArchetypeName()).getFaceName()); } // end face // *** OBJECT NAME *** - if (arch.getObjName() == null && arch.getNodeNr() != -1) { + if (arch.getObjName() == null && arch.getArchetypeName() != null) { archNameField.setForeground(Color.black); - if (mainControl.getArch(arch.getNodeNr()).getObjName() == null) { + if (mainControl.getArch(arch.getArchetypeName()).getObjName() == null) { // arch name if (arch.getArchetypeName() != null) { archNameField.setText(arch.getArchetypeName()); @@ -740,7 +740,7 @@ } } else { // default name - archNameField.setText(mainControl.getArch(arch.getNodeNr()).getObjName()); + archNameField.setText(mainControl.getArch(arch.getArchetypeName()).getObjName()); } } else { // object name ("special") @@ -764,7 +764,7 @@ archMapPos.setText("Map: " + arch.getMapX() + ", " + arch.getMapY()); - if (arch.getNodeNr() != -1) { + if (arch.getArchetypeName() != null) { archTypeText.setText("Type: " + mainControl.getArchObjectParser().getArchTypeName(arch.getArchTypNr()) + " (" + arch.getArchTypNr() + ") [" + arch.getArchetypeName() + "]"); } else { @@ -800,8 +800,8 @@ // black: the attributes from the default archetype // that don't exist among the "special" ones StyleConstants.setForeground(currentAttributes, Color.black); - if (arch.getObjectText() != null && mainControl.getArchObjectStack().getArch(arch.getNodeNr()) != null) { - doc.insertString(doc.getLength(), arch.diffArchText(mainControl.getArchObjectStack().getArch(arch.getNodeNr()).getObjectText(), true), currentAttributes); + if (arch.getObjectText() != null && mainControl.getArchObjectStack().getArch(arch.getArchetypeName()) != null) { + doc.insertString(doc.getLength(), arch.diffArchText(mainControl.getArchObjectStack().getArch(arch.getArchetypeName()).getObjectText(), true), currentAttributes); } } catch (final BadLocationException e) { // TODO Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-29 22:23:07 UTC (rev 433) @@ -360,10 +360,10 @@ /** * Add inventory objects to an arch in the MapTileList recursively. * @param node the arch where the inventory gets added - * @param archid nodeNr of the highlighted arch (?) + * @param archid object id of the highlighted arch (?) * @param indent indentation; 1=minimal indentation */ - public void addInvObjects(final GameObject node, final int archid, final int indent) { + private void addInvObjects(final GameObject node, final int archid, final int indent) { final String indentStr = Integer.toString(indent); final Iterator it = node.getHead().iterator(); @@ -425,7 +425,7 @@ this.setBackground(IGUIConstants.BG_COLOR); } - if (arch.getNodeNr() == -1) { + if (arch.getArchetypeName() == null) { setIcon(mainControl.getNoarchTileIcon()); } else if (arch.getFaceFlag()) { setIcon(mainControl.getNofaceTileIcon()); @@ -443,8 +443,8 @@ setText(arch.getObjName()); // special name } else { final String defname; - if (arch.getNodeNr() != -1) { - defname = mainControl.getArch(arch.getNodeNr()).getObjName(); + if (arch.getArchetypeName() != null) { + defname = mainControl.getArch(arch.getArchetypeName()).getObjName(); } else { defname = null; } Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-09-29 22:23:07 UTC (rev 433) @@ -414,7 +414,7 @@ final Point[] redraw; // return value (coords needing redraw) - if (mainControl.getAutojoin() && mainControl.getArch(arch.getNodeNr()).getJoinList() != null) { + if (mainControl.getAutojoin() && mainControl.getArch(arch.getArchetypeName()).getJoinList() != null) { // this arch does autojoining: // first look how many we need @@ -737,7 +737,7 @@ continue; } if (mainControl.isTileEdit(node.getEditType()) || mainControl.getTileEdit() == 0 || isPickmap) { - if (node.getNodeNr() == -1) { + if (node.getArchetypeName() == null) { mainControl.getNoarchTileIconX().paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); } else if (node.getFaceFlag()) { mainControl.getNofaceTileIconX().paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); @@ -844,7 +844,7 @@ continue; } if (mainControl.isTileEdit(node.getEditType()) || mainControl.getTileEdit() == 0) { - if (node.getNodeNr() == -1) { + if (node.getArchetypeName() == null) { mainControl.getNoarchTileIconX().paintIcon(this, tmpGrfx, 0, 0); } else if (node.getFaceFlag()) { mainControl.getNofaceTileIconX().paintIcon(this, tmpGrfx, 0, 0); @@ -1429,7 +1429,7 @@ final Iterator it = mapControl.getArchObjects(pos); while (it.hasNext()) { final GameObject t = (GameObject) it.next(); - if (t.getNodeNr() == newarch.getNodeNr() && + if (t.getArchetypeName().equals(newarch.getArchetypeName()) && t.getArchTypNr() == newarch.getArchTypNr()) { insertAllowed = false; // there's a match - don't insert a second one } @@ -1446,7 +1446,7 @@ // insert multi tile from pickmap: newarch = newarch.getHead(); // first insert default arch from archlist - if (!mapControl.addArchToMap(newarch.getNodeNr(), pos, allowMany ? -1 : drawInternCount, MapModel.JOIN_DISABLE)) { + if (!mapControl.addArchToMap(newarch.getArchetypeName(), pos, allowMany ? -1 : drawInternCount, MapModel.JOIN_DISABLE)) { // do nothing } else { // insertion successful, now get redraw info @@ -1512,7 +1512,7 @@ } // first insert default arch from archlist - if (!allSpacesFree || !mapControl.addArchToMap(newarch.getNodeNr(), pos, -1, MapModel.JOIN_DISABLE)) { + if (!allSpacesFree || !mapControl.addArchToMap(newarch.getArchetypeName(), pos, -1, MapModel.JOIN_DISABLE)) { // do nothing } else { // insertion successful, now get redraw info Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-29 22:23:07 UTC (rev 433) @@ -358,11 +358,11 @@ private void addArchToMap(final MapControl mapControl, final GameObject arch, final Point pos, final int intern, final boolean fillBelow) { final GameObject newHead; if (arch.isArchetype()) { - mapControl.addArchToMap(arch.getNodeNr(), pos, intern, false, fillBelow); + mapControl.addArchToMap(arch.getArchetypeName(), pos, intern, false, fillBelow); } else { newHead = arch.createClone(pos.x, pos.y); for (GameObject tmp = arch.getArchetype().getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { - final GameObject newTail = mainControl.getArchObjectStack().newArchObjectInstance(tmp.getNodeNr()); + final GameObject newTail = mainControl.getArchObjectStack().newArchObjectInstance(tmp.getArchetypeName()); final Point mapPos = new Point(pos.x + newTail.getMultiX(), pos.y + newTail.getMultiY()); Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-09-29 22:23:07 UTC (rev 433) @@ -342,11 +342,11 @@ if (replaceArch.isMulti()) { // multi's cannot be inserted properly, so we just put them ontop replaceArch = replaceArch.getHead(); - mapControl.addArchToMap(replaceArch.getNodeNr(), pos, 0, false); + mapControl.addArchToMap(replaceArch.getArchetypeName(), pos, 0, false); // TODO: if from pickmap it could have special attributes -> copy them } else { - mapControl.insertArchToMap(replaceArch, 0, prevArch, pos, false); + mapControl.insertArchToMap(replaceArch, null, prevArch, pos, false); } } replaceCount++; Modified: trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/gameobject/ArchObjectParser.java 2006-09-29 22:23:07 UTC (rev 433) @@ -296,7 +296,7 @@ if (!ArchetypeSet.isLoadedFromArchive() || archName != null) { // loading from individual files, so we simply add it to list // ArchetypeSet.loadArchFromFiles() takes care of the panels - mainControl.addArchPanelArch(mainControl.getArchCount(), index); + mainControl.addArchPanelArch(arch.getArchetypeName(), index); } else { // loading from collected files, so we need process panels here if (isNewCategory) { @@ -328,7 +328,7 @@ isNewCategory = false; oldCat = newCat; } - mainControl.addArchPanelArch(mainControl.getArchCount(), index); + mainControl.addArchPanelArch(arch.getArchetypeName(), index); } } } @@ -492,13 +492,13 @@ * @param editType edit type(s) to be calculated for the arch */ public void postParseMapArch(final GameObject arch, final int editType) { - if (arch.getNodeNr() == -1) { + if (arch.getArchetypeName() == null) { return; } final String text = arch.getObjectText(); final int len = text.length(); - final GameObject defarch = mainControl.getArch(arch.getNodeNr()); + final GameObject defarch = mainControl.getArch(arch.getArchetypeName()); arch.resetArchText(); for (int i = 0, s = 0; i < len; i++) { @@ -559,7 +559,7 @@ * @param arch multipart head that needs tail attached */ public void expandMulti(final GameObject arch, final List<GameObject> objects) { - final GameObject defarch = mainControl.getArch(arch.getNodeNr()); // default arch + final GameObject defarch = mainControl.getArch(arch.getArchetypeName()); // default arch // is it a multi head? if (defarch != null && defarch.isMulti() && arch.getMultiRefCount() <= 1) { @@ -567,7 +567,7 @@ // do insertion for all non-head parts of the multi for (GameObject oldPart = defarch.getMultiNext(); oldPart != null; oldPart = oldPart.getMultiNext()) { - final GameObject newarch = mainControl.getArchObjectStack().newArchObjectInstance(oldPart.getNodeNr()); + final GameObject newarch = mainControl.getArchObjectStack().newArchObjectInstance(oldPart.getArchetypeName()); assert newarch != null; arch.addTailPart(newarch); Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-09-29 22:23:07 UTC (rev 433) @@ -48,6 +48,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.TreeMap; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JDialog; @@ -84,8 +85,8 @@ */ private static boolean loadedFromArchive = false; - // this is the static part.. i want fast access later - private final ArchtypeNode[] archNodeList = new ArchtypeNode[10000]; + /** The defined default arches. */ + private final TreeMap<String, GameObject> arches = new TreeMap<String, GameObject>(); private final FaceObject[] faceObjects = new FaceObject[10000]; @@ -94,10 +95,6 @@ // in the table is faster than in the static arrays, we can change this private static final Map<String, Integer> faceMap = new HashMap<String, Integer>(); - private static final Map<String, Integer> archetypeMap = new HashMap<String, Integer>(); - - private int archetypeNodeListCount; // ALL default arches loaded - private int archObjCount; // all objects, multi tile arches = 1 object private int faceListCount; // all loaded face pictures @@ -112,7 +109,6 @@ */ public ArchetypeSet(final CMainControl mainControl) { this.mainControl = mainControl; - archetypeNodeListCount = 0; faceListCount = 0; archObjCount = 0; GameObject.setArchetypeSet(this); // add static reference to GameObject @@ -147,15 +143,6 @@ return faceMap.containsKey(faceName) ? faceMap.get(faceName) : -1; } - /** Returns the index of an arch in the arch map or -1. - * @param archetypeName name of arch to get index for - * @return index of arch in map or -1 if arch is not in map - * @deprecated the index system is slow and unmaintainable and therefore will be removed - */ - @Deprecated public static int getArchetypeIndex(final String archetypeName) { - return archetypeMap.containsKey(archetypeName) ? archetypeMap.get(archetypeName) : -1; - } - @Nullable public ImageIcon getFace(final int i) { if (i >= 0 && i < faceListCount) { return faceObjects[i].getFace(); @@ -173,59 +160,47 @@ } public int getArchCount() { - return archetypeNodeListCount; + return arches.size(); } public int getFaceCount() { return faceListCount; } - @Nullable public ArchtypeNode getNextNode(final ArchtypeNode node) { - if (node == null) { - return archNodeList[0]; - } - - final int i = node.archtypeData.getNodeNr(); - if (i + 1 < archetypeNodeListCount) { - return archNodeList[i + 1]; - } - - return null; - } - /** - * Get the Archetype with the specified internal index as GameObject (not yet instanciated). - * @param i internal Archetype index - * @return GameObject with Archetype information - * @see #newArchObjectInstance(int) for a similar method that instanciates. + * Get a default GameObject by its archetype name. + * + * @param archname name of default archetype GameObject to get + * + * @return default GameObject for <var>archname</var> or <code>null</code> + * if no such GameObject exists + * + * @see #newArchObjectInstance(String) for a similar method that instantiates. */ - @Nullable public GameObject getArch(final int i) { - if (i >= 0 && i < archetypeNodeListCount) { - return archNodeList[i].archtypeData; - } - - return null; + @Nullable public GameObject getArch(final String archname) { + return arches.get(archname); } /** - * Create a GameObject for the specified Archetype internal index. - * @param i internal Archetype index - * @return GameObject instanciated from the specified Archetype + * Create a GameObject for the specified archetype name. + * + * @param archname the archetype name + * + * @return GameObject instantiated from the specified archetype */ - @Nullable public GameObject newArchObjectInstance(final int i) { - if (i < 0 && i >= archetypeNodeListCount) { + @Nullable public GameObject newArchObjectInstance(final String archname) { + final GameObject template = getArch(archname); + if (template == null) { return null; } - final GameObject template = archNodeList[i].archtypeData; - final GameObject arch = new GameObject(); arch.setArchetypeName(template.getArchetypeName()); if (!template.getFaceFlag()) { arch.setFaceNr(template.getFaceNr()); } - arch.setNodeNr(template.getNodeNr()); + arch.setArchetypeName(template.getArchetypeName()); arch.setMultiX(template.getMultiX()); arch.setMultiY(template.getMultiY()); return arch; @@ -239,11 +214,11 @@ * @todo check whether the GameObject is a default arch and reject no default arches with an exception */ public void addArchToList(final GameObject data) { - final ArchtypeNode newnode = new ArchtypeNode(data); - archetypeMap.put(data.getArchetypeName(), archetypeNodeListCount); - archNodeList[archetypeNodeListCount++] = newnode; - newnode.archtypeData.setNodeNr(archetypeNodeListCount - 1); - assert newnode.archtypeData.isArchetype(); + if (arches.containsKey(data.getArchetypeName())) { + log.warn("addArchToList: duplicate archetype '" + data.getArchetypeName() + "'"); + } else { + arches.put(data.getArchetypeName(), data); + } } /** load the arches */ @@ -626,17 +601,15 @@ } public void connectFaces() { - int i, s; - // run through arches - for (s = 0; s < archetypeNodeListCount; s++) { - final String aname = archNodeList[s].archtypeData.getFaceName(); - if (aname != null) { - final Integer num = (Integer) faceMap.get(aname); + for (final GameObject arch : arches.values()) { + final String faceName = arch.getFaceName(); + if (faceName != null) { + final Integer num = (Integer) faceMap.get(faceName); if (num != null) { - archNodeList[s].archtypeData.setFaceNr(num); + arch.setFaceNr(num); } - archNodeList[s].archtypeData.setFaceFlag(false); + arch.setFaceFlag(false); } } } @@ -689,11 +662,9 @@ for (CArchPanel.PanelNode node = CArchPanel.getStartPanelNode(); node != null; node = node.next) { - final int[] numList = node.data.getListNodeNrArray(); // list of nodenumbers + final String[] numList = node.data.getListArchNameArray(); final String[] catList = node.data.getListCategoryArray(); // list of category strings - int multiparts = 0; - // process every arch in this panel for (int i = 0; i < numList.length; i++) { @@ -734,97 +705,77 @@ pbar.setValue(count); } - // if multi-head, we must attach the tail - if (arch.isMulti()) { - // process the multipart tail: - multiparts = arch.getMultiRefCount(); - for (int j = 1; j <= multiparts; j++) { - final GameObject tail = mainControl.getArch(numList[i] + j); + // if multi-head, we must attach the tails + for (GameObject tail = arch.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + out.writeBytes("More\n"); - if (tail.isHead()) { - log.warn("Multipart object is too short!"); - final GameObject before = mainControl.getArch(numList[i]); - if (before != null) { - log.warn("-> " + multiparts + " tails expected for multipart: '" + before.getArchetypeName() + "',"); - log.warn(" but arch '" + tail.getArchetypeName() + "' follows on position " + j + " and it's not a tail."); - } - } + out.writeBytes("Object " + tail.getArchetypeName() + "\n"); - out.writeBytes("More\n"); + if (tail.getObjName() != null) { + out.writeBytes("name " + tail.getObjName() + "\n"); + } + if (tail.getFaceName() != null) { + out.writeBytes("face " + tail.getFaceName() + "\n"); + } + if (tail.getArchTypNr() > 0) { + out.writeBytes("type " + tail.getArchTypNr() + "\n"); + } - out.writeBytes("Object " + tail.getArchetypeName() + "\n"); + // special: add a string-attribute with the display-category + //out.writeBytes("editor_folder "+node.getTitle()+"/"+catList[i]+"\n"); - if (tail.getObjName() != null) { - out.writeBytes("name " + tail.getObjName() + "\n"); - } - if (tail.getFaceName() != null) { - out.writeBytes("face " + tail.getFaceName() + "\n"); - } - if (tail.getArchTypNr() > 0) { - out.writeBytes("type " + tail.getArchTypNr() + "\n"); - } + out.writeBytes(tail.getObjectText()); + if (tail.getObjectText().lastIndexOf(0x0a) != tail.getObjectText().length() - 1) { + out.writeBytes("\n"); + } - // special: add a string-attribute with the display-category - //out.writeBytes("editor_folder "+node.getTitle()+"/"+catList[i]+"\n"); - - out.writeBytes(tail.getObjectText()); - if (tail.getObjectText().lastIndexOf(0x0a) != tail.getObjectText().length() - 1) { - out.writeBytes("\n"); - } - - // position of multi relative to head - if (tail.getMultiX() != 0) { - out.writeBytes("x " + tail.getMultiX() + "\n"); - } - if (tail.getMultiY() != 0) { - out.writeBytes("y " + tail.getMultiY() + "\n"); - } - out.writeBytes("end\n"); - count++; - if (count % 100 == 0) { - pbar.setValue(count); - } + // position of multi relative to head + if (tail.getMultiX() != 0) { + out.writeBytes("x " + tail.getMultiX() + "\n"); } + if (tail.getMultiY() != 0) { + out.writeBytes("y " + tail.getMultiY() + "\n"); + } + out.writeBytes("end\n"); + count++; + if (count % 100 == 0) { + pbar.setValue(count); + } } } } // finally we need to get the "map"-arch, which is not in the panels - boolean maparchFound = false; - for (int i = 0; i < mainControl.getArchCount() && !maparchFound; i++) { - arch = mainControl.getArch(i); - if (arch.getArchetypeName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { - // process map arch - maparchFound = true; - count++; + final GameObject maparch = mainControl.getArch(ArchObjectParser.STARTARCH_NAME); + if (maparch != null) { + count++; - out.writeBytes("Object " + arch.getArchetypeName() + "\n"); + out.writeBytes("Object " + maparch.getArchetypeName() + "\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.getArchetypeName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { - out.writeBytes("x " + arch.getMultiX() + "\n"); - out.writeBytes("y " + arch.getMultiY() + "\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 (maparch.getArchetypeName().compareTo(ArchObjectParser.STARTARCH_NAME) == 0) { + out.writeBytes("x " + maparch.getMultiX() + "\n"); + out.writeBytes("y " + maparch.getMultiY() + "\n"); + } - if (arch.getObjName() != null) { - out.writeBytes("name " + arch.getObjName() + "\n"); - } - if (arch.getFaceName() != null) { - out.writeBytes("face " + arch.getFaceName() + "\n"); - } - if (arch.getArchTypNr() > 0) { - out.writeBytes("type " + arch.getArchTypNr() + "\n"); - } + if (maparch.getObjName() != null) { + out.writeBytes("name " + maparch.getObjName() + "\n"); + } + if (maparch.getFaceName() != null) { + out.writeBytes("face " + maparch.getFaceName() + "\n"); + } + if (maparch.getArchTypNr() > 0) { + out.writeBytes("type " + maparch.getArchTypNr() + "\n"); + } - out.writeBytes(arch.getObjectText()); - if (arch.getObjectText().lastIndexOf(0x0a) != arch.getObjectText().length() - 1) { - out.writeBytes("\n"); - } - - out.writeBytes("end\n"); + out.writeBytes(maparch.getObjectText()); + if (maparch.getObjectText().lastIndexOf(0x0a) != maparch.getObjectText().length() - 1) { + out.writeBytes("\n"); } + + out.writeBytes("end\n"); } // check if we still missed any arches @@ -977,6 +928,10 @@ CMainStatusbar.getInstance().setText("Collect Archetypes: done."); } + public GameObject[] getArchList() { + return arches.values().toArray(new GameObject[arches.size()]); + } + /** * Inner class: CollectProgressBar is a popup dialog for the mainview * which displays a process bar while arches are collected @@ -1064,17 +1019,4 @@ } } // class CollectProgressBar - public class ArchtypeNode { - - final GameObject archtypeData; - - final ArchtypeNode next; - - public ArchtypeNode(final GameObject data) { - this.archtypeData = data; - this.next = null; - } - - } // class ArchtypeNode - } // class ArchetypeSet Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-29 18:56:05 UTC (rev 432) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-09-29 22:23:07 UTC (rev 433) @@ -69,11 +69,8 @@ private String faceName; // face name : 1 - /** - * The name of the Archetype this GameObject is based on. - * It is the String value of the attribute <code>arch</code> that also starts a GameObject. - */ - private String archetypeName; // arch Name + /** Archetype name. */ + private String archetypeName = null; /** The name of this object. */ private String objName; @@ -98,11 +95,8 @@ private int archTextCount; // lines inserted in ArchText - private int nodenr; // we are (internal) arch nr in node list - // the nodenr determines the (default) archetype - /** The Archetype of this GameObject. */ - @NotNull private GameObject archetype; + @NotNull private GameObject archetype = this; /** Map x position if on map. */ private int mapx; @@ -178,7 +172,6 @@ myId = myIdCounter++; // increase ID counter for every new arch created - archetypeName = null; objectText = new StringBuffer(""); msgText = animText = loreText = null; archTextCount = 0; // lines inserted in objectText @@ -195,7 +188,6 @@ editflag = false; join = null; // no autojoin list per default archType = TYPE_UNSET; // type must be set - nodenr = -1; // as default we are not in a node list next = null; prev = null; mapx = 0; @@ -897,28 +889,17 @@ noface = flag; } - /* Set Node number. Node... [truncated message content] |
From: <aki...@us...> - 2006-10-01 08:47:08
|
Revision: 435 http://svn.sourceforge.net/gridarta/?rev=435&view=rev Author: akirschbaum Date: 2006-10-01 01:36:39 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Unify comments and variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchType.java trunk/daimonin/src/daieditor/CFArchTypeList.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-10-01 08:36:39 UTC (rev 435) @@ -150,7 +150,6 @@ mainControl.showArchPanelQuickObject(arch); // send it to quick view } - /** * Add this arch to list of (this) Jlist list. * @param archname name of the arch to add Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 08:36:39 UTC (rev 435) @@ -1529,7 +1529,6 @@ dispose(); } - // ============================ Subclasses ============================ /** This (Sub)Class contains the data of one arch attribute. */ public class DialogAttrib { @@ -1549,36 +1548,42 @@ } // class DialogAttrib + /** This (Sub)Class implements the dialog attribute of type BOOL. */ public final class BoolAttrib extends DialogAttrib { public JCheckBox input; // the input means of bool is a checkbox } + /** This (Sub)Class implements the dialog attribute of type INT. */ public final class IntAttrib extends DialogAttrib { public JTextField input; // the input means of int is a textfield } + /** This (Sub)Class implements the dialog attribute of type FLOAT. */ public final class FloatAttrib extends DialogAttrib { public JTextField input; // the input means of int is a textfield } + /** This (Sub)Class implements the dialog attribute of type STRING. */ public final class StringAttrib extends DialogAttrib { public JTextField input; // the input means of string is a textfield } + /** This (Sub)Class implements the dialog attribute of type TEXT. */ public final class TextAttrib extends DialogAttrib { public JTextArea input; // the input means of text is a textarea } + /** * This (Sub)Class implements the dialog attribute of types with * selection lists (ComboBoxes) to choose from. @@ -1588,10 +1593,8 @@ public JComboBox input; // the input means of spell is a combo box } - /** - * This (Sub)Class implements the dialog attribute of types with - * bitmasks to choose from. - */ + + /** DialogAttrib for types with bitmasks to choose from. */ public final class BitmaskAttrib extends DialogAttrib { public JTextArea text; // the display component for bitmask-contents @@ -1610,13 +1613,15 @@ } // class BitmaskAttrib - /** ActionListener for help-buttons */ + + /** ActionListener for help-buttons. */ private class HelpAL implements ActionListener { + /** CFArchAttrib which contains help information. */ CFArchAttrib attrib; // attribute structure /** - * construktor + * Constructor. * @param a the arch attribute where this help button belongs to */ public HelpAL(final CFArchAttrib a) { @@ -1635,6 +1640,7 @@ } // class HelpAL + /** ActionListener for the change buttons of bitmasks. */ public final class MaskChangeAL implements ActionListener { @@ -1663,6 +1669,7 @@ } // class MaskChangeAL + /** * ActionListener for the buttons on treasurelists. When such a button is * pressed, the dialog with treasurelists pops up. @@ -1694,6 +1701,7 @@ } // class ViewTreasurelistAL + /** * ActionListener for the buttons in the ConfirmErrors popup dialog and * also WindowListener for the closebox of the dialog (which would equal a @@ -1779,6 +1787,7 @@ } // class ConfirmErrorsAL + /** ItemListener for the type-selection box on the attribute-dialog. */ private class TypesBoxAL implements ItemListener { @@ -1862,6 +1871,7 @@ } // class TypesBoxAL + /** * KeySelectionManager to manage the select-per-keystroke in a JComboBox * (The default KeySelectionManager fails because all strings start with Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-10-01 08:36:39 UTC (rev 435) @@ -97,7 +97,7 @@ /** * Constructor. - * @param defaultArchType the head element of the list + * @param defaultArchType default archetype */ public CFArchType(final CFArchType defaultArchType) { next = null; Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-10-01 08:36:39 UTC (rev 435) @@ -211,7 +211,7 @@ /** * Parse a list vector from an xml list element. - * @param root + * @param root element to parse */ private Vector parseListFromElement(final Element root) { final Vector list = new Vector(); // list vector @@ -236,7 +236,6 @@ } } } - return list; } @@ -265,6 +264,10 @@ return spellNum; } + /** + * Return the bitmask table which contains all definitions of bitmask types for arch attributes. + * @return bitmask table + */ public Map<String, CAttribBitmask> getBitmaskTable() { return bitmaskTable; } @@ -273,6 +276,10 @@ return listTable; } + /** + * Return the ignore list table which contains all definitions of ignore lists for arch attributes. + * @return ignore list table + */ public Map<String, Vector<String>> getIgnoreListTable() { return ignoreListTable; } Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-10-01 08:36:39 UTC (rev 435) @@ -86,7 +86,7 @@ private Hashtable<String, TreasureTreeNode> specialTreasureLists = null; // all syntax-errors encountered during datafile-parsing get written in this log - private StringBuffer errorLog = null; + private final StringBuffer errorLog = new StringBuffer(); private Vector<TreasureTreeNode> needSecondLink; @@ -125,7 +125,6 @@ isEmpty = true; // three is empty hasBeenDisplayed = false; tListCount = 0; - errorLog = new StringBuffer(""); parentDialog = null; // draw thin blue lines connecting the nodes @@ -371,7 +370,7 @@ } } - final double corrector = 100. / sumChances; // corrector value + final double corrector = 100.0 / sumChances; // now apply the correcting factor to all chances for (Enumeration clist = listNode.children(); clist != null && clist.hasMoreElements();) { @@ -724,7 +723,6 @@ /** Construct tree node with specified content object */ public TreasureTreeNode(final TreasureObj content) { - super(); this.content = content; } @@ -734,7 +732,6 @@ * @param type type of content object (see TreasureObj constants) */ public TreasureTreeNode(final String name, final int type) { - super(); this.content = new TreasureObj(name, type); } @@ -1008,7 +1005,7 @@ } } else { // parent is not root - final TreasureTreeNode parent = (TreasureTreeNode) (node.getParent()); + final TreasureTreeNode parent = (TreasureTreeNode) node.getParent(); if (parent.getTreasureObj().getType() == TreasureObj.FOLDER) { setFont(bold); } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 08:36:39 UTC (rev 435) @@ -178,7 +178,7 @@ //private boolean isoMapViewDefault; private String imageSet; // Name of used Image Set (null = none) - private boolean loadFromarchive = true; // do we load arches from the collected archives? + private boolean loadFromArchive = true; // do we load arches from the collected archives? private boolean autoPopupDocu = false; // time for an automated docu popup? @@ -191,10 +191,10 @@ private final CopyBuffer copybuffer = new CopyBuffer(this); // head of linked list, containing the autojoin data - private AutojoinList joinlist = null; + private AutojoinList joinList = null; // the list of archtype-data (loaded from "types.txt") - private CFArchTypeList typelist = null; + private CFArchTypeList typeList = null; // pickmaps cannot be edited while lockedPickmaps is true private boolean pickmapsLocked = false; @@ -281,8 +281,8 @@ //loadTypeDef(); // load the list with archtype-data from "types.txt" - typelist = new CFArchTypeList(); - GameObject.setTypeList(typelist); // set reference in GameObject + typeList = new CFArchTypeList(); + GameObject.setTypeList(typeList); // set reference in GameObject // now collect all arch you can find in the arch path!! System.gc(); @@ -290,14 +290,14 @@ } /** - * Loading the joinlist from file and attaching all to 'joinlist'. + * Loading the joinList from file and attaching all to 'joinlist'. * (This method must not be called before all arches are loaded * into the ArchetypeSet 'archList'!) */ public void loadJoinlist() { - joinlist = new AutojoinList(); - if (!joinlist.loadList(archList)) { - joinlist = null; + joinList = new AutojoinList(); + if (!joinList.loadList(archList)) { + joinList = null; } } @@ -473,7 +473,7 @@ imageSet = null; } - loadFromarchive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(LOAD_ARCH_COLL, "true")).booleanValue(); + loadFromArchive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(LOAD_ARCH_COLL, "true")).booleanValue(); this.getMainView().setMapTileListBottom(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(CMainView.MAPTILE_BOTTOM_KEY, "false")).booleanValue()); @@ -531,7 +531,7 @@ } public boolean isArchLoadedFromCollection() { - return loadFromarchive; + return loadFromArchive; } public boolean isPickmapsLocked() { @@ -720,11 +720,9 @@ /** * Begins the editing of a new Map. - * @param objects the list of map objects, or <code>null</code> 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 + * @param initial the view position to show initially; null=show top left corner * @return map control of new map */ public MapControl newLevel(final List<GameObject> objects, final MapArchObject maparch, final Point initial) { @@ -733,13 +731,10 @@ /** * Begins the editing of a new Map. - * @param objects the list of map objects, or <code>null</code> 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 - * @param initial the view position to show initially; null=show top - * left corner + * @param show if true, map is added to main view. Set to false to load silently + * @param initial the view position to show initially; null=show top left corner * @return map control of new map */ public MapControl newLevel(final List<GameObject> objects, final MapArchObject maparch, final boolean show, final Point initial) { @@ -1014,11 +1009,11 @@ * @param arch attr. window is opened for this arch */ public void openAttrDialog(final GameObject arch) { - if (typelist.isEmpty()) { + if (typeList.isEmpty()) { // types.txt is missing! showMessage("File Missing", "The definitions-file \"types.txt\" is missing! The\nattribute interface doesn't work without that file."); } else if (arch != null && arch.getArchetypeName() != null) { - final CAttribDialog dwin = new CAttribDialog(typelist, arch, this); + final CAttribDialog dwin = new CAttribDialog(typeList, arch, this); } } @@ -1315,7 +1310,9 @@ System.exit(0); } - /** Try to load the map where the selected map-exit points to. */ + /** + * Try to load the map where the selected map-exit points to. + */ public void enterExitWanted() { final GameObject exit = currentMap.getMapModel().getExit(); if (exit == null) { @@ -1596,7 +1593,7 @@ return false; } - /** "Clear" was selected from the Edit menu */ + /** "Clear" was selected from the Edit menu. */ public void clearWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1605,7 +1602,7 @@ copybuffer.clear(currentMap); } - /** "Cut" was selected from the Edit menu */ + /** "Cut" was selected from the Edit menu. */ public void cutWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1614,7 +1611,7 @@ copybuffer.cut(currentMap); } - /** "Copy" was selected from the Edit menu */ + /** "Copy" was selected from the Edit menu. */ public void copyWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1623,7 +1620,7 @@ copybuffer.copy(currentMap); } - /** "Paste" was selected from the Edit menu */ + /** "Paste" was selected from the Edit menu. */ public void pasteWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1633,7 +1630,7 @@ } /** - * "Fill" was selected from the Edit menu + * "Fill" was selected from the Edit menu. * @param fillBelow true if "Fill Below" was activated, false if "Fill Above" */ public void fillWanted(final boolean fillBelow) { @@ -1644,7 +1641,7 @@ copybuffer.fill(currentMap, fillBelow); } - /** "Replace" was selected from the Edit menu */ + /** "Replace" was selected from the Edit menu. */ public void replaceWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1859,11 +1856,11 @@ } public CFArchTypeList getTypelist() { - return typelist; + return typeList; } public AutojoinList getJoinlist() { - return joinlist; + return joinList; } public CMapFileDecode getMapFileDecoder() { Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-10-01 08:36:39 UTC (rev 435) @@ -359,9 +359,9 @@ /** * Add inventory objects to an arch in the MapTileList recursively. - * @param node the arch where the inventory gets added - * @param archid object id of the highlighted arch (?) - * @param indent indentation; 1=minimal indentation + * @param node the arch where the inventory gets added + * @param archid object id of the highlighted arch (?) + * @param indent indentation; 1=minimal indentation */ private void addInvObjects(final GameObject node, final int archid, final int indent) { final String indentStr = Integer.toString(indent); Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-10-01 08:36:39 UTC (rev 435) @@ -260,8 +260,8 @@ /** update info which pickmap is currently on top */ private void updateActivePickmap() { - if (tabpane == null) { // for safety, shouldn't happen - return; + if (tabpane == null) { + return; // for safety, shouldn't happen } if (pickmaps.size() == 0) { @@ -294,8 +294,7 @@ * @todo this method's name is a Bad Thing */ public void addPickmapSelectionListener(final JTabbedPane pickpane) { - pickpane.addChangeListener(new PickmapSelectionListener( - pickpane)); + pickpane.addChangeListener(new PickmapSelectionListener(pickpane)); } /** Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-10-01 08:36:39 UTC (rev 435) @@ -122,7 +122,7 @@ * copyNCut implements clear, cut and copy in one function (since they are * so similar). * @param mapControl MapControl of the active map where we copy from - * @param mode defines if we have a cut, copy or paste action + * @param mode defines if we have a cut, copy or paste action */ private void CopyNCut(final MapControl mapControl, final int mode) { final Point startp = mapControl.getMapView().getHighlightStart(); // start of highlighted rect @@ -261,8 +261,8 @@ /** * Excecuting the Fill command. - * @param mapControl MapControl of the active map we paste on - * @param fillBelow if true, the filling content is placed *below* the + * @param mapControl MapControl of the active map we paste on + * @param fillBelow if true, the filling content is placed *below* the * existing map */ public void fill(final MapControl mapControl, final boolean fillBelow) { @@ -320,26 +320,26 @@ * <p/> * Okay, yes, this algorithm is as inefficient as it could be. But it is * short and easy. And CF maps are so small anyways. - * @param mapControl MapControl of the active map we paste on - * @param x starting x-coord for floodfill - * @param y starting y-coord for floodfill + * @param mapControl MapControl of the active map we paste on + * @param startX starting x-coord for floodfill + * @param startY starting y-coord for floodfill * @param arch GameObject to fill with */ - private void floodfill(final MapControl mapControl, final int x, final int y, final GameObject arch) { - addArchToMap(mapControl, arch, new Point(x, y), 0, false); + private void floodfill(final MapControl mapControl, final int startX, final int startY, final GameObject arch) { + addArchToMap(mapControl, arch, new Point(startX, startY), 0, false); // now go recursive into all four directions - if (mapControl.isPointValid(x - 1, y) && !mapControl.containsArchObject(x - 1, y)) { - floodfill(mapControl, x - 1, y, arch); + if (mapControl.isPointValid(startX - 1, startY) && !mapControl.containsArchObject(startX - 1, startY)) { + floodfill(mapControl, startX - 1, startY, arch); } - if (mapControl.isPointValid(x, y - 1) && !mapControl.containsArchObject(x, y - 1)) { - floodfill(mapControl, x, y - 1, arch); + if (mapControl.isPointValid(startX, startY - 1) && !mapControl.containsArchObject(startX, startY - 1)) { + floodfill(mapControl, startX, startY - 1, arch); } - if (mapControl.isPointValid(x + 1, y) && !mapControl.containsArchObject(x + 1, y)) { - floodfill(mapControl, x + 1, y, arch); + if (mapControl.isPointValid(startX + 1, startY) && !mapControl.containsArchObject(startX + 1, startY)) { + floodfill(mapControl, startX + 1, startY, arch); } - if (mapControl.isPointValid(x, y + 1) && !mapControl.containsArchObject(x, y + 1)) { - floodfill(mapControl, x, y + 1, arch); + if (mapControl.isPointValid(startX, startY + 1) && !mapControl.containsArchObject(startX, startY + 1)) { + floodfill(mapControl, startX, startY + 1, arch); } } Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-10-01 08:36:39 UTC (rev 435) @@ -331,12 +331,12 @@ * Check if a given archetype fits within map bounds. Multi tiles can't be * set if going out of borders. * @param archnanme the archetype to check - * @param xx the x-coordinate to place archname - * @param yy the y-coordinate to place archname + * @param xx the x-coordinate to place archName + * @param yy the y-coordinate to place archName * @param intern ??? */ - private boolean testArchToMap(final String archname, final int xx, final int yy, final int intern) { - for (GameObject part = getDefaultArch(archname); part != null; part = part.getMultiNext()) { + private boolean testArchToMap(final String archName, final int xx, final int yy, final int intern) { + for (GameObject part = getDefaultArch(archName); part != null; part = part.getMultiNext()) { final int mapx = xx + part.getMultiX(); final int mapy = yy + part.getMultiY(); if (!isPointValid(mapx, mapy)) { @@ -442,14 +442,14 @@ } } - @Deprecated public boolean addArchToMap(final String archname, final int xx, final int yy, final int intern, final boolean join, final boolean insertBelow) { - return addArchToMap(archname, new Point(xx, yy), intern, join, insertBelow); + @Deprecated public boolean addArchToMap(final String archName, final int xx, final int yy, final int intern, final boolean join, final boolean insertBelow) { + return addArchToMap(archName, new Point(xx, yy), intern, join, insertBelow); } /** * Add a new arch to the map. Including multi tile arches. This function - * allows only to choose from the default arches (->archname). - * @param archname Name of a default arch on the ArchetypeSet + * allows only to choose from the default arches (->archName). + * @param archName Name of a default arch on the ArchetypeSet * @param pos insert-location on this map * @param intern if NOT '-1': only one arch of the same kind can be * inserted per square @@ -459,19 +459,19 @@ * inserted below * @return true if insertion successful, false if not */ - public boolean addArchToMap(String archname, final Point pos, final int intern, final boolean join, final boolean insertBelow) { + public boolean addArchToMap(String archName, final Point pos, final int intern, final boolean join, final boolean insertBelow) { GameObject newarch, oldarch, startarch; // our new suckers (copys, not ref ptrs) - if (archname == null || !isPointValid(pos)) { + if (archName == null || !isPointValid(pos)) { // invalid parameter return false; } - if (!testArchToMap(archname, pos.x, pos.y, intern)) { + if (!testArchToMap(archName, pos.x, pos.y, intern)) { // does not fit on map return false; } - newarch = getDefaultArch(archname); // temp. store this arch + newarch = getDefaultArch(archName); // temp. store this arch if (newarch == null) { return false; } @@ -479,11 +479,11 @@ if (mainControl.getAutojoin() && join == JOIN_ENABLE && mainControl.getJoinlist() != null && newarch.getJoinList() != null && !newarch.isMulti()) { // do autojoining if enabled - archname = newarch.getJoinList().joinInsert(this, pos.x, pos.y); - if (archname == null) { + archName = newarch.getJoinList().joinInsert(this, pos.x, pos.y); + if (archName == null) { return false; // only one autojoin type per square allowed } - newarch = getDefaultArch(archname); + newarch = getDefaultArch(archName); } GameObject newHead = null; @@ -530,19 +530,19 @@ return true; } - @Deprecated public boolean insertArchToMap(final GameObject newarch, final String archname, final GameObject next, final int mapx, final int mapy, final boolean join) { - return insertArchToMap(newarch, archname, next, new Point(mapx, mapy), join); + @Deprecated public boolean insertArchToMap(final GameObject newarch, final String archName, final GameObject next, final int mapx, final int mapy, final boolean join) { + return insertArchToMap(newarch, archName, next, new Point(mapx, mapy), join); } /** * Insert a new arch to the map at a specified position. This function - * allows either to choose from the default arches (->archname) or to insert + * allows either to choose from the default arches (->archName) or to insert * a copy from an existing arch (->newarch). It also works for * container-inventory. * @param newarch A clone copy of this GameObject gets inserted to the map. * It can be an arch directly from a pickmap or even a * default arch. if ('newarch'==null) the default arch of - * number 'archname' gets inserted - * @param archname Name of a default arch to get inserted. This value gets + * number 'archName' gets inserted + * @param archName Name of a default arch to get inserted. This value gets * used ONLY when 'newarch' is null * @param next the new arch gets inserted before 'next' if * ('next'==null) the arch gets inserted at bottom @@ -551,7 +551,7 @@ * @param join if set to JOIN_ENABLE auto-joining is supported * @return true if insertion was successful */ - public boolean insertArchToMap(GameObject newarch, String archname, final GameObject next, final Point pos, final boolean join) { + public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos, final boolean join) { // map coords must be valid if (!mapControl.isPointValid(pos)) { return false; @@ -564,10 +564,10 @@ if (newarch == null || newarch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchetypeName(); + archName = newarch.getArchetypeName(); } - // insert a new instance of the default arch (number 'archname') - if (!mapControl.addArchToMap(archname, pos, -1, join)) { + // insert a new instance of the default arch (number 'archName') + if (!mapControl.addArchToMap(archName, pos, -1, join)) { return false; } } else { @@ -599,10 +599,10 @@ final GameObject invnew; // new arch to be inserted if (newarch == null || newarch.isArchetype()) { if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchetypeName(); + archName = newarch.getArchetypeName(); } // create a new copy of a default arch - invnew = getDefaultArch(archname).createArch(); + invnew = getDefaultArch(archName).createArch(); } else { // create clone from a pickmap if (!newarch.isMulti()) { @@ -1192,13 +1192,13 @@ /** * Get a default {@link GameObject} instance. * - * @param archname arch naem + * @param archName arch naem * * @return the default arch object instance corresponding to - * <code>archname</code>, or <code>null</code> if it does not exist + * <code>archName</code>, or <code>null</code> if it does not exist */ - private GameObject getDefaultArch(final String archname) { - return mainControl.getArchObjectStack().getArch(archname); + private GameObject getDefaultArch(final String archName) { + return mainControl.getArchObjectStack().getArch(archName); } } // class DefaultMapModel Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-01 08:36:39 UTC (rev 435) @@ -101,8 +101,7 @@ * Constructs a new Map. * @param mainControl the CMainControl * @param maparch the <code>MapArchObject</code> of the map - * @param objects list of Objects (ArchObjects) which should be filled - * in map or <code>null</code> for empty + * @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 */ Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 08:36:39 UTC (rev 435) @@ -1420,6 +1420,7 @@ } // class BitmaskAttrib + /** ActionListener for help-buttons. */ private final class HelpActionListener implements ActionListener { @@ -1516,6 +1517,7 @@ } // class ViewTreasurelistAL + /** * ActionListener for the buttons in the ConfirmErrors popup dialog and * also WindowListener for the closebox of the dialog (which would equal a @@ -1650,6 +1652,7 @@ } // class TypesBoxAL + /** * KeySelectionManager to manage the select-per-keystroke in a JComboBox * (The default KeySelectionManager fails because all strings start with Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-10-01 08:36:39 UTC (rev 435) @@ -93,7 +93,7 @@ /** * Constructor. - * @param defaultArchType default ArchType + * @param defaultArchType default archetype */ public CFArchType(final CFArchType defaultArchType) { typeName = ""; Modified: trunk/daimonin/src/daieditor/CFArchTypeList.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-10-01 08:36:39 UTC (rev 435) @@ -292,7 +292,7 @@ } /** - * Returns the bitmask table which contains all definitions of bitmask types for arch attributes. + * Return the bitmask table which contains all definitions of bitmask types for arch attributes. * @return bitmask table */ public Map<String, CAttribBitmask> getBitmaskTable() { @@ -304,7 +304,7 @@ } /** - * Returns the ignore list table which contains all definitions of ignore lists for arch attributes. + * Return the ignore list table which contains all definitions of ignore lists for arch attributes. * @return ignore list table */ public Map<String, List<String>> getIgnoreListTable() { Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-10-01 08:36:39 UTC (rev 435) @@ -98,7 +98,7 @@ private Map<String, TreasureTreeNode> specialTreasureLists; // all syntax-errors encountered during datafile-parsing get written in this log - private StringBuffer errorLog; + private final StringBuffer errorLog = new StringBuffer(); private List<TreasureTreeNode> needSecondLink; @@ -131,7 +131,6 @@ super(root); hasBeenDisplayed = false; tListCount = 0; - errorLog = new StringBuffer(); parentDialog = null; putClientProperty("JTree.lineStyle", "Angled"); @@ -193,9 +192,9 @@ @Nullable public static CAttribDialog getParentDialog() { if (instance != null && instance.frame != null && instance.frame.isShowing()) { return instance.parentDialog; - } else { - return null; } + + return null; } /** Hide the Treasurelists window, if not already hidden. */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-01 08:36:39 UTC (rev 435) @@ -1311,9 +1311,11 @@ archObjectParser.expandMulti(arch, tailList); } + for (final GameObject tail : tailList) { objects.add(tail); } + if (noarchcount > 0) { ACTION_FACTORY.showMessageDialog(mainView, "collectTemplistAutodelete", file.getName(), noarchcount, noarch); } @@ -1360,6 +1362,7 @@ log.log(Level.WARNING, "saveLevelAsWithNull"); return false; } + final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Save Map Or Script As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); @@ -1821,7 +1824,7 @@ return false; } - /** "Clear" was selected from the Edit menu */ + /** "Clear" was selected from the Edit menu. */ public void clear() { if (currentMap == null || currentMap.getMapViewFrame() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1830,7 +1833,7 @@ copybuffer.clear(currentMap); } - /** "Cut" was selected from the Edit menu */ + /** "Cut" was selected from the Edit menu. */ public void cut() { if (currentMap == null || currentMap.getMapViewFrame() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1868,7 +1871,7 @@ } /** - * "Fill" was selected from the Edit menu + * "Fill" was selected from the Edit menu. * @param fillBelow true if "Fill Below" was activated, false if "Fill Above" */ private void fillWanted(final boolean fillBelow) { Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-10-01 08:36:39 UTC (rev 435) @@ -56,7 +56,7 @@ private boolean loadComplete; // true when all pickmaps have been loaded (at least one) - private JTabbedPane tabpane; // tab pane with pickmaps + private JTabbedPane tabpane = null; // tab pane with pickmaps /** All open pickmaps (the map controllers get stored in the vector). */ private final List<MapControl> pickmaps = new ArrayList<MapControl>(); @@ -289,10 +289,12 @@ if (tabpane == null) { return; // for safety, shouldn't happen } + if (pickmaps.size() == 0) { currentPickMap = null; return; } + boolean foundMap = false; final String newName = File.separator + tabpane.getTitleAt(tabpane.getSelectedIndex()); @@ -364,7 +366,7 @@ */ private static final class ArchNPickChangeListener implements ChangeListener { - private final CMainView mainview; // main view + private final CMainView mainView; // main view private final JTabbedPane tabpane; // parent pane for archlist & pickmaps @@ -376,7 +378,7 @@ * @param pane the JTabbedPane containing both archlist and pickmaps */ public ArchNPickChangeListener(final CMainView mainView, final JTabbedPane pane) { - mainview = mainView; + this.mainView = mainView; tabpane = pane; selectedIndex = tabpane.getSelectedIndex(); } @@ -385,9 +387,9 @@ if (tabpane.getSelectedIndex() != selectedIndex) { // the state has changed, user has switched panels if (tabpane.getSelectedIndex() == 0) { - mainview.setPickmapActive(false); + mainView.setPickmapActive(false); } else { - mainview.setPickmapActive(true); + mainView.setPickmapActive(true); } selectedIndex = tabpane.getSelectedIndex(); // save new state Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-10-01 08:36:39 UTC (rev 435) @@ -235,7 +235,7 @@ /** * Excecuting the Fill command. * @param mapControl MapControl of the active map we paste on - * @param fillBelow if true, the filling content is placed *below* the + * @param fillBelow if true, the filling content is placed *below* the * existing map */ public void fill(final MapControl mapControl, final boolean fillBelow, final MapControl seed, final int rand) { @@ -373,7 +373,7 @@ private static final byte BLOCKED = (byte) 3; /** - * Floodfill the map, starting at the highlighted square + * Floodfill the map, starting at the highlighted square. * @param mapControl MapControl of the active map we paste on * @param startX starting x-coord for floodfill * @param startY starting y-coord for floodfill Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-10-01 08:36:39 UTC (rev 435) @@ -156,7 +156,7 @@ } line1.add(replaceEntireBox); line1.add(Box.createVerticalStrut(3)); - rfHeading = new JLabel('\"' + mapControl.getMapFileName() + "\":"); + rfHeading = new JLabel("\"" + mapControl.getMapFileName() + "\":"); line1.add(rfHeading); mainPanel.add(line1); @@ -197,7 +197,7 @@ if (replaceArch != null) { colonLabel = new JLabel(":"); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(replaceArch.getFaceObjName())); - rfArchName = new JLabel(' ' + replaceArch.getBestName()); + rfArchName = new JLabel(" " + replaceArch.getBestName()); } else { colonLabel = new JLabel(""); rfArchName = new JLabel(""); @@ -220,7 +220,7 @@ isBuilt = true; } else { // just set fields and show - rfHeading.setText('\"' + mapControl.getMapFileName() + "\":"); + rfHeading.setText("\"" + mapControl.getMapFileName() + "\":"); replaceInput1.setText(""); this.mapControl = mapControl; @@ -232,7 +232,7 @@ } else { replaceWithBox.setSelectedIndex(0); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(replaceArch.getFaceObjName())); - rfArchName.setText(' ' + replaceArch.getBestName()); + rfArchName.setText(" " + replaceArch.getBestName()); colonLabel.setText(":"); } final MapViewIFrame mapViewIFrame = mapControl.getMapViewFrame(); @@ -262,7 +262,7 @@ final Icon oldIcon = iconLabel.getIcon(); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(newArch.getFaceObjName())); - rfArchName.setText(' ' + newArch.getBestName()); + rfArchName.setText(" " + newArch.getBestName()); colonLabel.setText(":"); // pack frame only if height of icon changed Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-10-01 08:36:39 UTC (rev 435) @@ -217,8 +217,8 @@ } /** {@inheritDoc} */ - public boolean isMultiArchFittingToMap(final String archname, final Point pos, final boolean allowDouble) { - final GameObject head = getDefaultArch(archname); + public boolean isMultiArchFittingToMap(final String archName, final Point pos, final boolean allowDouble) { + final GameObject head = getDefaultArch(archName); final Point mapH = new Point(head.getMultiX(), head.getMultiY()); mapH.translate(pos.x, pos.y); if (!isPointValid(mapH)) { @@ -244,15 +244,15 @@ } /** {@inheritDoc} */ - public boolean addArchToMap(final String archname, final Point pos, final boolean allowDouble, final boolean insertBelow) { - if (archname == null || archname.length() == 0 || pos.x == -1 || pos.y == -1 || pos.x >= mapSize.getWidth() || pos.y >= mapSize.getHeight()) { + public boolean addArchToMap(final String archName, final Point pos, final boolean allowDouble, final boolean insertBelow) { + if (archName == null || archName.length() == 0 || pos.x == -1 || pos.y == -1 || pos.x >= mapSize.getWidth() || pos.y >= mapSize.getHeight()) { return false; } - if (!isMultiArchFittingToMap(archname, pos, allowDouble)) { + if (!isMultiArchFittingToMap(archName, pos, allowDouble)) { return false; } - final GameObject defaultArch = getDefaultArch(archname); + final GameObject defaultArch = getDefaultArch(archName); // FIXME: Check maximum RefX and RefY to check whether the multitile arch fits on the map. if (pos.x + defaultArch.getMinX() < 0 || pos.y + defaultArch.getMinY() < 0 || pos.x + defaultArch.getMaxX() > mapSize.getWidth() || pos.y + defaultArch.getMaxY() > mapSize.getHeight()) { @@ -295,7 +295,7 @@ * {@inheritDoc} * @xxx I'm too complex */ - public boolean insertArchToMap(GameObject newarch, String archname, final GameObject next, final Point pos) { + public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos) { // map coords must be valid if (!isPointValid(pos)) { return false; @@ -307,10 +307,10 @@ if (newarch == null || newarch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchetypeName(); + archName = newarch.getArchetypeName(); } - // insert a new instance of the default arch (number 'archname') - if (!addArchToMap(archname, pos, true, false)) { + // insert a new instance of the default arch (number 'archName') + if (!addArchToMap(archName, pos, true, false)) { return false; } } else { @@ -340,10 +340,10 @@ final GameObject invnew; // new arch to be inserted if (newarch == null || newarch.isArchetype()) { if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchetypeName(); + archName = newarch.getArchetypeName(); } // create a new copy of a default arch - invnew = getDefaultArch(archname).createArch(); + invnew = getDefaultArch(archName).createArch(); } else { // create clone from a pickmap if (!newarch.isMulti()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 16:44:18
|
Revision: 437 http://svn.sourceforge.net/gridarta/?rev=437&view=rev Author: christianhujer Date: 2006-10-01 09:44:08 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Some Unification of CAttribDialog. Changed symbol names to new naming convention (defarch -> archetype, arch -> gameObject). Reworked some comments. Fixed some bogus parameter names (event -> e) to match name in original method description. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 16:03:13 UTC (rev 436) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 16:44:08 UTC (rev 437) @@ -114,15 +114,15 @@ private JComboBox typesel; // selection box for type - private JTextField nameTF; // textfield for arch name + private JTextField nameTF; // textfield for gameObject name - private JTextField defarchTF; // textfield for name of default arch + private JTextField defarchTF; // textfield for name of default gameObject private JLabel imagePanel; // panel for object's face (png) - private final GameObject arch; + private final GameObject gameObject; - private final GameObject defarch; + private final GameObject archetype; private CFArchType type; // reference to the type data @@ -154,11 +154,10 @@ * Constructor: Creates the GUI layout and * draws the dialog window. * @param atList the list of CF type-data - * @param aobj the GameObject to be displayed by this dialog - * @param defaobj the default GameObject of 'arch' + * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - CAttribDialog(final CFArchTypeList atList, final GameObject aobj, final CMainControl mainControl) { + CAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { super(mainControl.getMainView(), "CF Attribute Dialog", false); // when close-box is selected, execute the 'closeDialog' method and nothing else @@ -178,12 +177,12 @@ CAttribDialog.setDefaultBounds(); // set width/height etc // reference to the GameObject - arch = aobj.getHead(); - defarch = arch.getArchetype(); + this.gameObject = gameObject.getHead(); + archetype = this.gameObject.getArchetype(); /* set frame icon - if (arch.getFaceNr() >= 0) { - setIconImage(mainControl.getArchObjectStack().getFace(arch.getFaceNr()).getImage()); + if (gameObject.getFaceNr() >= 0) { + setIconImage(mainControl.getArchObjectStack().getFace(gameObject.getFaceNr()).getImage()); } */ // check if the type of the object is present in the definitions @@ -192,13 +191,13 @@ type = tmp; boolean typeFound = false; for (int i = 0; tmp != null && !typeFound; tmp = tmp.getNext(), i++) { - if (tmp.getTypeNr() == arch.getArchTypNr()) { + if (tmp.getTypeNr() == this.gameObject.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers typeFound = true; } else { // check if all the type-attributes match - final int argsNum = (int) (tmp.getTypeAttr().length / 2.); + final int argsNum = (int) (tmp.getTypeAttr().length / 2.0); boolean match = true; String archvalue; @@ -207,7 +206,7 @@ } for (int t = 0; t < argsNum * 2; t += 2) { - archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], defarch); + archvalue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], archetype); if (log.isDebugEnabled()) { log.debug(" arch: '" + archvalue + "', type: '" + tmp.getTypeAttr()[t + 1] + "'"); @@ -356,7 +355,7 @@ typesel.setName("Types"); // the listener: - typesel.addItemListener(new TypesBoxAL(this, arch, defarch)); + typesel.addItemListener(new TypesBoxAL(this, gameObject, archetype)); lineLayout.add(typesel); return lineLayout; @@ -369,8 +368,8 @@ */ private JComboBox buildSpellBox(final CFArchAttrib attr) { - // first parse the spell-number value from arch - int spnum = arch.getAttributeInt(attr.getNameOld(), defarch); // spell number + // first parse the spell-number value from gameObject + int spnum = gameObject.getAttributeInt(attr.getNameOld(), archetype); // spell number if (spnum < 0 || spnum >= typelist.getSpellNum().length - 1) { spnum = 0; // undefined spellnumbers be zero @@ -378,7 +377,7 @@ // do we have "none" spell? int active; - if (spnum == 0 && (arch.getAttributeString(attr.getNameOld(), defarch).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { + if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld(), archetype).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells @@ -413,7 +412,7 @@ // build the array of list-items final String []array = new String[(int) (listData.size() / 2.)]; boolean hasSelection = false; - int active = arch.getAttributeInt(attr.getNameOld(), defarch); + int active = gameObject.getAttributeInt(attr.getNameOld(), archetype); for (int i = 0; i < array.length; i++) { array[i] = (String) listData.elementAt(i * 2 + 1); // put string to array @@ -448,7 +447,7 @@ */ private void buildBitmask(final CFArchAttrib attr, final BitmaskAttrib guiAttr, final CAttribBitmask bitmask, final JPanel mainPanel) { // initialize bitmask value - guiAttr.setValue(arch.getAttributeInt(attr.getNameOld(), defarch)); + guiAttr.setValue(gameObject.getAttributeInt(attr.getNameOld(), archetype)); guiAttr.bitmask = bitmask; // add button @@ -465,7 +464,7 @@ /** * Construct the upper left part of the attribute dialog, - * containing name, type, defarch name and face. + * containing name, type, archetype name and face. * @return a <code>JScrollPane</code> with the upper left part of the dialog window */ private JScrollPane buildHeader() { @@ -473,7 +472,7 @@ final JPanel layout1 = new JPanel(new BorderLayout()); // face, name & type - imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(arch.getFaceNr())); + imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(gameObject.getFaceNr())); imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); layout1.add(imagePanel, BorderLayout.WEST); @@ -482,12 +481,12 @@ final JPanel layout3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); layout3.add(new JLabel("Name: ")); // create label - if (arch.getObjName() != null && arch.getObjName().length() > 0) { - nameTF = new JTextField(arch.getObjName(), 16); - } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - nameTF = new JTextField(defarch.getObjName(), 16); + if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { + nameTF = new JTextField(gameObject.getObjName(), 16); + } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { + nameTF = new JTextField(archetype.getObjName(), 16); } else { - nameTF = new JTextField(defarch.getArchetypeName(), 16); + nameTF = new JTextField(archetype.getArchetypeName(), 16); } nameTF.setEditable(false); layout3.add(nameTF); @@ -502,8 +501,8 @@ header.add(layout1); final JPanel layout4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - layout4.add(new JLabel("Default Arch: ")); // create label - defarchTF = new JTextField(defarch.getArchetypeName(), 16); + layout4.add(new JLabel("Archetype: ")); // create label + defarchTF = new JTextField(archetype.getArchetypeName(), 16); defarchTF.setEditable(false); layout4.add(defarchTF); @@ -542,7 +541,7 @@ /** * Construct the central part of the attribute dialog, containing the - * object's arch attributes. + * object's gameObject attributes. * @return When this method is called the first time: a <code>JScrollPane</code> * with the central part of the dialog window. * All further calls rebuild the existing tabbedpane and return null. @@ -638,11 +637,11 @@ // note that the textarea is initialized with rows/columns: 1, 1 // this is pretty weird, but seems the only way to achieve desired behaviour if (type.getAttr()[i].getNameOld().equalsIgnoreCase("msg")) { - if (defarch.getMsgText() != null && defarch.getMsgText().length() > 0 - && (arch.getMsgText() == null || arch.getMsgText().trim().length() == 0)) { - input = new JTextArea(defarch.getMsgText(), 1, 1); + if (archetype.getMsgText() != null && archetype.getMsgText().length() > 0 + && (gameObject.getMsgText() == null || gameObject.getMsgText().trim().length() == 0)) { + input = new JTextArea(archetype.getMsgText(), 1, 1); } else { - input = new JTextArea(arch.getMsgText(), 1, 1); + input = new JTextArea(gameObject.getMsgText(), 1, 1); } } else { input = new JTextArea(1, 1); @@ -678,16 +677,16 @@ final JCheckBox input; if (dType == CFArchAttrib.T_BOOL) { // normal bool - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeInt(type.getAttr()[i].getNameOld(), defarch) == 1)); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeInt(type.getAttr()[i].getNameOld(), archetype) == 1)); } else { // parse values for customized bool final String trueVal = type.getAttr()[i].getMisc()[0]; if (trueVal.equals("0")) { - final String attrString = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); + final String attrString = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (attrString.length() == 0 || attrString.equals("0"))); } else { - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch).equals(trueVal))); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype).equals(trueVal))); } } @@ -717,9 +716,9 @@ newAttr.ref = type.getAttr()[i]; final JTextField input; - // parse value from arch + // parse value from gameObject final int fieldLength = (type.getAttr()[i].getInputLength() == 0 ? textFieldColumns : type.getAttr()[i].getInputLength()); - final int attrval = arch.getAttributeInt(type.getAttr()[i].getNameOld(), defarch); + final int attrval = gameObject.getAttributeInt(type.getAttr()[i].getNameOld(), archetype); if (attrval != 0) { input = new JTextField(String.valueOf(attrval), fieldLength); } else { @@ -762,24 +761,24 @@ newAttr.ref = type.getAttr()[i]; final JTextField input; - // parse String from arch + // parse String from gameObject final String dtxt; if (type.getAttr()[i].getNameOld().equalsIgnoreCase("name")) { - if (arch.getObjName() != null && arch.getObjName().length() > 0) { - dtxt = arch.getObjName(); - } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - dtxt = defarch.getObjName(); + if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { + dtxt = gameObject.getObjName(); + } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { + dtxt = archetype.getObjName(); } else { - dtxt = defarch.getArchetypeName(); + dtxt = archetype.getArchetypeName(); } } else if (type.getAttr()[i].getNameOld().equalsIgnoreCase("face")) { - if (arch.getFaceName() != null && arch.getFaceName().length() > 0) { - dtxt = arch.getFaceName(); + if (gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0) { + dtxt = gameObject.getFaceName(); } else { - dtxt = defarch.getFaceName(); + dtxt = archetype.getFaceName(); } } else { - dtxt = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); + dtxt = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); } input = new JTextField(dtxt, textFieldColumns); @@ -896,7 +895,7 @@ // textfield (no direct input, text is set by the treasurelist dialog) final JTextField input; - String treasureName = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); + String treasureName = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; } @@ -1178,9 +1177,9 @@ * @return true if the settings were applied, false if error occurred */ private boolean applySettings() { - final String oldArchText = arch.getObjectText(); // the old ArchText - final String oldMsg = arch.getMsgText(); // old arch msg - final CFArchType typeStruct = typelist.getTypeOfArch(arch); // the type structure for this arch + final String oldArchText = gameObject.getObjectText(); // the old ArchText + final String oldMsg = gameObject.getMsgText(); // old gameObject msg + final CFArchType typeStruct = typelist.getTypeOfArch(gameObject); // the type structure for this gameObject try { String newArchText = ""; @@ -1193,7 +1192,7 @@ if (dType == CFArchAttrib.T_BOOL) { // a boolean attribute (flag) if (((BoolAttrib) attr).input.isSelected() != - (defarch.getAttributeInt(attr.ref.getNameOld(), null) == 1)) { + (archetype.getAttributeInt(attr.ref.getNameOld(), null) == 1)) { newArchText = newArchText + attr.ref.getNameOld() + " " + (((BoolAttrib) attr).input.isSelected() ? 1 : 0) + "\n"; } @@ -1206,31 +1205,31 @@ valString = attr.ref.getMisc()[1]; // false string } // now see if we need to write it into the archtext or not - if ((valString.equals("0") && !(defarch.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) || (!valString.equals("0") && !defarch.getAttributeString(attr.ref.getNameOld(), null).equals(valString))) { + if ((valString.equals("0") && !(archetype.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) || (!valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld(), null).equals(valString))) { newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } else if (dType == CFArchAttrib.T_INT || dType == CFArchAttrib.T_FLOAT) { // an int attribute if (dType == CFArchAttrib.T_INT && ((IntAttrib) attr).input.getText().trim().length() == 0) { - if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != 0) { + if (archetype.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) { - if (defarch.getAttributeString(attr.ref.getNameOld(), null).length() > 0) { + if (archetype.getAttributeString(attr.ref.getNameOld(), null).length() > 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0.0\n"; } } else { try { if (dType == CFArchAttrib.T_INT) { final int value = Integer.parseInt(((IntAttrib) attr).input.getText().trim()); - if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != value) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else { // try to parse floating point final double value = Double.parseDouble(((FloatAttrib) attr).input.getText().trim()); - final String defValueStr = defarch.getAttributeString(attr.ref.getNameOld(), null).trim(); + final String defValueStr = archetype.getAttributeString(attr.ref.getNameOld(), null).trim(); final double defValue; if (defValueStr.length() > 0) { defValue = Double.parseDouble(defValueStr); @@ -1256,27 +1255,27 @@ if (inline != null) { if (attr.ref.getNameOld().equalsIgnoreCase("name")) { // special case #1: "name"-textfield - if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - if (!inline.equals(defarch.getObjName())) { + if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { + if (!inline.equals(archetype.getObjName())) { newName = inline; } else { newName = ""; } - } else if (!inline.equals(defarch.getArchetypeName())) { + } else if (!inline.equals(archetype.getArchetypeName())) { newName = inline; } else { newName = ""; } } else if (attr.ref.getNameOld().equalsIgnoreCase("face")) { // special case #2: "face"-textfield - if (defarch.getFaceName() != null && defarch.getFaceName().length() > 0 && - !inline.equals(defarch.getFaceName())) { + if (archetype.getFaceName() != null && archetype.getFaceName().length() > 0 && + !inline.equals(archetype.getFaceName())) { newFace = inline; } else { newFace = ""; } } else { - if (!inline.equals(defarch.getAttributeString(attr.ref.getNameOld(), null))) { + if (!inline.equals(archetype.getAttributeString(attr.ref.getNameOld(), null))) { newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } @@ -1289,7 +1288,7 @@ } } else if (dType == CFArchAttrib.T_SPELL || dType == CFArchAttrib.T_ZSPELL || dType == CFArchAttrib.T_LIST) { - // get attribute value that should go into the arch + // get attribute value that should go into the gameObject final int attrVal; // attribute value if (dType == CFArchAttrib.T_SPELL || dType == CFArchAttrib.T_ZSPELL) { attrVal = typelist.getSpellNum()[((ListAttrib) attr).input.getSelectedIndex()]; @@ -1302,19 +1301,19 @@ if (attrVal == -1 || (attrVal == 0 && dType != CFArchAttrib.T_SPELL && dType != CFArchAttrib.T_ZSPELL)) { - if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != 0) { + if (archetype.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.getAttributeInt(attr.ref.getNameOld(), null) != attrVal) { + } else if (archetype.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.getAttributeInt(attr.ref.getNameOld(), null) != value) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else if (dType == CFArchAttrib.T_TREASURE) { @@ -1325,17 +1324,17 @@ final boolean isNone = inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0; if (!isNone && !CFTreasureListTree.getInstance().containsTreasureList(inline) && - !inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), null))) { + !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), null))) { // The user has specified a WRONG treasurelist name, and it does not come - // from the default arch. -> Error and out. + // from the default gameObject. -> Error and out. JOptionPane.showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "'" + inline + "' is not a known treasurelist name!", "Input Error", JOptionPane.ERROR_MESSAGE); throw new GridderException(""); // bail out } - if (!inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), null)) - && !(isNone && defarch.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) { + if (!inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), null)) + && !(isNone && archetype.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) { if (isNone) { newArchText = newArchText + attr.ref.getNameOld() + " none\n"; } else { @@ -1349,13 +1348,13 @@ // Also write all the 'fixed' attributes into the archtext for (int i = 0; type.getAttr().length > i; i++) { if (type.getAttr()[i].getDataType() == CFArchAttrib.T_FIXED) { - final String defaultValue = defarch.getAttributeString(type.getAttr()[i].getNameOld(), null); - if (defaultValue.length() == 0 || (arch.getArchTypNr() != defarch.getArchTypNr() && + final String defaultValue = archetype.getAttributeString(type.getAttr()[i].getNameOld(), null); + if (defaultValue.length() == 0 || (gameObject.getArchTypNr() != archetype.getArchTypNr() && !defaultValue.equalsIgnoreCase(type.getAttr()[i].getNameNew()))) { - // usually, fixed attributes are only applied when *not* defined in the defarch. - // the reason behind this is: if the default arch violates our fixed attribute, - // we assume the default arch is "right" and we are "wrong". The typedefs aren't that trustworthy. - // BUT - if the arch has a changed type, the defarch has lost it's credibility. + // usually, fixed attributes are only applied when *not* defined in the archetype. + // the reason behind this is: if the default gameObject violates our fixed attribute, + // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. + // BUT - if the gameObject has a changed type, the archetype has lost it's credibility. // So, in this special case, the fixed attribute applies always. newArchText = newArchText + type.getAttr()[i].getNameOld() + " " + type.getAttr()[i].getNameNew() + "\n"; @@ -1365,61 +1364,60 @@ // before we modify the archtext, we look for errors and save them. // later the user must confirm whether to keep or dump those errors - String errors = null; - errors = arch.getSyntaxErrors(typeStruct); + final String errors = gameObject.getSyntaxErrors(typeStruct); - // --- parsing succeeded, now we write it into the arch/map --- - arch.setObjectText(newArchText); - //arch.setArchTypNr(); + // --- parsing succeeded, now we write it into the gameObject/map --- + gameObject.setObjectText(newArchText); + //gameObject.setArchTypNr(); if (newName != null) { if (newName.length() == 0) { - arch.setObjName(null); + gameObject.setObjName(null); } else { - arch.setObjName(newName); + gameObject.setObjName(newName); } } if (newFace != null) { boolean faceChanged = false; // check if face changed - if ((arch.getFaceName() != null && arch.getFaceName().length() > 0 && !newFace.equals(arch.getFaceName())) || (newFace.length() > 0 && (arch.getFaceName() == null || arch.getFaceName().length() == 0))) { + if ((gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0 && !newFace.equals(gameObject.getFaceName())) || (newFace.length() > 0 && (gameObject.getFaceName() == null || gameObject.getFaceName().length() == 0))) { faceChanged = true; } if (newFace.length() == 0) { - arch.setFaceName(null); + gameObject.setFaceName(null); } else { - arch.setFaceName(newFace); + gameObject.setFaceName(newFace); } // now, if neccessary, set new face if (faceChanged) { - if (arch.getFaceName() != null) { + if (gameObject.getFaceName() != null) { // we have a non-default face - final int index = ArchetypeSet.getFaceIndex(arch.getFaceName()); - arch.setFaceNr(index); + final int index = ArchetypeSet.getFaceIndex(gameObject.getFaceName()); + gameObject.setFaceNr(index); } else { // we have the default face - final int index = ArchetypeSet.getFaceIndex(defarch.getFaceName()); - arch.setFaceNr(index); + final int index = ArchetypeSet.getFaceIndex(archetype.getFaceName()); + gameObject.setFaceNr(index); } mainControl.getCurrentMap().repaint(); // repaint map } } if (newMsg != null) { - // set new msg text only when it is not equal to default arch - if (!newMsg.trim().equals(defarch.getMsgText() == null ? "" : defarch.getMsgText().trim())) { - arch.deleteMsgText(); - arch.addMsgText(newMsg); + // set new msg text only when it is not equal to default gameObject + if (!newMsg.trim().equals(archetype.getMsgText() == null ? "" : archetype.getMsgText().trim())) { + gameObject.deleteMsgText(); + gameObject.addMsgText(newMsg); } else { - arch.deleteMsgText(); + gameObject.deleteMsgText(); } - } else if (defarch.getMsgText() != null && defarch.getMsgText().trim().length() > 0) { - // we must override defarch msg by an empty msg - arch.deleteMsgText(); - arch.addMsgText(""); + } else if (archetype.getMsgText() != null && archetype.getMsgText().trim().length() > 0) { + // we must override archetype msg by an empty msg + gameObject.deleteMsgText(); + gameObject.addMsgText(""); } else { - arch.deleteMsgText(); // all empty + gameObject.deleteMsgText(); // all empty } // deal with syntax errors now @@ -1427,7 +1425,7 @@ if (typeStruct == typelist.getHead().getNext()) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types - arch.addArchText(errors.trim() + "\n"); + gameObject.addArchText(errors.trim() + "\n"); } else { // open a popup dialog and ask user to decide what to do with his errors askConfirmErrors(errors); @@ -1435,15 +1433,15 @@ } // if the archtext changed, set the map changed flag - if ((oldArchText != null && !oldArchText.equals(arch.getObjectText())) || - (oldArchText == null && arch.getObjectText() != null) || - (oldMsg != null && !oldMsg.equals(arch.getMsgText())) || - (oldMsg == null && arch.getMsgText() != null)) { + if ((oldArchText != null && !oldArchText.equals(gameObject.getObjectText())) || + (oldArchText == null && gameObject.getObjectText() != null) || + (oldMsg != null && !oldMsg.equals(gameObject.getMsgText())) || + (oldMsg == null && gameObject.getMsgText() != null)) { mainControl.getCurrentMap().setLevelChangedFlag(); } // recalculate the editType value - arch.calculateEditType(mainControl.getCurrentMap().getActiveEditType()); + gameObject.calculateEditType(mainControl.getCurrentMap().getActiveEditType()); mainControl.getMainView().refreshMapArchPanel(); return true; // apply succeeded @@ -1496,7 +1494,7 @@ buttonPanel.add(keepButton); // attach actionlistener to the buttons (and the frame) - final ConfirmErrorsAL listener = new ConfirmErrorsAL(frame, arch, errors, keepButton, textarea); + final ConfirmErrorsAL listener = new ConfirmErrorsAL(frame, gameObject, errors, keepButton, textarea); keepButton.addActionListener(listener); dumpButton.addActionListener(listener); frame.addWindowListener(listener); @@ -1517,7 +1515,7 @@ frame.setVisible(true); } - /** close this dialog frame */ + /** Close this dialog frame. */ private void closeDialog() { // if a treasurelist window is attached to this dialog, hide it if (CFTreasureListTree.getParentDialog() == this) { @@ -1530,14 +1528,14 @@ } - /** This (Sub)Class contains the data of one arch attribute. */ - public class DialogAttrib { + /** A single Attribute, combining the CFArchAttrib with its input component(s). */ + private static class DialogAttrib { - public CFArchAttrib ref; // reference to the attribute data + CFArchAttrib ref; // reference to the attribute data - public DialogAttrib next; // next element in the list + DialogAttrib next; // next element in the list - public JButton helpButton; // help button + JButton helpButton; // help button /** Constructor */ DialogAttrib() { @@ -1550,56 +1548,56 @@ /** This (Sub)Class implements the dialog attribute of type BOOL. */ - public final class BoolAttrib extends DialogAttrib { + private static final class BoolAttrib extends DialogAttrib { - public JCheckBox input; // the input means of bool is a checkbox - } + JCheckBox input; // the input means of bool is a checkbox + } // class BoolAttrib /** This (Sub)Class implements the dialog attribute of type INT. */ - public final class IntAttrib extends DialogAttrib { + private static final class IntAttrib extends DialogAttrib { - public JTextField input; // the input means of int is a textfield - } + JTextField input; // the input means of int is a textfield + } // class IntAttrib /** This (Sub)Class implements the dialog attribute of type FLOAT. */ - public final class FloatAttrib extends DialogAttrib { + private static final class FloatAttrib extends DialogAttrib { - public JTextField input; // the input means of int is a textfield - } + JTextField input; // the input means of int is a textfield + } // class FloatAttrib /** This (Sub)Class implements the dialog attribute of type STRING. */ - public final class StringAttrib extends DialogAttrib { + private static final class StringAttrib extends DialogAttrib { - public JTextField input; // the input means of string is a textfield - } + JTextField input; // the input means of string is a textfield + } // class StringAttrib /** This (Sub)Class implements the dialog attribute of type TEXT. */ - public final class TextAttrib extends DialogAttrib { + private static final class TextAttrib extends DialogAttrib { - public JTextArea input; // the input means of text is a textarea - } + JTextArea input; // the input means of text is a textarea + } // class TextAttrib /** * This (Sub)Class implements the dialog attribute of types with * selection lists (ComboBoxes) to choose from. */ - public final class ListAttrib extends DialogAttrib { + private static final class ListAttrib extends DialogAttrib { - public JComboBox input; // the input means of spell is a combo box + JComboBox input; // the input means of spell is a combo box } /** DialogAttrib for types with bitmasks to choose from. */ - public final class BitmaskAttrib extends DialogAttrib { + static final class BitmaskAttrib extends DialogAttrib { - public JTextArea text; // the display component for bitmask-contents + JTextArea text; // the display component for bitmask-contents - public int value; // the active bitmask value + int value; // the active bitmask value private CAttribBitmask bitmask; // reference to the bitmask data @@ -1622,17 +1620,14 @@ /** * Constructor. - * @param a the arch attribute where this help button belongs to + * @param a the gameObject attribute where this help button belongs to */ public HelpAL(final CFArchAttrib a) { attrib = a; } - /** - * help button was pressed - * @param event the occured <code>ActionEvent</code> (button pressed) - */ - public void actionPerformed(final ActionEvent event) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { if (attrib != null) { popupHelp(attrib.getNameNew(), attrib.getText()); } @@ -1657,11 +1652,8 @@ dialog = newDialog; } - /** - * help button was pressed - * @param event the occured <code>ActionEvent</code> (button pressed) - */ - public void actionPerformed(final ActionEvent event) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { if (bmAttr != null) { bmAttr.bitmask.popupFrame(dialog, bmAttr); } @@ -1689,11 +1681,8 @@ this.dialog = dialog; } - /** - * treasurelist button was pressed - * @param event the occured <code>ActionEvent</code> (button pressed) - */ - public void actionPerformed(final ActionEvent event) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { if (strAttr != null) { CFTreasureListTree.getInstance().showDialog(strAttr.input, dialog); } @@ -1715,14 +1704,14 @@ final JTextArea text; // textfield containing the error-text to keep - final GameObject arch; // the according arch + final GameObject arch; // the according gameObject final String allErrors; // list of all errors /** * Constructor. * @param dl the popup dialog - * @param archNew the arch which has the error to be added + * @param archNew the gameObject which has the error to be added * @param errors list of all errors (= initial content of the textarea) * @param keepB button "keep what is in the textfield" * @param textNew textfield containing the error-text to keep @@ -1735,12 +1724,9 @@ allErrors = errors; } - /** - * a button was pressed - * @param event the occured <code>ActionEvent</code> (button pressed) - */ - public void actionPerformed(final ActionEvent event) { - if (event.getSource() == keepButton) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { + if (e.getSource() == keepButton) { // the user pressed "keep", so we append the contents // of the textfield to the archtext if (text.getText() != null && text.getText().trim().length() > 0) { @@ -1754,12 +1740,11 @@ } /** - * user wants to kill the window via closebox - - * in this case, we keep all errors in the arch because it must + * {@inheritDoc} + * In this case, we keep all errors in the gameObject because it must * be assumed that the user did not properly think about them yet. - * @param event the occured <code>WindowEvent</code> */ - public void windowClosing(final WindowEvent event) { + public void windowClosing(final WindowEvent e) { arch.addArchText(allErrors.trim() + "\n"); // nuke the popup dialog @@ -1767,22 +1752,28 @@ dialog = null; } - public void windowDeactivated(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowDeactivated(final WindowEvent e) { } - public void windowActivated(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowActivated(final WindowEvent e) { } - public void windowClosed(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowClosed(final WindowEvent e) { } - public void windowOpened(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowOpened(final WindowEvent e) { } - public void windowIconified(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowIconified(final WindowEvent e) { } - public void windowDeiconified(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowDeiconified(final WindowEvent e) { } } // class ConfirmErrorsAL @@ -1793,9 +1784,9 @@ final CAttribDialog frame; // the entire frame - final GameObject arch; // the according arch + final GameObject arch; // the according gameObject - final GameObject defarch; // default arch of 'arch' + final GameObject defarch; // default gameObject of 'gameObject' String deselected; // the latest deselected item @@ -1804,8 +1795,8 @@ /** * Constructor. * @param frameNew the attribute-dialog mainframe - * @param archNew the arch which has the error to be added - * @param defarchNew the default arch of 'arch' + * @param archNew the gameObject which has the error to be added + * @param defarchNew the default gameObject of 'gameObject' */ public TypesBoxAL(final CAttribDialog frameNew, final GameObject archNew, final GameObject defarchNew) { frame = frameNew; @@ -1814,22 +1805,19 @@ ignoreEvent = false; } - /** - * a (new) type has been selected in the box - * @param event the occured <code>ItemEvent</code> (button pressed) - */ - public void itemStateChanged(final ItemEvent event) { + /** {@inheritDoc} */ + public void itemStateChanged(final ItemEvent e) { if (ignoreEvent) { return; } - if (event.getStateChange() == ItemEvent.DESELECTED) { + if (e.getStateChange() == ItemEvent.DESELECTED) { // remember the deselected type - deselected = ((String) event.getItem()).trim(); - } else if (event.getStateChange() == ItemEvent.SELECTED && !event.getItem().equals(deselected)) { + deselected = ((String) e.getItem()).trim(); + } else if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(deselected)) { // new type was selected // first, get new type structure - final CFArchType newType = typelist.getTypeByName((String) event.getItem()); + final CFArchType newType = typelist.getTypeByName((String) e.getItem()); frame.typesel.hidePopup(); frame.update(frame.getGraphics()); @@ -1842,7 +1830,7 @@ // change is confirmed, now get it on... frame.type = newType; // set new type structure - // change the arch to be of the new type: + // change the gameObject to be of the new type: arch.setArchTypNr(newType.getTypeNr()); attrHead = null; // clear list of attributes @@ -1856,7 +1844,7 @@ // recalculate the editType value arch.calculateEditType(mainControl.getCurrentMap().getActiveEditType()); - // also update the arch panel (bottom) + // also update the gameObject panel (bottom) mainControl.getMainView().refreshMapArchPanel(); // map content has changed mainControl.getCurrentMap().setLevelChangedFlag(); @@ -1883,13 +1871,14 @@ private static final class StringKeyManager implements JComboBox.KeySelectionManager { /** JComboBox reference. */ - final JComboBox box; + private final JComboBox box; public StringKeyManager(final JComboBox myBox) { box = myBox; } - /* + /** + * {@inheritDoc} * For any key, we select the first entry with * identical first character (after ' ') */ Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 16:03:13 UTC (rev 436) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 16:44:08 UTC (rev 437) @@ -136,15 +136,15 @@ private JComboBox typesel; // selection box for type - private JTextField nameTF; // textfield for arch name + private JTextField nameTF; // textfield for gameObject name - private JTextField defarchTF; // textfield for name of default arch + private JTextField defarchTF; // textfield for name of default gameObject private JLabel imagePanel; // panel for object's face (png) - private final GameObject arch; + private final GameObject gameObject; - private final GameObject defarch; + private final GameObject archetype; private CFArchType type; // reference to the type data @@ -178,28 +178,28 @@ /** Text pane where the summary is displayed. */ private final JTextPane summaryTP; - /** The arch objects that already are shown, to avoid opening a dialog twice. */ + /** The gameObject objects that already are shown, to avoid opening a dialog twice. */ private static final Map<GameObject, JDialog> dialogs = new HashMap<GameObject, JDialog>(); /** * Wrapper method for the constructor. - * This method only creates a CAttribDialog if there's no dialog for the same arch already. + * This method only creates a CAttribDialog if there's no dialog for the same gameObject already. * @param atList the list of CF type-data - * @param aobj the GameObject to be displayed by this dialog + * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - public static void showAttribDialog(final CFArchTypeList atList, final GameObject aobj, final CMainControl mainControl) { + public static void showAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { synchronized (dialogs) { - if (dialogs.containsKey(aobj)) { - dialogs.get(aobj).toFront(); + if (dialogs.containsKey(gameObject)) { + dialogs.get(gameObject).toFront(); } else { - final CAttribDialog pane = new CAttribDialog(atList, aobj, mainControl); - final JDialog dialog = pane.createDialog(mainControl.getMainView(), "Dummy arch attributes"); + final CAttribDialog pane = new CAttribDialog(atList, gameObject, mainControl); + final JDialog dialog = pane.createDialog(mainControl.getMainView(), "Dummy gameObject attributes"); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); dialog.setModal(false); dialog.setVisible(true); - dialogs.put(pane.arch, dialog); + dialogs.put(pane.gameObject, dialog); } } } @@ -207,18 +207,18 @@ /** * Constructor, creates the GUI layout. * @param atList the list of CF type-data - * @param aobj the GameObject to be displayed by this dialog + * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - private CAttribDialog(final CFArchTypeList atList, final GameObject aobj, final CMainControl mainControl) { + private CAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { listNr = 0; this.mainControl = mainControl; // reference to the main control typelist = atList; // reference to the typelist // reference to the GameObject - arch = aobj.getHead(); - defarch = arch.getArchetype(); + this.gameObject = gameObject.getHead(); + archetype = this.gameObject.getArchetype(); // check if the type of the object is present in the definitions //typeNr = 0; // for invalid types, we take "type 0" @@ -228,7 +228,7 @@ if (typeFound) { break; } - if (tmp.getTypeNr() == arch.getArchTypNr()) { + if (tmp.getTypeNr() == this.gameObject.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers typeFound = true; @@ -240,7 +240,7 @@ //System.err.println("# type: "+tmp.getTypeName()); for (int t = 0, l = numArgs << 1; t < l; t += 2) { - final String archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], true); + final String archvalue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], true); //System.err.println(" arch: '"+archvalue+"', type: '"+tmp.getTypeAttr()[t+1]+"'"); @@ -313,7 +313,7 @@ @Override public void setValue(final Object newValue) { super.setValue(newValue); if (newValue != UNINITIALIZED_VALUE) { - dialogs.remove(arch).dispose(); + dialogs.remove(gameObject).dispose(); } } @@ -341,7 +341,7 @@ typesel.setName("Types"); // the listener: - typesel.addItemListener(new TypesBoxAL(this, arch)); + typesel.addItemListener(new TypesBoxAL(this, gameObject)); return typesel; } @@ -352,8 +352,8 @@ */ private JComboBox buildSpellBox(final CFArchAttrib attr) { - // first parse the spell-number value from arch - int spnum = arch.getAttributeInt(attr.getNameOld(), true); // spell number + // first parse the spell-number value from gameObject + int spnum = gameObject.getAttributeInt(attr.getNameOld(), true); // spell number if (spnum < 0 || spnum >= CFArchTypeList.getSpells().getSpellNumbers().length - 1) { spnum = 0; // undefined spellnumbers be zero @@ -361,7 +361,7 @@ // do we have "none" spell? final int active; - if (spnum == 0 && (arch.getAttributeString(attr.getNameOld(), true).length() == 0 || attr.getDataType() == ZSPELL)) { + if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld(), true).length() == 0 || attr.getDataType() == ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells @@ -389,7 +389,7 @@ // build the array of list-items final String[] array = new String[(int) (listData.size() / 2.0)]; boolean hasSelection = false; - int active = arch.getAttributeInt(attr.getNameOld(), true); + int active = gameObject.getAttributeInt(attr.getNameOld(), true); for (int i = 0; i < array.length; i++) { array[i] = (String) listData.get((i << 1) + 1); // put string to array @@ -415,7 +415,7 @@ /** * Construct the upper left part of the attribute dialog, - * containing name, type, defarch name and face. + * containing name, type, archetype name and face. * @return a <code>JScrollPane</code> with the upper left part of the dialog window */ private JComponent buildHeader() { @@ -428,7 +428,7 @@ gbc.weightx = 0.0; gbc.weighty = 3.0; gbc.gridheight = 3; - imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(arch.getFaceObjName())); + imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(gameObject.getFaceObjName())); imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); header.add(imagePanel, gbc); gbc.gridheight = 1; @@ -442,25 +442,25 @@ gbc.gridy++; header.add(new JLabel("Type: ", TRAILING), gbc); gbc.gridy++; - header.add(new JLabel("Default Arch: ", TRAILING), gbc); // create label + header.add(new JLabel("Archetype: ", TRAILING), gbc); // create label gbc.gridx = 3; gbc.gridy = 1; gbc.weightx = 1.0; - if (arch.getObjName() != null && arch.getObjName().length() > 0) { - nameTF = new JTextField(arch.getObjName(), 16); - } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - nameTF = new JTextField(defarch.getObjName(), 16); + if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { + nameTF = new JTextField(gameObject.getObjName(), 16); + } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { + nameTF = new JTextField(archetype.getObjName(), 16); } else { - nameTF = new JTextField(defarch.getArchetypeName(), 16); + nameTF = new JTextField(archetype.getArchetypeName(), 16); } nameTF.setEditable(false); header.add(nameTF, gbc); gbc.gridy++; header.add(buildTypesBox(), gbc); // build type-selection box gbc.gridy++; - defarchTF = new JTextField(defarch.getArchetypeName(), 16); + defarchTF = new JTextField(archetype.getArchetypeName(), 16); defarchTF.setEditable(false); header.add(defarchTF, gbc); @@ -487,7 +487,7 @@ /** * Construct the central part of the attribute dialog, containing the - * object's arch attributes. + * object's gameObject attributes. * @return When this method is called the first time: a <code>JScrollPane</code> * with the central part of the dialog window. * All further calls rebuild the existing tabbedpane and return null. @@ -591,11 +591,11 @@ newAttr = new DialogAttrib<JTextArea>(attrib); String text = ""; if ("msg".equalsIgnoreCase(nameOld)) { - if (defarch.getMsgText() != null && defarch.getMsgText().length() > 0 && (arch.getMsgText() == null || arch.getMsgText().trim().length() == 0)) + if (archetype.getMsgText() != null && archetype.getMsgText().length() > 0 && (gameObject.getMsgText() == null || gameObject.getMsgText().trim().length() == 0)) { - text = defarch.getMsgText(); + text = archetype.getMsgText(); } else { - text = arch.getMsgText(); + text = gameObject.getMsgText(); } } final JTextArea input = new JTextArea(text, 10, 20); @@ -614,16 +614,16 @@ final JCheckBox input; if (dType == BOOL) { // normal bool - input = new JCheckBox(attrib.getNameNew(), arch.getAttributeInt(nameOld, true) == 1); + input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeInt(nameOld, true) == 1); } else { assert dType == BOOL_SPEC; // parse values for customized bool final String trueVal = attrib.getMisc()[0]; if ("0".equals(trueVal)) { - final String attrString = arch.getAttributeString(nameOld, true); + final String attrString = gameObject.getAttributeString(nameOld, true); input = new JCheckBox(attrib.getNameNew(), attrString.length() == 0 || "0".equals(attrString)); } else { - input = new JCheckBox(attrib.getNameNew(), arch.getAttributeString(nameOld, true).equals(trueVal)); + input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeString(nameOld, true).equals(trueVal)); } } ((DialogAttrib<JCheckBox>) newAttr).input = input; @@ -647,17 +647,17 @@ format.setGroupingUsed(false); final NumberFormatter formatter = new NumberFormatter(format); final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from arch + // parse value from gameObject Number value = null; switch (dType) { case INT: - value = arch.getAttributeInt(nameOld, true); + value = gameObject.getAttributeInt(nameOld, true); break; case LONG: - value = arch.getAttributeLong(nameOld, true); + value = gameObject.getAttributeLong(nameOld, true); break; case FLOAT: - value = arch.getAttributeDouble(nameOld, true); + value = gameObject.getAttributeDouble(nameOld, true); break; } final JFormattedTextField input = new JFormattedTextField(factory, value); @@ -671,21 +671,21 @@ case ANIMNAME: { final String dtxt; if ("name".equalsIgnoreCase(nameOld)) { - if (arch.getObjName() != null && arch.getObjName().length() > 0) { - dtxt = arch.getObjN... [truncated message content] |
From: <chr...@us...> - 2006-10-01 16:47:48
|
Revision: 438 http://svn.sourceforge.net/gridarta/?rev=438&view=rev Author: christianhujer Date: 2006-10-01 09:47:36 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Fixed bogus var name: Holds an attribute value, not an archetype or gameObject value. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 16:44:08 UTC (rev 437) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 16:47:36 UTC (rev 438) @@ -199,21 +199,21 @@ // check if all the type-attributes match final int argsNum = (int) (tmp.getTypeAttr().length / 2.0); boolean match = true; - String archvalue; + String attrValue; if (log.isDebugEnabled()) { log.debug("# type: " + tmp.getTypeName()); } for (int t = 0; t < argsNum * 2; t += 2) { - archvalue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], archetype); + attrValue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], archetype); if (log.isDebugEnabled()) { - log.debug(" arch: '" + archvalue + "', type: '" + tmp.getTypeAttr()[t + 1] + "'"); + log.debug(" arch: '" + attrValue + "', type: '" + tmp.getTypeAttr()[t + 1] + "'"); } - if (!archvalue.equals(tmp.getTypeAttr()[t + 1]) && - !(tmp.getTypeAttr()[t + 1].equals("0") && archvalue.length() == 0)) { + if (!attrValue.equals(tmp.getTypeAttr()[t + 1]) && + !(tmp.getTypeAttr()[t + 1].equals("0") && attrValue.length() == 0)) { match = false; if (log.isDebugEnabled()) { log.debug("-> attr: " + tmp.getTypeAttr()[t] + " NO match"); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 16:44:08 UTC (rev 437) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 16:47:36 UTC (rev 438) @@ -240,11 +240,11 @@ //System.err.println("# type: "+tmp.getTypeName()); for (int t = 0, l = numArgs << 1; t < l; t += 2) { - final String archvalue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], true); + final String attrValue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], true); - //System.err.println(" arch: '"+archvalue+"', type: '"+tmp.getTypeAttr()[t+1]+"'"); + //System.err.println(" arch: '"+attrValue+"', type: '"+tmp.getTypeAttr()[t+1]+"'"); - if (!archvalue.equals(tmp.getTypeAttr()[t + 1]) && !("0".equals(tmp.getTypeAttr()[t + 1]) && archvalue.length() == 0)) { + if (!attrValue.equals(tmp.getTypeAttr()[t + 1]) && !("0".equals(tmp.getTypeAttr()[t + 1]) && attrValue.length() == 0)) { match = false; // //System.err.println("-> attr: " + tmp.getTypeAttr()[t] + " NO match"); //} else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 21:46:07
|
Revision: 441 http://svn.sourceforge.net/gridarta/?rev=441&view=rev Author: christianhujer Date: 2006-10-01 14:45:45 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Removed deprecated methods from gridarta GameObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 21:45:45 UTC (rev 441) @@ -206,7 +206,7 @@ } for (int t = 0; t < argsNum * 2; t += 2) { - attrValue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], archetype); + attrValue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t]); if (log.isDebugEnabled()) { log.debug(" arch: '" + attrValue + "', type: '" + tmp.getTypeAttr()[t + 1] + "'"); @@ -369,7 +369,7 @@ private JComboBox buildSpellBox(final CFArchAttrib attr) { // first parse the spell-number value from gameObject - int spnum = gameObject.getAttributeInt(attr.getNameOld(), archetype); // spell number + int spnum = gameObject.getAttributeInt(attr.getNameOld()); // spell number if (spnum < 0 || spnum >= typelist.getSpellNum().length - 1) { spnum = 0; // undefined spellnumbers be zero @@ -377,7 +377,7 @@ // do we have "none" spell? int active; - if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld(), archetype).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { + if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld()).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells @@ -412,7 +412,7 @@ // build the array of list-items final String []array = new String[(int) (listData.size() / 2.)]; boolean hasSelection = false; - int active = gameObject.getAttributeInt(attr.getNameOld(), archetype); + int active = gameObject.getAttributeInt(attr.getNameOld()); for (int i = 0; i < array.length; i++) { array[i] = (String) listData.elementAt(i * 2 + 1); // put string to array @@ -447,7 +447,7 @@ */ private void buildBitmask(final CFArchAttrib attr, final BitmaskAttrib guiAttr, final CAttribBitmask bitmask, final JPanel mainPanel) { // initialize bitmask value - guiAttr.setValue(gameObject.getAttributeInt(attr.getNameOld(), archetype)); + guiAttr.setValue(gameObject.getAttributeInt(attr.getNameOld())); guiAttr.bitmask = bitmask; // add button @@ -677,16 +677,16 @@ final JCheckBox input; if (dType == CFArchAttrib.T_BOOL) { // normal bool - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeInt(type.getAttr()[i].getNameOld(), archetype) == 1)); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeInt(type.getAttr()[i].getNameOld()) == 1)); } else { // parse values for customized bool final String trueVal = type.getAttr()[i].getMisc()[0]; if (trueVal.equals("0")) { - final String attrString = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); + final String attrString = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (attrString.length() == 0 || attrString.equals("0"))); } else { - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype).equals(trueVal))); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeString(type.getAttr()[i].getNameOld()).equals(trueVal))); } } @@ -718,7 +718,7 @@ // parse value from gameObject final int fieldLength = (type.getAttr()[i].getInputLength() == 0 ? textFieldColumns : type.getAttr()[i].getInputLength()); - final int attrval = gameObject.getAttributeInt(type.getAttr()[i].getNameOld(), archetype); + final int attrval = gameObject.getAttributeInt(type.getAttr()[i].getNameOld()); if (attrval != 0) { input = new JTextField(String.valueOf(attrval), fieldLength); } else { @@ -778,7 +778,7 @@ dtxt = archetype.getFaceName(); } } else { - dtxt = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); + dtxt = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); } input = new JTextField(dtxt, textFieldColumns); @@ -895,7 +895,7 @@ // textfield (no direct input, text is set by the treasurelist dialog) final JTextField input; - String treasureName = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); + String treasureName = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; } @@ -1192,7 +1192,7 @@ if (dType == CFArchAttrib.T_BOOL) { // a boolean attribute (flag) if (((BoolAttrib) attr).input.isSelected() != - (archetype.getAttributeInt(attr.ref.getNameOld(), null) == 1)) { + (archetype.getAttributeInt(attr.ref.getNameOld(), false) == 1)) { newArchText = newArchText + attr.ref.getNameOld() + " " + (((BoolAttrib) attr).input.isSelected() ? 1 : 0) + "\n"; } @@ -1205,31 +1205,31 @@ valString = attr.ref.getMisc()[1]; // false string } // now see if we need to write it into the archtext or not - if ((valString.equals("0") && !(archetype.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) || (!valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld(), null).equals(valString))) { + if ((valString.equals("0") && !(archetype.getAttributeString(attr.ref.getNameOld(), false).length() == 0)) || (!valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld(), false).equals(valString))) { newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } else if (dType == CFArchAttrib.T_INT || dType == CFArchAttrib.T_FLOAT) { // an int attribute if (dType == CFArchAttrib.T_INT && ((IntAttrib) attr).input.getText().trim().length() == 0) { - if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != 0) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } } else if (dType == CFArchAttrib.T_FLOAT && ((FloatAttrib) attr).input.getText().trim().length() == 0) { - if (archetype.getAttributeString(attr.ref.getNameOld(), null).length() > 0) { + if (archetype.getAttributeString(attr.ref.getNameOld(), false).length() > 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0.0\n"; } } else { try { if (dType == CFArchAttrib.T_INT) { final int value = Integer.parseInt(((IntAttrib) attr).input.getText().trim()); - if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != value) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else { // try to parse floating point final double value = Double.parseDouble(((FloatAttrib) attr).input.getText().trim()); - final String defValueStr = archetype.getAttributeString(attr.ref.getNameOld(), null).trim(); + final String defValueStr = archetype.getAttributeString(attr.ref.getNameOld(), false).trim(); final double defValue; if (defValueStr.length() > 0) { defValue = Double.parseDouble(defValueStr); @@ -1275,7 +1275,7 @@ newFace = ""; } } else { - if (!inline.equals(archetype.getAttributeString(attr.ref.getNameOld(), null))) { + if (!inline.equals(archetype.getAttributeString(attr.ref.getNameOld(), false))) { newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } @@ -1301,19 +1301,19 @@ if (attrVal == -1 || (attrVal == 0 && dType != CFArchAttrib.T_SPELL && dType != CFArchAttrib.T_ZSPELL)) { - if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != 0) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } } else if (attrVal == 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; - } else if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != attrVal) { + } else if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != 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 (archetype.getAttributeInt(attr.ref.getNameOld(), null) != value) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else if (dType == CFArchAttrib.T_TREASURE) { @@ -1324,7 +1324,7 @@ final boolean isNone = inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0; if (!isNone && !CFTreasureListTree.getInstance().containsTreasureList(inline) && - !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), null))) { + !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), false))) { // The user has specified a WRONG treasurelist name, and it does not come // from the default gameObject. -> Error and out. JOptionPane.showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + @@ -1333,8 +1333,8 @@ throw new GridderException(""); // bail out } - if (!inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), null)) - && !(isNone && archetype.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) { + if (!inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), false)) + && !(isNone && archetype.getAttributeString(attr.ref.getNameOld(), false).length() == 0)) { if (isNone) { newArchText = newArchText + attr.ref.getNameOld() + " none\n"; } else { @@ -1348,7 +1348,7 @@ // Also write all the 'fixed' attributes into the archtext for (int i = 0; type.getAttr().length > i; i++) { if (type.getAttr()[i].getDataType() == CFArchAttrib.T_FIXED) { - final String defaultValue = archetype.getAttributeString(type.getAttr()[i].getNameOld(), null); + final String defaultValue = archetype.getAttributeString(type.getAttr()[i].getNameOld(), false); if (defaultValue.length() == 0 || (gameObject.getArchTypNr() != archetype.getArchTypNr() && !defaultValue.equalsIgnoreCase(type.getAttr()[i].getNameNew()))) { // usually, fixed attributes are only applied when *not* defined in the archetype. Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-10-01 21:45:45 UTC (rev 441) @@ -558,7 +558,7 @@ boolean match = true; for (int t = 0; t < argsNum * 2; t += 2) { - final String archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], defarch); + final String archvalue = arch.getAttributeString(tmp.getTypeAttr()[t]); if (!archvalue.equals(tmp.getTypeAttr()[t + 1]) && !(tmp.getTypeAttr()[t + 1].equals("0") && archvalue.length() == 0)) { Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 21:45:45 UTC (rev 441) @@ -1325,10 +1325,10 @@ return; } - final String path = exit.getAttributeString("slaying", getArch(exit.getArchetypeName())); + final String path = exit.getAttributeString("slaying"); final Point exitPos = new Point(); - exitPos.x = exit.getAttributeInt("hp", getArch(exit.getArchetypeName())); - exitPos.y = exit.getAttributeInt("sp", getArch(exit.getArchetypeName())); + exitPos.x = exit.getAttributeInt("hp"); + exitPos.y = exit.getAttributeInt("sp"); 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-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-10-01 21:45:45 UTC (rev 441) @@ -417,8 +417,8 @@ // 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.getAttributeInt("type", null)); // specified type + if (arch.getAttributeString("type", false).length() > 0) { + arch.setArchTypNr(arch.getAttributeInt("type", false)); // specified type } // Recalculate the editType value. It shall stay 100% accurate ;) Modified: trunk/crossfire/src/cfeditor/filter/AttributeFilter.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-10-01 21:45:45 UTC (rev 441) @@ -61,11 +61,10 @@ final Set<Map.Entry<String, String>> pairs = attrList.entrySet(); if (!pairs.isEmpty()) { hasChecked = true; - final GameObject def = object.getArchetype(); for (final Map.Entry<String, String> ent : pairs) { final String key = ent.getKey(); final String val = ent.getValue(); - if (!object.getAttributeString(key, def).equals(val)) { + if (!object.getAttributeString(key).equals(val)) { return false; } } Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) @@ -312,8 +312,19 @@ return editType; } - /** {@inheritDoc} */ - @NotNull public String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** + * Get the requested attribute value of this GameObject as {@link String}. + * The attribute value is first searched in this GameObject. + * If the attribute value is not found and <code><var>archetype</var> != null</code>, + * the attribute value is searched in <var>archetype</var>, too. + * If it's not found at all, an empty String is returned. + * @param attributeName Name of the attribute to search. + * This will be <code>"<var>attributeName</var> value"</code> + * in the {@link #getObjectText() object text}. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or empty String if not found. + */ + @NotNull private String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype int j; attributeName = attributeName.trim() + " "; // attributeName must be followed by space @@ -365,7 +376,13 @@ return getAttributeString(attributeName, true); } - /** {@inheritDoc} */ + /** + * Get the requested attribute value of this GameObject as <code>int</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText @@ -393,7 +410,18 @@ } /** {@inheritDoc} */ - public long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public int getAttributeInt(@NotNull final String attributeName) { + return getAttributeInt(attributeName, true); + } + + /** + * Get the requested attribute value of this GameObject as <code>long</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ + private long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -419,7 +447,18 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public long getAttributeLong(@NotNull final String attributeName) { + return getAttributeLong(attributeName, true); + } + + /** + * Get the requested attribute value of this GameObject as <code>double</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ + private double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -445,6 +484,11 @@ } /** {@inheritDoc} */ + public double getAttributeDouble(@NotNull final String attributeName) { + return getAttributeDouble(attributeName, true); + } + + /** {@inheritDoc} */ @Nullable public GameObject getContainer() { return container; } @@ -551,7 +595,7 @@ return; } - final String elevation = arch.getAttributeString("elevation", null); + final String elevation = arch.getAttributeString("elevation", false); if (!elevation.equals("")) { setAttributeString("elevation", elevation); arch.removeAttribute("elevation"); Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-10-01 21:45:45 UTC (rev 441) @@ -139,6 +139,7 @@ */ @Nullable private GameObject getScriptedEvent(final int eventType) { for (final GameObject tmp : owner) { + // FIXME: using tmp.getAttributeInt("sub_type") with owner.getArchetype() instead of tmp.getArchetype() looks bogus. if (tmp.getArchTypNr() == 118 && tmp.getAttributeInt("sub_type", owner.getArchetype()) == eventType) { return tmp; } @@ -176,6 +177,7 @@ final Vector<String> content = new Vector<String>(); for (final GameObject tmp : owner) { if (tmp.getArchTypNr() == 118) { + // FIXME: using tmp.getAttributeInt("sub_type") with owner.getArchetype() instead of tmp.getArchetype() looks bogus. content.add(' ' + typeName(tmp.getAttributeInt("sub_type", owner.getArchetype()))); } } Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) @@ -321,11 +321,6 @@ } /** {@inheritDoc} */ - @NotNull public String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { - throw new Error("deprecated and not used in Daimonin"); - } - - /** {@inheritDoc} */ @NotNull public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText @@ -347,7 +342,13 @@ return getAttributeString(attributeName, true); } - /** {@inheritDoc} */ + /** + * Get the requested attribute value of this GameObject as <code>int</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText @@ -375,7 +376,18 @@ } /** {@inheritDoc} */ - public long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public int getAttributeInt(@NotNull final String attributeName) { + return getAttributeInt(attributeName, true); + } + + /** + * Get the requested attribute value of this GameObject as <code>long</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ + private long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -401,7 +413,18 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public long getAttributeLong(@NotNull final String attributeName) { + return getAttributeLong(attributeName, true); + } + + /** + * Get the requested attribute value of this GameObject as <code>double</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ + private double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -427,6 +450,11 @@ } /** {@inheritDoc} */ + public double getAttributeDouble(@NotNull final String attributeName) { + return getAttributeDouble(attributeName, true); + } + + /** {@inheritDoc} */ @NotNull public GameObjectContainer getContainer() { return container; } Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) @@ -26,21 +26,6 @@ /** * Get the requested attribute value of this GameObject as {@link String}. * The attribute value is first searched in this GameObject. - * If the attribute value is not found and <code><var>archetype</var> != null</code>, - * the attribute value is searched in <var>archetype</var>, too. - * If it's not found at all, an empty String is returned. - * @param attributeName Name of the attribute to search. - * This will be <code>"<var>attributeName</var> value"</code> - * in the {@link #getObjectText() object text}. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or empty String if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - @Deprecated @NotNull String getAttributeString(@NotNull String attributeName, @Nullable GameObject archetype); - - /** - * Get the requested attribute value of this GameObject as {@link String}. - * The attribute value is first searched in this GameObject. * If <code>queryArchetype == true</code>, additional search is done: * if the attribute value is not found and this GameObject is not an Archetype itself, * the attribute value is searched in this GameObject's Archetype as well. @@ -71,16 +56,6 @@ /** * Get the requested attribute value of this GameObject as <code>int</code>. * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - * @see #getAttributeString(String, GameObject) - */ - @Deprecated int getAttributeInt(@NotNull String attributeName, @Nullable GameObject archetype); - - /** - * Get the requested attribute value of this GameObject as <code>int</code>. - * @param attributeName Name of the attribute to search. * @param queryArchetype Whether to query the Archetype of this GameObject. * @return attribute value or zero if not found. * @see #getAttributeString(String, boolean) @@ -88,14 +63,12 @@ int getAttributeInt(@NotNull String attributeName, boolean queryArchetype); /** - * Get the requested attribute value of this GameObject as <code>long</code>. + * Get the requested attribute value of this GameObject as <code>int</code>. * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - * @see #getAttributeString(String, GameObject) + * @return Attribute value or zero if not found + * @see #getAttributeString(String) */ - @Deprecated long getAttributeLong(@NotNull String attributeName, @Nullable GameObject archetype); + int getAttributeInt(@NotNull String attributeName); /** * Get the requested attribute value of this GameObject as <code>int</code>. @@ -107,17 +80,15 @@ long getAttributeLong(@NotNull String attributeName, boolean queryArchetype); /** - * Get the requested attribute value of this GameObject as <code>double</code>. + * Get the requested attribute value of this GameObject as <code>long</code>. * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - * @see #getAttributeString(String, net.sf.gridarta.gameobject.GameObject) + * @return Attribute value or zero if not found + * @see #getAttributeString(String) */ - @Deprecated double getAttributeDouble(@NotNull String attributeName, @Nullable GameObject archetype); + long getAttributeLong(@NotNull String attributeName); /** - * Get the requested attribute value of this GameObject as <code>int</code>. + * Get the requested attribute value of this GameObject as <code>double</code>. * @param attributeName Name of the attribute to search. * @param queryArchetype Whether to query the Archetype of this GameObject. * @return attribute value or zero if not found. @@ -126,6 +97,14 @@ double getAttributeDouble(@NotNull String attributeName, boolean queryArchetype); /** + * Get the requested attribute value of this GameObject as <code>double</code>. + * @param attributeName Name of the attribute to search. + * @return attribute value or zero if not found. + * @see #getAttributeString(String) + */ + double getAttributeDouble(@NotNull String attributeName); + + /** * Returns container of this GameObject. * There are two possibilities for the container: * <ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 22:15:20
|
Revision: 442 http://svn.sourceforge.net/gridarta/?rev=442&view=rev Author: christianhujer Date: 2006-10-01 15:15:08 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Inlined private methods that were used only once. daimonin: Also removed bug that queried the wrong archetype for ScriptArchData. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 22:15:08 UTC (rev 442) @@ -312,19 +312,8 @@ return editType; } - /** - * Get the requested attribute value of this GameObject as {@link String}. - * The attribute value is first searched in this GameObject. - * If the attribute value is not found and <code><var>archetype</var> != null</code>, - * the attribute value is searched in <var>archetype</var>, too. - * If it's not found at all, an empty String is returned. - * @param attributeName Name of the attribute to search. - * This will be <code>"<var>attributeName</var> value"</code> - * in the {@link #getObjectText() object text}. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or empty String if not found. - */ - @NotNull private String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + @NotNull public String getAttributeString(@NotNull String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype int j; attributeName = attributeName.trim() + " "; // attributeName must be followed by space @@ -367,23 +356,12 @@ } /** {@inheritDoc} */ - @NotNull public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeString(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ @NotNull public String getAttributeString(@NotNull final String attributeName) { return getAttributeString(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>int</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -405,23 +383,12 @@ } /** {@inheritDoc} */ - public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeInt(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public int getAttributeInt(@NotNull final String attributeName) { return getAttributeInt(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>long</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - private long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -442,23 +409,12 @@ } /** {@inheritDoc} */ - public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeLong(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public long getAttributeLong(@NotNull final String attributeName) { return getAttributeLong(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>double</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - private double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -479,11 +435,6 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeDouble(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public double getAttributeDouble(@NotNull final String attributeName) { return getAttributeDouble(attributeName, true); } Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-10-01 21:45:45 UTC (rev 441) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-10-01 22:15:08 UTC (rev 442) @@ -140,7 +140,7 @@ @Nullable private GameObject getScriptedEvent(final int eventType) { for (final GameObject tmp : owner) { // FIXME: using tmp.getAttributeInt("sub_type") with owner.getArchetype() instead of tmp.getArchetype() looks bogus. - if (tmp.getArchTypNr() == 118 && tmp.getAttributeInt("sub_type", owner.getArchetype()) == eventType) { + if (tmp.getArchTypNr() == 118 && tmp.getAttributeInt("sub_type") == eventType) { return tmp; } } @@ -177,8 +177,7 @@ final Vector<String> content = new Vector<String>(); for (final GameObject tmp : owner) { if (tmp.getArchTypNr() == 118) { - // FIXME: using tmp.getAttributeInt("sub_type") with owner.getArchetype() instead of tmp.getArchetype() looks bogus. - content.add(' ' + typeName(tmp.getAttributeInt("sub_type", owner.getArchetype()))); + content.add(' ' + typeName(tmp.getAttributeInt("sub_type"))); } } Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 22:15:08 UTC (rev 442) @@ -342,14 +342,8 @@ return getAttributeString(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>int</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -371,23 +365,12 @@ } /** {@inheritDoc} */ - public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeInt(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public int getAttributeInt(@NotNull final String attributeName) { return getAttributeInt(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>long</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - private long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -408,23 +391,12 @@ } /** {@inheritDoc} */ - public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeLong(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public long getAttributeLong(@NotNull final String attributeName) { return getAttributeLong(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>double</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - private double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -445,11 +417,6 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeDouble(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public double getAttributeDouble(@NotNull final String attributeName) { return getAttributeDouble(attributeName, true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 22:31:43
|
Revision: 444 http://svn.sourceforge.net/gridarta/?rev=444&view=rev Author: christianhujer Date: 2006-10-01 15:31:26 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Extracted GameObject artifact status to interface. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 22:17:42 UTC (rev 443) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 22:31:26 UTC (rev 444) @@ -561,25 +561,12 @@ myId = num; } - /** - * Sets if this flag is set, the arch is not a "real" arch but comes from - * the artifacts file. Such GameObject 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. - */ + /** {@inheritDoc} */ public void setArtifact(final boolean artifact) { this.artifact = artifact; } - /** - * Returns if this flag is set, the arch is not a "real" arch but comes - * from the artifacts file. Such GameObject 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. - */ + /** {@inheritDoc} */ public boolean isArtifact() { return artifact; } Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 22:17:42 UTC (rev 443) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 22:31:26 UTC (rev 444) @@ -460,25 +460,12 @@ return container != null ? container.getMapSquare() : null; } - /** - * Sets if this flag is set, the arch is not a "real" arch but comes from - * the artifacts file. Such GameObject 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. - */ + /** {@inheritDoc} */ public void setArtifact(final boolean artifact) { this.artifact = artifact; } - /** - * Returns if this flag is set, the arch is not a "real" arch but comes - * from the artifacts file. Such GameObject 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. - */ + /** {@inheritDoc} */ public boolean isArtifact() { return artifact; } @@ -521,7 +508,7 @@ } /** - * Insert an GameObject before this GameObject. + * Insert a GameObject before this GameObject. * @param node GameObject to append */ public void insertBefore(final GameObject node) { @@ -529,7 +516,7 @@ } /** - * Insert an GameObject after this GameObject. + * Insert a GameObject after this GameObject. * @param node GameObject to append */ public void insertAfter(final GameObject node) { Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 22:17:42 UTC (rev 443) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 22:31:26 UTC (rev 444) @@ -136,16 +136,36 @@ * @param archetype new Archetype of this GameObject. * @note currently this method takes a GameObject that reflects the Archetype data because there is no separate Archetype class. * This will change in future, and you should be aware of this fact. + * @see #isArchetype() */ void setArchetype(@NotNull final GameObject archetype); /** * Returns whether this GameObject is an Archetype. * @return <code>true</code> if this GameObject is an Archetype, otherwise <code>false</code> + * @see #isArtifact() + * @see #setArchetype(GameObject) */ boolean isArchetype(); /** + * Sets whether this GameObject is an Artifact. + * @param artifact <code>true</code> if this GameObject is an Artifact, otherwise <code>false</code>. + * @see #isArtifact() + */ + void setArtifact(boolean artifact); + + /** + * Returns whether this GameObject is an Artifact. + * Artifacts are special forms of Archetypes, and they are excluded from Archetypes collection. + * @return <code>true</code> if this GameObject is an Artifact, otherwise <code>false</code>. + * @invariant if this method returns <code>true</code>, {@link #isArchetype()} also returns <code>true</code>. + * @see #isArchetype() + * @see #setArtifact(boolean) + */ + boolean isArtifact(); + + /** * Returns the edit type. * @return edit type */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 12:51:38
|
Revision: 446 http://svn.sourceforge.net/gridarta/?rev=446&view=rev Author: christianhujer Date: 2006-10-02 05:51:21 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Removed dependency of CUndoStack to CMainControl. Improved documentation on Undo system. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/CUndoStack.java trunk/src/app/net/sf/gridarta/Undoable.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 22:50:54 UTC (rev 445) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 12:51:21 UTC (rev 446) @@ -226,9 +226,6 @@ * Initialises this main controller. */ void init(final boolean doShow) { - // Register ourselves to the undo/redo stack - CUndoStack.setMainControl(this); - // Get the current directory strCurrentDir = System.getProperty("user.dir"); currentDir = new File(strCurrentDir); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-10-01 22:50:54 UTC (rev 445) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 12:51:21 UTC (rev 446) @@ -393,9 +393,6 @@ /** Initialises this main controller. */ void init() { - // Register ourselves to the undo/redo stack - CUndoStack.setMainControl(this); - // Get the current directory currentDir = new File(System.getProperty("user.dir")); Modified: trunk/src/app/net/sf/gridarta/CUndoStack.java =================================================================== --- trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-01 22:50:54 UTC (rev 445) +++ trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-02 12:51:21 UTC (rev 446) @@ -34,12 +34,11 @@ * The undo/redo stack that is used when undoing/redoing operations. * Every operation should add itself to the stack using the add() method. * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo transform {@link #undo()} and {@link #redo()} into Actions. */ public final class CUndoStack { - /** The controller of the undo stack model. */ - private static MainControl mainControl; - /** The shared hashtable that maps levels to undo stacks. */ private static final Map<MapControl, CUndoStack> hashFromLevelToStack = new WeakHashMap<MapControl, CUndoStack>(); @@ -67,14 +66,6 @@ return instance; } - /** - * Sets the main controller of all undo/redo stack models. - * @param mainControl the controller of all undo/redo stacks - */ - public static void setMainControl(final MainControl mainControl) { - CUndoStack.mainControl = mainControl; - } - /** Constructs an undo/redo stack. */ private CUndoStack() { } @@ -105,10 +96,6 @@ if (undoStack.size() > maxStackSize) { undoStack.remove(0); } - - if (mainControl != null) { - mainControl.refreshMenusAndToolbars(); - } } /** @@ -136,10 +123,6 @@ undoStack.remove(op); op.undo(); redoStack.add(op); - - if (mainControl != null) { - mainControl.refreshMenusAndToolbars(); - } } } @@ -168,10 +151,6 @@ redoStack.remove(op); op.redo(); undoStack.add(op); - - if (mainControl != null) { - mainControl.refreshMenusAndToolbars(); - } } } Modified: trunk/src/app/net/sf/gridarta/Undoable.java =================================================================== --- trunk/src/app/net/sf/gridarta/Undoable.java 2006-10-01 22:50:54 UTC (rev 445) +++ trunk/src/app/net/sf/gridarta/Undoable.java 2006-10-02 12:51:21 UTC (rev 446) @@ -25,33 +25,41 @@ package net.sf.gridarta; /** - * A generic interface for undoable/redoable operations. + * An Operation that eventually can be undone or redone. * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public interface Undoable { /** * Returns whether the operation is undoable. - * @return True if the operation is undoable, false if not. + * @return <code>true</code> if the operation is undoable, otherwise <code>false</code>. */ boolean isUndoable(); - /** Undoes the operation (if that is possible). */ + /** + * Undoes this operation. + * If this operation is not {@link #isUndoable() undoable}, this operation silently returns without doing anything. + */ void undo(); /** * Returns whether the operation is redoable. - * @return True if the operation is redoable, false if not. + * @return <code>true</code> if the operation is redoable, otherwise <code>false</code>. */ boolean isRedoable(); - /** Reapplies the operation (if that is possible). */ + /** + * Redoes this operation. + * If this operation is not {@link #isRedoable() redoable}, this operation silently returns without doing anything. + */ void redo(); /** * Returns the operations short (about 8 chars max) name. The name is used * to show the operation in the menuitems and toolbar buttons tooltips. * @return The name of the operation. + * @todo decide whether it should be a key usable for i18n or the already localized message. */ String getName(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 12:54:40
|
Revision: 447 http://svn.sourceforge.net/gridarta/?rev=447&view=rev Author: christianhujer Date: 2006-10-02 05:54:12 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Removed unused imports from CMainControl. Renamed CUndoStack to the more appropriate name UndoAndRedo. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/map/MapControl.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/UndoAndRedo.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/CUndoStack.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 12:54:12 UTC (rev 447) @@ -54,7 +54,6 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.CUndoStack; import net.sf.gridarta.MainControl; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.HideFileFilterProxy; Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 12:54:12 UTC (rev 447) @@ -1107,7 +1107,7 @@ mainControl.getMainView().setMapTileList(null, -1); // for secure... } /* - CUndoStack.getInstance(mapControl).add(new CPaintOp(previewRect, aOrigData, (short)mapControl.getSelectedTile())); + UndoAndRedo.getInstance(mapControl).add(new CPaintOp(previewRect, aOrigData, (short)mapControl.getSelectedTile())); */ endFill(); Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 12:54:12 UTC (rev 447) @@ -37,7 +37,7 @@ import java.io.File; import java.util.Iterator; import java.util.List; -import net.sf.gridarta.CUndoStack; +import net.sf.gridarta.UndoAndRedo; import net.sf.gridarta.Size2D; import org.jetbrains.annotations.NotNull; @@ -368,14 +368,14 @@ * Undoes a change in the level. */ public void undo() { - CUndoStack.getInstance(this).undo(); + UndoAndRedo.getInstance(this).undo(); } /** * Redoes a change in the level. */ public void redo() { - CUndoStack.getInstance(this).redo(); + UndoAndRedo.getInstance(this).redo(); } /** @@ -383,7 +383,7 @@ * @return the name of the undo operation */ public String getUndoName() { - return CUndoStack.getInstance(this).getUndoName(); + return UndoAndRedo.getInstance(this).getUndoName(); } /** @@ -391,7 +391,7 @@ * @return the name of the redo operation */ public String getRedoName() { - return CUndoStack.getInstance(this).getRedoName(); + return UndoAndRedo.getInstance(this).getRedoName(); } /** @@ -400,7 +400,7 @@ * possible */ public boolean isUndoPossible() { - return CUndoStack.getInstance(this).canUndo(); + return UndoAndRedo.getInstance(this).canUndo(); } /** @@ -409,7 +409,7 @@ * possible */ public boolean isRedoPossible() { - return CUndoStack.getInstance(this).canRedo(); + return UndoAndRedo.getInstance(this).canRedo(); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 12:54:12 UTC (rev 447) @@ -113,7 +113,6 @@ import static javax.swing.JOptionPane.showMessageDialog; import static javax.swing.KeyStroke.getKeyStroke; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.CUndoStack; import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.map.MapType; Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-10-02 12:54:12 UTC (rev 447) @@ -45,7 +45,7 @@ import java.util.List; import javax.imageio.ImageIO; import javax.swing.ImageIcon; -import net.sf.gridarta.CUndoStack; +import net.sf.gridarta.UndoAndRedo; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapGrid; @@ -240,14 +240,14 @@ * Undoes a change in the level. */ public void undo() { - CUndoStack.getInstance(this).undo(); + UndoAndRedo.getInstance(this).undo(); } /** * Redoes a change in the level. */ public void redo() { - CUndoStack.getInstance(this).redo(); + UndoAndRedo.getInstance(this).redo(); } /** @@ -262,7 +262,7 @@ * @return the name of the undo operation */ public String getUndoName() { - return CUndoStack.getInstance(this).getUndoName(); + return UndoAndRedo.getInstance(this).getUndoName(); } /** @@ -270,7 +270,7 @@ * @return the name of the redo operation */ public String getRedoName() { - return CUndoStack.getInstance(this).getRedoName(); + return UndoAndRedo.getInstance(this).getRedoName(); } /** @@ -279,7 +279,7 @@ * possible */ public boolean isUndoPossible() { - return CUndoStack.getInstance(this).canUndo(); + return UndoAndRedo.getInstance(this).canUndo(); } /** @@ -288,7 +288,7 @@ * possible */ public boolean isRedoPossible() { - return CUndoStack.getInstance(this).canRedo(); + return UndoAndRedo.getInstance(this).canRedo(); } /** Deleted: trunk/src/app/net/sf/gridarta/CUndoStack.java =================================================================== --- trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-02 12:54:12 UTC (rev 447) @@ -1,157 +0,0 @@ -/* - * Crossfire 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 net.sf.gridarta; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; -import net.sf.gridarta.map.MapControl; - -/** - * The undo/redo stack that is used when undoing/redoing operations. - * Every operation should add itself to the stack using the add() method. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo transform {@link #undo()} and {@link #redo()} into Actions. - */ -public final class CUndoStack { - - /** The shared hashtable that maps levels to undo stacks. */ - private static final Map<MapControl, CUndoStack> hashFromLevelToStack = new WeakHashMap<MapControl, CUndoStack>(); - - /** The undo stack. Contains all undoable operations. */ - private final List<Undoable> undoStack = new ArrayList<Undoable>(); - - /** The redo stack. Contains all redoable operations. */ - private final List<Undoable> redoStack = new ArrayList<Undoable>(); - - /** The maximum size of the stacks. */ - private int maxStackSize = 10; - - /** - * Returns the undo stack for the given level controller. - * @param mapControl the level whose undo/redo stack is to be returned - * @return the undo/redo stack for the given level - */ - public static CUndoStack getInstance(final MapControl mapControl) { - if (hashFromLevelToStack.containsKey(mapControl)) { - return hashFromLevelToStack.get(mapControl); - } - - final CUndoStack instance = new CUndoStack(); - hashFromLevelToStack.put(mapControl, instance); - return instance; - } - - /** Constructs an undo/redo stack. */ - private CUndoStack() { - } - - /** - * Returns the maximum stack size. - * @return the maximum stack size - */ - int getMaxStackSize() { - return maxStackSize; - } - - /** - * Sets the maximum stack size. - * @param size the new maximum stack size - */ - void setMaxStackSize(final int size) { - maxStackSize = size; - } - - /** - * Adds a new undoable/redoable operation to the undo/redo stack. - * @param undoOp the new operation to be added to the stack - */ - public void add(final Undoable undoOp) { - undoStack.add(undoOp); - redoStack.clear(); - if (undoStack.size() > maxStackSize) { - undoStack.remove(0); - } - } - - /** - * Returns whether the last operation in the undo stack can be undone. - * @return <code>true</code> if the last operation in the undo stack can be - * undone, <code>false</code> if not - */ - public boolean canUndo() { - return undoStack.size() > 0 && undoStack.get(undoStack.size() - 1).isUndoable(); - - } - - /** - * Returns the name of the last operation in the undo stack. - * @return the name of the last operation in the undo stack - */ - public String getUndoName() { - return canUndo() ? undoStack.get(undoStack.size() - 1).getName() : ""; - } - - /** Undoes the last operation in the undo stack. */ - public void undo() { - if (canUndo()) { - final Undoable op = undoStack.get(undoStack.size() - 1); - undoStack.remove(op); - op.undo(); - redoStack.add(op); - } - } - - /** - * Returns whether the last operation in the redo stack can be redone. - * @return <code>true</code> if the last operation in the redo stack can be - * redone, <code>false</code> if not - */ - public boolean canRedo() { - return redoStack.size() > 0 && redoStack.get(redoStack.size() - 1).isRedoable(); - - } - - /** - * Returns the name of the last operation in the redo stack. - * @return the name of the last operation in the redo stack - */ - public String getRedoName() { - return canRedo() ? redoStack.get(redoStack.size() - 1).getName() : ""; - } - - /** Redoes the last operation in the redo stack. */ - public void redo() { - if (canRedo()) { - final Undoable op = redoStack.get(redoStack.size() - 1); - redoStack.remove(op); - op.redo(); - undoStack.add(op); - } - } - -} // class CUndoStack Copied: trunk/src/app/net/sf/gridarta/UndoAndRedo.java (from rev 446, trunk/src/app/net/sf/gridarta/CUndoStack.java) =================================================================== --- trunk/src/app/net/sf/gridarta/UndoAndRedo.java (rev 0) +++ trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 12:54:12 UTC (rev 447) @@ -0,0 +1,157 @@ +/* + * Crossfire 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 net.sf.gridarta; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; +import net.sf.gridarta.map.MapControl; + +/** + * The undo/redo stack that is used when undoing/redoing operations. + * Every operation should add itself to the stack using the add() method. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo transform {@link #undo()} and {@link #redo()} into Actions. + */ +public final class UndoAndRedo { + + /** The shared hashtable that maps levels to undo stacks. */ + private static final Map<MapControl, UndoAndRedo> hashFromLevelToStack = new WeakHashMap<MapControl, UndoAndRedo>(); + + /** The undo stack. Contains all undoable operations. */ + private final List<Undoable> undoStack = new ArrayList<Undoable>(); + + /** The redo stack. Contains all redoable operations. */ + private final List<Undoable> redoStack = new ArrayList<Undoable>(); + + /** The maximum size of the stacks. */ + private int maxStackSize = 10; + + /** + * Returns the undo stack for the given level controller. + * @param mapControl the level whose undo/redo stack is to be returned + * @return the undo/redo stack for the given level + */ + public static UndoAndRedo getInstance(final MapControl mapControl) { + if (hashFromLevelToStack.containsKey(mapControl)) { + return hashFromLevelToStack.get(mapControl); + } + + final UndoAndRedo instance = new UndoAndRedo(); + hashFromLevelToStack.put(mapControl, instance); + return instance; + } + + /** Constructs an undo/redo stack. */ + private UndoAndRedo() { + } + + /** + * Returns the maximum stack size. + * @return the maximum stack size + */ + int getMaxStackSize() { + return maxStackSize; + } + + /** + * Sets the maximum stack size. + * @param size the new maximum stack size + */ + void setMaxStackSize(final int size) { + maxStackSize = size; + } + + /** + * Adds a new undoable/redoable operation to the undo/redo stack. + * @param undoOp the new operation to be added to the stack + */ + public void add(final Undoable undoOp) { + undoStack.add(undoOp); + redoStack.clear(); + if (undoStack.size() > maxStackSize) { + undoStack.remove(0); + } + } + + /** + * Returns whether the last operation in the undo stack can be undone. + * @return <code>true</code> if the last operation in the undo stack can be + * undone, <code>false</code> if not + */ + public boolean canUndo() { + return undoStack.size() > 0 && undoStack.get(undoStack.size() - 1).isUndoable(); + + } + + /** + * Returns the name of the last operation in the undo stack. + * @return the name of the last operation in the undo stack + */ + public String getUndoName() { + return canUndo() ? undoStack.get(undoStack.size() - 1).getName() : ""; + } + + /** Undoes the last operation in the undo stack. */ + public void undo() { + if (canUndo()) { + final Undoable op = undoStack.get(undoStack.size() - 1); + undoStack.remove(op); + op.undo(); + redoStack.add(op); + } + } + + /** + * Returns whether the last operation in the redo stack can be redone. + * @return <code>true</code> if the last operation in the redo stack can be + * redone, <code>false</code> if not + */ + public boolean canRedo() { + return redoStack.size() > 0 && redoStack.get(redoStack.size() - 1).isRedoable(); + + } + + /** + * Returns the name of the last operation in the redo stack. + * @return the name of the last operation in the redo stack + */ + public String getRedoName() { + return canRedo() ? redoStack.get(redoStack.size() - 1).getName() : ""; + } + + /** Redoes the last operation in the redo stack. */ + public void redo() { + if (canRedo()) { + final Undoable op = redoStack.get(redoStack.size() - 1); + redoStack.remove(op); + op.redo(); + undoStack.add(op); + } + } + +} // class UndoAndRedo Property changes on: trunk/src/app/net/sf/gridarta/UndoAndRedo.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-10-02 13:12:24
|
Revision: 448 http://svn.sourceforge.net/gridarta/?rev=448&view=rev Author: christianhujer Date: 2006-10-02 06:12:03 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Renamed Undoable to EditOperation. Minor documentation improvement on undo system. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/src/app/net/sf/gridarta/UndoAndRedo.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/EditOperation.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/Undoable.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 12:54:12 UTC (rev 447) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 13:12:03 UTC (rev 448) @@ -53,7 +53,7 @@ import javax.swing.JScrollPane; import javax.swing.JViewport; import net.sf.gridarta.Size2D; -import net.sf.gridarta.Undoable; +import net.sf.gridarta.EditOperation; import net.sf.gridarta.gui.MapView; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -1545,7 +1545,7 @@ } } - public final class CPaintOp implements Undoable { + public final class CPaintOp implements EditOperation { final Rectangle fillRect; Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-10-02 12:54:12 UTC (rev 447) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-10-02 13:12:03 UTC (rev 448) @@ -420,7 +420,7 @@ } // This can be done later, it was unused anyway. - //public static final class CPaintOp implements Undoable { + //public static final class CPaintOp implements EditOperation { // final Rectangle fillRect; // final int[][] aOrigData; Copied: trunk/src/app/net/sf/gridarta/EditOperation.java (from rev 447, trunk/src/app/net/sf/gridarta/Undoable.java) =================================================================== --- trunk/src/app/net/sf/gridarta/EditOperation.java (rev 0) +++ trunk/src/app/net/sf/gridarta/EditOperation.java 2006-10-02 13:12:03 UTC (rev 448) @@ -0,0 +1,68 @@ +/* + * Crossfire 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 net.sf.gridarta; + +/** + * An operation that eventually can be undone or redone. + * Such operations can be registered / recorded by {@link UndoAndRedo}. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @see UndoAndRedo + */ +public interface EditOperation { + + /** + * Returns whether the operation is undoable. + * @return <code>true</code> if the operation is undoable, otherwise <code>false</code>. + */ + boolean isUndoable(); + + /** + * Undoes this operation. + * If this operation is not {@link #isUndoable() undoable}, this operation silently returns without doing anything. + */ + void undo(); + + /** + * Returns whether the operation is redoable. + * @return <code>true</code> if the operation is redoable, otherwise <code>false</code>. + */ + boolean isRedoable(); + + /** + * Redoes this operation. + * If this operation is not {@link #isRedoable() redoable}, this operation silently returns without doing anything. + */ + void redo(); + + /** + * Returns the operations short (about 8 chars max) name. The name is used + * to show the operation in the menuitems and toolbar buttons tooltips. + * @return The name of the operation. + * @todo decide whether it should be a key usable for i18n or the already localized message. + */ + String getName(); + +} // interface EditOperation Property changes on: trunk/src/app/net/sf/gridarta/EditOperation.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/UndoAndRedo.java =================================================================== --- trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 12:54:12 UTC (rev 447) +++ trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 13:12:03 UTC (rev 448) @@ -35,6 +35,7 @@ * Every operation should add itself to the stack using the add() method. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @see EditOperation * @todo transform {@link #undo()} and {@link #redo()} into Actions. */ public final class UndoAndRedo { @@ -43,10 +44,10 @@ private static final Map<MapControl, UndoAndRedo> hashFromLevelToStack = new WeakHashMap<MapControl, UndoAndRedo>(); /** The undo stack. Contains all undoable operations. */ - private final List<Undoable> undoStack = new ArrayList<Undoable>(); + private final List<EditOperation> undoStack = new ArrayList<EditOperation>(); /** The redo stack. Contains all redoable operations. */ - private final List<Undoable> redoStack = new ArrayList<Undoable>(); + private final List<EditOperation> redoStack = new ArrayList<EditOperation>(); /** The maximum size of the stacks. */ private int maxStackSize = 10; @@ -90,7 +91,7 @@ * Adds a new undoable/redoable operation to the undo/redo stack. * @param undoOp the new operation to be added to the stack */ - public void add(final Undoable undoOp) { + public void add(final EditOperation undoOp) { undoStack.add(undoOp); redoStack.clear(); if (undoStack.size() > maxStackSize) { @@ -119,7 +120,7 @@ /** Undoes the last operation in the undo stack. */ public void undo() { if (canUndo()) { - final Undoable op = undoStack.get(undoStack.size() - 1); + final EditOperation op = undoStack.get(undoStack.size() - 1); undoStack.remove(op); op.undo(); redoStack.add(op); @@ -147,7 +148,7 @@ /** Redoes the last operation in the redo stack. */ public void redo() { if (canRedo()) { - final Undoable op = redoStack.get(redoStack.size() - 1); + final EditOperation op = redoStack.get(redoStack.size() - 1); redoStack.remove(op); op.redo(); undoStack.add(op); Deleted: trunk/src/app/net/sf/gridarta/Undoable.java =================================================================== --- trunk/src/app/net/sf/gridarta/Undoable.java 2006-10-02 12:54:12 UTC (rev 447) +++ trunk/src/app/net/sf/gridarta/Undoable.java 2006-10-02 13:12:03 UTC (rev 448) @@ -1,66 +0,0 @@ -/* - * Crossfire 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 net.sf.gridarta; - -/** - * An Operation that eventually can be undone or redone. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public interface Undoable { - - /** - * Returns whether the operation is undoable. - * @return <code>true</code> if the operation is undoable, otherwise <code>false</code>. - */ - boolean isUndoable(); - - /** - * Undoes this operation. - * If this operation is not {@link #isUndoable() undoable}, this operation silently returns without doing anything. - */ - void undo(); - - /** - * Returns whether the operation is redoable. - * @return <code>true</code> if the operation is redoable, otherwise <code>false</code>. - */ - boolean isRedoable(); - - /** - * Redoes this operation. - * If this operation is not {@link #isRedoable() redoable}, this operation silently returns without doing anything. - */ - void redo(); - - /** - * Returns the operations short (about 8 chars max) name. The name is used - * to show the operation in the menuitems and toolbar buttons tooltips. - * @return The name of the operation. - * @todo decide whether it should be a key usable for i18n or the already localized message. - */ - String getName(); - -} // interface Undoable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 19:17:10
|
Revision: 455 http://svn.sourceforge.net/gridarta/?rev=455&view=rev Author: christianhujer Date: 2006-10-02 12:16:37 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Reworked undo / redo stuff: * Removed dead menu and toolbar entries from both editors. * Migrated UndoAndRedo to use actions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/action.properties trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/UndoAndRedo.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 19:16:37 UTC (rev 455) @@ -1529,70 +1529,6 @@ } } - /** Invoked when the user wants to undo a change in the current level. */ - void undoWanted() { - if (currentMap != null) { - currentMap.undo(); - } - } - - /** Invoked when the user wants to redo a change in the current level. */ - void redoWanted() { - if (currentMap != null) { - currentMap.redo(); - } - } - - /** - * Returns the name of the undo operation. - * @return name of the undo operation - */ - public String getUndoName() { - if (currentMap != null) { - return currentMap.getUndoName(); - } - - return ""; - } - - /** - * Returns the name of the redo operation. - * @return name of the redo operation - */ - public String getRedoName() { - if (currentMap != null) { - return currentMap.getRedoName(); - } - - return ""; - } - - /** - * Returns whether undo is possible or not. - * @return true if undo is possible, false if not possible - */ - - boolean isUndoPossible() { - if (currentMap != null) { - return currentMap.isUndoPossible(); - } - - return false; - } - - /** - * Returns whether redo is possible or not. - * @return true if redo is possible, false if not possible - */ - - boolean isRedoPossible() { - if (currentMap != null) { - return currentMap.isRedoPossible(); - } - - return false; - } - /** "Clear" was selected from the Edit menu. */ public void clearWanted() { if (currentMap == null || currentMap.getMapView() == null) { Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-02 19:16:37 UTC (rev 455) @@ -145,10 +145,6 @@ private SimpleMenuEntry m_revertPickmap; - private SimpleMenuEntry m_undo; - - private SimpleMenuEntry m_redo; - private SimpleMenuEntry m_clear; private SimpleMenuEntry m_cut; @@ -376,34 +372,6 @@ menuManager.addMenuEntry("main", entry); entry.setMnemonic('E'); - // Undo: - m_undo = new SimpleMenuEntry("Undo"); - m_undo.setIcon(CGUIUtils.getIcon(IGUIConstants.UNDO_SMALLICON)); - m_undo.setMnemonic('U'); - m_undo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK)); - m_undo.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // mainControl.undoWanted(); - } - }); - menuManager.addMenuEntry("main.edit", m_undo); - - // Redo: - m_redo = new SimpleMenuEntry("Redo"); - m_redo.setIcon(CGUIUtils.getIcon(IGUIConstants.REDO_SMALLICON)); - m_redo.setMnemonic('R'); - m_redo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK | Event.SHIFT_MASK)); - m_redo.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // mainControl.redoWanted(); - } - }); - menuManager.addMenuEntry("main.edit", m_redo); - - menuManager.addMenuEntry("main.edit", SimpleMenuEntry.getSeparator()); - // Clear: m_clear = new SimpleMenuEntry("Clear"); m_clear.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); @@ -1282,9 +1250,6 @@ public void refresh() { final boolean isArchLoadComplete = ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_COMPLETE; - m_undo.setEnabled(false); - m_redo.setEnabled(false); - m_spellC.setEnabled(true); //m_scriptMenu.setEnabled(false); //m_analyzeMenu.setEnabled(false); Modified: trunk/crossfire/src/cfeditor/CMainToolbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-10-02 19:16:37 UTC (rev 455) @@ -76,10 +76,6 @@ private JButton m_saveAs; - private JButton m_undo; - - private JButton m_redo; - private JButton m_nextWindow; private JButton m_prevWindow; @@ -202,36 +198,7 @@ addSeparator(); - m_undo = new CFancyButton( - checkLabel("Undo"), - "Undo Operation", - checkIcon(IGUIConstants.UNDO_ICON), - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.undoWanted(); - } - }); - m_undo.setVerticalTextPosition(JButton.BOTTOM); - m_undo.setHorizontalTextPosition(JButton.CENTER); - buttons.addElement(m_undo); - add(m_undo); - m_redo = new CFancyButton( - checkLabel("Redo"), - "Redo Operation", - checkIcon(IGUIConstants.REDO_ICON), - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.redoWanted(); - } - }); - m_redo.setVerticalTextPosition(JButton.BOTTOM); - m_redo.setHorizontalTextPosition(JButton.CENTER); - buttons.addElement(m_redo); - add(m_redo); - - addSeparator(); - m_prevWindow = new CFancyButton( checkLabel("Prev"), "Show Previous Window", @@ -312,11 +279,6 @@ final boolean fLevelEdited = mainControl.isLevelEdited(); m_save.setEnabled(mainControl.isPlainSaveEnabled()); m_saveAs.setEnabled(fLevelEdited); - - m_undo.setEnabled(mainControl.isUndoPossible()); - m_undo.setToolTipText("Undo " + mainControl.getUndoName()); - m_redo.setEnabled(mainControl.isRedoPossible()); - m_redo.setToolTipText("Redo " + mainControl.getRedoName()); } /** Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 19:16:37 UTC (rev 455) @@ -361,54 +361,6 @@ } /** - * Undoes a change in the level. - */ - public void undo() { - UndoAndRedo.getInstance(this).undo(); - } - - /** - * Redoes a change in the level. - */ - public void redo() { - UndoAndRedo.getInstance(this).redo(); - } - - /** - * Return the name of the undo operation. - * @return the name of the undo operation - */ - public String getUndoName() { - return UndoAndRedo.getInstance(this).getUndoName(); - } - - /** - * Return the name of the redo operation. - * @return the name of the redo operation - */ - public String getRedoName() { - return UndoAndRedo.getInstance(this).getRedoName(); - } - - /** - * Return whether undo is possible or not. - * @return <code>true</code> if undo is possible, <code>false</code> if not - * possible - */ - public boolean isUndoPossible() { - return UndoAndRedo.getInstance(this).canUndo(); - } - - /** - * Return whether redo is possible or not. - * @return <code>true</code> if redo is possible, <code>false</code> if not - * possible - */ - public boolean isRedoPossible() { - return UndoAndRedo.getInstance(this).canRedo(); - } - - /** * Repaints the view. */ public void repaint() { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 19:16:37 UTC (rev 455) @@ -1764,62 +1764,6 @@ } } - /** Invoked when the user wants to undo a change in the current level. */ - void undo() { - if (currentMap != null) { - currentMap.undo(); - } - } - - /** Invoked when the user wants to redo a change in the current level. */ - void redo() { - if (currentMap != null) { - currentMap.redo(); - } - } - - /** - * Returns the name of the undo operation. - * @return name of the undo operation - */ - public String getUndoName() { - return currentMap != null ? currentMap.getUndoName() : null; - } - - /** - * Returns the name of the redo operation. - * @return name of the redo operation - */ - public String getRedoName() { - return currentMap != null ? currentMap.getRedoName() : null; - } - - /** - * Returns whether undo is possible or not. - * @return true if undo is possible, false if not possible - */ - - boolean isUndoPossible() { - if (currentMap != null) { - return currentMap.isUndoPossible(); - } - - return false; - } - - /** - * Returns whether redo is possible or not. - * @return true if redo is possible, false if not possible - */ - - boolean isRedoPossible() { - if (currentMap != null) { - return currentMap.isRedoPossible(); - } - - return false; - } - /** "Clear" was selected from the Edit menu. */ public void clear() { if (currentMap == null || currentMap.getMapViewFrame() == null) { Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-10-02 19:16:37 UTC (rev 455) @@ -443,7 +443,6 @@ mapArchPanel.refresh(); statusBar.refresh(); - refresh2(); refresh3(); } @@ -792,19 +791,6 @@ private final Action aCloseAll = ACTION_FACTORY.createAction(true, "closeAll", mainControl); /** - * Refresh actions from toolbar. - * @todo remove me - */ - private void refresh2() { - //aSave.setEnabled(mainControl.isPlainSaveEnabled()); - //aSaveAs.setEnabled(mainControl.isLevelEdited()); - aUndo.setEnabled(mainControl.isUndoPossible()); - //aUndo.setToolTipText( "Undo " + mainControl.getUndoName() ); - aRedo.setEnabled(mainControl.isRedoPossible()); - //aRedo.setToolTipText( "Redo " + mainControl.getRedoName() ); - } - - /** * Refresh actions from menu. * @todo remove me */ Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/daimonin/src/daieditor/action.properties 2006-10-02 19:16:37 UTC (rev 455) @@ -9,7 +9,7 @@ # Menus main.menubar=file edit map cursor pickmaps resources tools view window help file.menu=createNew open recent close closeAll - save saveAs revert createImg - options - exit -edit.menu=undo redo - clear cut copy paste - replace fillAbove fillBelow randFillAbove randFillBelow - selectAll +edit.menu=clear cut copy paste - replace fillAbove fillBelow randFillAbove randFillBelow - selectAll map.menu=enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties cursor.menu=moveCursor - selectTile startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes @@ -36,7 +36,7 @@ ########## # ToolBars -main.toolbar=createNew open save saveAs - undo redo - prevWindow nextWindow +main.toolbar=createNew open save saveAs - prevWindow nextWindow mapTileRevert.icon=general/Undo16 mapTileClear.icon=general/Remove16 Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-10-02 19:16:37 UTC (rev 455) @@ -237,20 +237,6 @@ } /** - * Undoes a change in the level. - */ - public void undo() { - UndoAndRedo.getInstance(this).undo(); - } - - /** - * Redoes a change in the level. - */ - public void redo() { - UndoAndRedo.getInstance(this).redo(); - } - - /** * Selects all. */ public void selectAll() { @@ -258,40 +244,6 @@ } /** - * Return the name of the undo operation. - * @return the name of the undo operation - */ - public String getUndoName() { - return UndoAndRedo.getInstance(this).getUndoName(); - } - - /** - * Return the name of the redo operation. - * @return the name of the redo operation - */ - public String getRedoName() { - return UndoAndRedo.getInstance(this).getRedoName(); - } - - /** - * Return whether undo is possible or not. - * @return <code>true</code> if undo is possible, <code>false</code> if not - * possible - */ - public boolean isUndoPossible() { - return UndoAndRedo.getInstance(this).canUndo(); - } - - /** - * Return whether redo is possible or not. - * @return <code>true</code> if redo is possible, <code>false</code> if not - * possible - */ - public boolean isRedoPossible() { - return UndoAndRedo.getInstance(this).canRedo(); - } - - /** * Repaints the view. */ public void repaint() { Modified: trunk/src/app/net/sf/gridarta/UndoAndRedo.java =================================================================== --- trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 19:16:37 UTC (rev 455) @@ -29,46 +29,42 @@ import java.util.Map; import java.util.WeakHashMap; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.gui.map.MapSelectionListener; +import net.sf.gridarta.gui.map.MapSelectionEvent; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; +import javax.swing.Action; /** - * The undo/redo stack that is used when undoing/redoing operations. + * The undoAction/redo stack that is used when undoing/redoing operations. * Every operation should add itself to the stack using the add() method. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @see EditOperation * @todo transform {@link #undo()} and {@link #redo()} into Actions. */ -public final class UndoAndRedo { +public final class UndoAndRedo implements MapSelectionListener { - /** The shared hashtable that maps levels to undo stacks. */ - private static final Map<MapControl, UndoAndRedo> hashFromLevelToStack = new WeakHashMap<MapControl, UndoAndRedo>(); + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - /** The undo stack. Contains all undoable operations. */ - private final List<EditOperation> undoStack = new ArrayList<EditOperation>(); + /** The undoAction and redo operations stored for each map. */ + private final Map<MapControl, UndoRedoStack> undoAndRedoOperations = new WeakHashMap<MapControl, UndoRedoStack>(); - /** The redo stack. Contains all redoable operations. */ - private final List<EditOperation> redoStack = new ArrayList<EditOperation>(); + /** The current undoAction and redo stack. */ + @NotNull private UndoRedoStack currentStack; /** The maximum size of the stacks. */ private int maxStackSize = 10; - /** - * Returns the undo stack for the given level controller. - * @param mapControl the level whose undo/redo stack is to be returned - * @return the undo/redo stack for the given level - */ - public static UndoAndRedo getInstance(final MapControl mapControl) { - if (hashFromLevelToStack.containsKey(mapControl)) { - return hashFromLevelToStack.get(mapControl); - } + /** The Action for undoAction. */ + private final Action undoAction = ACTION_FACTORY.createAction(false, "undo", this); - final UndoAndRedo instance = new UndoAndRedo(); - hashFromLevelToStack.put(mapControl, instance); - return instance; - } + /** The Action for undoAction. */ + private final Action redoAction = ACTION_FACTORY.createAction(false, "redo", this); - /** Constructs an undo/redo stack. */ - private UndoAndRedo() { + /** Constructs an undoAction/redo stack. */ + public UndoAndRedo() { } /** @@ -88,42 +84,42 @@ } /** - * Adds a new undoable/redoable operation to the undo/redo stack. + * Adds a new undoable/redoable operation to the undoAction/redo stack. * @param undoOp the new operation to be added to the stack */ public void add(final EditOperation undoOp) { - undoStack.add(undoOp); - redoStack.clear(); - if (undoStack.size() > maxStackSize) { - undoStack.remove(0); + currentStack.undoStack.add(undoOp); + currentStack.redoStack.clear(); + if (currentStack.undoStack.size() > maxStackSize) { + currentStack.undoStack.remove(0); } } /** - * Returns whether the last operation in the undo stack can be undone. - * @return <code>true</code> if the last operation in the undo stack can be + * Returns whether the last operation in the undoAction stack can be undone. + * @return <code>true</code> if the last operation in the undoAction stack can be * undone, <code>false</code> if not */ public boolean canUndo() { - return undoStack.size() > 0 && undoStack.get(undoStack.size() - 1).isUndoable(); + return currentStack.undoStack.size() > 0 && currentStack.undoStack.get(currentStack.undoStack.size() - 1).isUndoable(); } /** - * Returns the name of the last operation in the undo stack. - * @return the name of the last operation in the undo stack + * Returns the name of the last operation in the undoAction stack. + * @return the name of the last operation in the undoAction stack */ public String getUndoName() { - return canUndo() ? undoStack.get(undoStack.size() - 1).getName() : ""; + return canUndo() ? currentStack.undoStack.get(currentStack.undoStack.size() - 1).getName() : ""; } - /** Undoes the last operation in the undo stack. */ + /** Undoes the last operation in the undoAction stack. */ public void undo() { if (canUndo()) { - final EditOperation op = undoStack.get(undoStack.size() - 1); - undoStack.remove(op); + final EditOperation op = currentStack.undoStack.get(currentStack.undoStack.size() - 1); + currentStack.undoStack.remove(op); op.undo(); - redoStack.add(op); + currentStack.redoStack.add(op); } } @@ -133,7 +129,7 @@ * redone, <code>false</code> if not */ public boolean canRedo() { - return redoStack.size() > 0 && redoStack.get(redoStack.size() - 1).isRedoable(); + return currentStack.redoStack.size() > 0 && currentStack.redoStack.get(currentStack.redoStack.size() - 1).isRedoable(); } @@ -142,17 +138,71 @@ * @return the name of the last operation in the redo stack */ public String getRedoName() { - return canRedo() ? redoStack.get(redoStack.size() - 1).getName() : ""; + return canRedo() ? currentStack.redoStack.get(currentStack.redoStack.size() - 1).getName() : ""; } /** Redoes the last operation in the redo stack. */ public void redo() { if (canRedo()) { - final EditOperation op = redoStack.get(redoStack.size() - 1); - redoStack.remove(op); + final EditOperation op = currentStack.redoStack.get(currentStack.redoStack.size() - 1); + currentStack.redoStack.remove(op); op.redo(); - undoStack.add(op); + currentStack.undoStack.add(op); } } + /** {@inheritDoc} */ + public void mapSelectionChanged(@NotNull final MapSelectionEvent e) { + setCurrentMapControl(e.getNewMap()); + } + + /** + * Sets the MapControl for which the current Actions should be displayed. + * @param mapControl MapControl to display actions for + */ + private void setCurrentMapControl(@NotNull final MapControl mapControl) { + UndoRedoStack newStack = undoAndRedoOperations.get(mapControl); + if (newStack == null) { + newStack = new UndoRedoStack(); + undoAndRedoOperations.put(mapControl, newStack); + } + currentStack = newStack; + updateActions(); + } + + /** + * Updates the actions. + */ + private void updateActions() { + undoAction.setEnabled(canUndo()); + redoAction.setEnabled(canRedo()); + } + + /** + * Returns the Action for undoing an edit operation. + * @return The Action for undoing an edit operation. + */ + @NotNull public Action getUndoAction() { + return undoAction; + } + + /** + * Returns the Action for redoing an edit operation. + * @return The Action for redoing an edit operation. + */ + @NotNull public Action getRedoAction() { + return redoAction; + } + + /** The Undo / Redo Stack. */ + private static final class UndoRedoStack { + + /** The undoAction stack. Contains all undoable operations. */ + private final List<EditOperation> undoStack = new ArrayList<EditOperation>(); + + /** The redo stack. Contains all redoable operations. */ + private final List<EditOperation> redoStack = new ArrayList<EditOperation>(); + + } // class UndoRedoStack + } // class UndoAndRedo Added: trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java 2006-10-02 19:16:37 UTC (rev 455) @@ -0,0 +1,60 @@ +package net.sf.gridarta.gui.map; + +import java.util.EventObject; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.map.MapControl; +import org.jetbrains.annotations.NotNull; + +/** + * Event describing a MapSelection. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @see MapSelectionListener + * @note currently the source is a {@link MainControl}. This is subject of change. + */ +public class MapSelectionEvent extends EventObject { + + /** The MapControl of the map that got deselected. */ + @NotNull private final MapControl oldMap; + + /** The MapControl of the map that got selected. */ + @NotNull private final MapControl newMap; + + /** + * Constructs a MapSelectionEvent. + * + * @param source The MainControl on which the Event initially occurred. + * @param oldMap MapControl of the map that got deselected. + * @param newMap MapControl of the map that got selected. + * + * @throws IllegalArgumentException if source is null. + */ + public MapSelectionEvent(@NotNull final MainControl source, @NotNull final MapControl oldMap, @NotNull final MapControl newMap) { + super(source); + this.oldMap = oldMap; + this.newMap = newMap; + } + + /** + * Returns the MapControl of the map that got deselected. + * @return The MapControl of the map that got deselected. + * @see #getNewMap() + */ + @NotNull public MapControl getOldMap() { + return oldMap; + } + + /** + * Returns the MapControl of the map that got selected. + * @return The MapControl of the map that got selected. + * @see #getOldMap() + */ + @NotNull public MapControl getNewMap() { + return newMap; + } + + /** {@inheritDoc} */ + @Override @NotNull public MainControl getSource() { + return (MainControl) super.getSource(); + } + +} // class MapSelectionEvent Property changes on: trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java 2006-10-02 19:16:37 UTC (rev 455) @@ -0,0 +1,20 @@ +package net.sf.gridarta.gui.map; + +import java.util.EventListener; +import org.jetbrains.annotations.NotNull; + +/** + * Interface for classes that want to be informed in case another map gets selected. + * The selected map is the map that would receive input events and edit operations. + * @note Clarification: This part of the event system is not about selection of squares within a map. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface MapSelectionListener extends EventListener { + + /** + * Inform this listener that a different map was selected. + * @param e MapSelectionEvent describing the selection of the new map + */ + void mapSelectionChanged(@NotNull MapSelectionEvent e); + +} // interface MapSelectionListener Property changes on: trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.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: <aki...@us...> - 2006-10-03 11:06:38
|
Revision: 456 http://svn.sourceforge.net/gridarta/?rev=456&view=rev Author: akirschbaum Date: 2006-10-03 04:06:27 -0700 (Tue, 03 Oct 2006) Log Message: ----------- Do not crash when a map resize cuts off only a parts of a multi-part object. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-10-02 19:16:37 UTC (rev 455) +++ trunk/crossfire/ChangeLog 2006-10-03 11:06:27 UTC (rev 456) @@ -1,3 +1,8 @@ +2006-10-03 Andreas Kirschbaum + + * Do not crash when a map resize cuts off only a parts of a + multi-part object. + 2006-10-01 Andreas Kirschbaum * Implement "Random Fill" function. Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-10-02 19:16:37 UTC (rev 455) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-10-03 11:06:27 UTC (rev 456) @@ -36,6 +36,7 @@ import cfeditor.gameobject.GameObjectIteratorDeleteGameMapObject; import cfeditor.gameobject.GameObjectIteratorDeleteMapGame; import java.awt.Point; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import net.sf.gridarta.Size2D; @@ -989,6 +990,9 @@ if (newSize.equals(mapSize)) { return; } + + final HashSet<GameObject> objectsToDelete = new HashSet<GameObject>(); + // no other thread may access this mapmodel while resizing synchronized (this) { // first delete all arches in the area that will get cut off @@ -1002,7 +1006,7 @@ final Iterator it = getArchObjectsDeleteMapArch(x, y, false, false); while (it.hasNext()) { final GameObject node = (GameObject) it.next(); - it.remove(); + objectsToDelete.add(node.getHead()); } } } @@ -1018,12 +1022,16 @@ final Iterator it = getArchObjectsDeleteMapArch(x, y, false, false); while (it.hasNext()) { final GameObject node = (GameObject) it.next(); - it.remove(); + objectsToDelete.add(node.getHead()); } } } } + for (final GameObject node : objectsToDelete) { + deleteMapArch(node.getMyID(), new Point(node.getMapX(), node.getMapY()), false, false); + } + // Now the critical step: create an GameObject array of new dimension, // copy all objects and set it to replace the current one. final GameObject[][] newGrid = new GameObject[newSize.getWidth()][newSize.getHeight()]; Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-10-02 19:16:37 UTC (rev 455) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-10-03 11:06:27 UTC (rev 456) @@ -33,6 +33,7 @@ import java.awt.Point; import java.awt.Toolkit; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; @@ -474,6 +475,9 @@ if (newSize.equals(mapSize)) { return; } + + final HashSet<GameObject> objectsToDelete = new HashSet<GameObject>(); + // no other thread may access this mapmodel while resizing synchronized (syncLock) { // first delete all arches in the area that will get cut off @@ -485,7 +489,7 @@ for (int y = 0; y < mapSize.getHeight(); y++) { // for every map square: delete all arches on it for (final GameObject node : mapGrid[x][y]) { - deleteMapArch(node, false); // delete previous one + objectsToDelete.add(node.getHead()); } } } @@ -499,12 +503,16 @@ for (int x = 0; x < mapSize.getWidth(); x++) { // for every map square: delete all arches on it for (final GameObject node : mapGrid[x][y]) { - deleteMapArch(node, false); // delete previous one + objectsToDelete.add(node.getHead()); } } } } + for (final GameObject node : objectsToDelete) { + deleteMapArch(node, false); + } + // Now the critical step: create an GameObject array of new dimension, // copy all objects and set it to replace the current one. final MapSquare[][] newGrid = new MapSquare[newSize.getWidth()][newSize.getHeight()]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-03 12:35:30
|
Revision: 459 http://svn.sourceforge.net/gridarta/?rev=459&view=rev Author: christianhujer Date: 2006-10-03 05:35:02 -0700 (Tue, 03 Oct 2006) Log Message: ----------- Removed font-related features. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainStatusbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/MainControl.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-10-03 12:35:02 UTC (rev 459) @@ -90,12 +90,10 @@ setLayout(new BorderLayout()); tabDesktop = new JTabbedPane(SwingConstants.TOP); tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); - mainControl.setBoldFont(tabDesktop); archQuickPanel = new CArchQuickView(mainControl); // archAndPickPane is the panel containing both archpanel and pickmaps archAndPickPane = new JTabbedPane(SwingConstants.TOP); - mainControl.setBoldFont(archAndPickPane); archAndPickPane.addTab(" Arch List ", tabDesktop); archAndPickPane.addTab(" Pickmaps ", mainControl.getMainView().getPickmapPanel()); // this listener informs the mainview which panel is active: archlist or pickmaps? @@ -236,11 +234,6 @@ repaint(); } - public void updateFont() { - mainControl.setBoldFont(tabDesktop); - refresh(); - } - public static final class PanelNode { public final CArchPanelPan data; Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-10-03 12:35:02 UTC (rev 459) @@ -81,7 +81,6 @@ panelDesktop.setLayout(new BorderLayout()); jbox = new JComboBox(); - this.mainControl.setBoldFont(jbox); model = new DefaultListModel(); theList = new JList(model); @@ -276,7 +275,6 @@ archPanel.setPanelArch(value.toString()); mainControl.setStatusText(" " + value + " "); } - mainControl.setPlainFont(this); setText(arch.getArchetypeName()); if (arch.getFaceFlag()) { Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-10-03 12:35:02 UTC (rev 459) @@ -59,12 +59,6 @@ this.mainControl = mainControl; setLayout(new BorderLayout(1, 1)); - // set font - mainControl.setPlainFont(archArchNameText); - mainControl.setPlainFont(archObjNameText); - mainControl.setPlainFont(archTypeText); - mainControl.setPlainFont(archTileText); - // setup a panel final JPanel panel = new JPanel(); final GridBagLayout gridbag = new GridBagLayout(); Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-03 12:35:02 UTC (rev 459) @@ -300,29 +300,11 @@ * lot more difficult, and probably not very convenient. */ public static void setDefaultBounds() { - final int fontsize; // size of current font - - if (CMainControl.getInstance().getPlainFont() != null) { - fontsize = CMainControl.getInstance().getPlainFont().getSize(); - } else { - fontsize = JFontChooser.getDefaultFont().getSize(); - } - - if (fontsize <= 13) { - // this is for fonts <= 13 (includes default font) - width = 395; - height = 505 + 30; - buttonBarHeight = 40; - inventoryWidth = 95; - chooseBoxHeight = 23; - } else { - // this is for the somewhat bigger fonts (>= 14) - width = 395 + 50; - height = 505 + 100; - buttonBarHeight = 40 + 5; - inventoryWidth = 120; - chooseBoxHeight = 25; - } + width = 395; + height = 505 + 30; + buttonBarHeight = 40; + inventoryWidth = 95; + chooseBoxHeight = 23; } /** @@ -1080,11 +1062,6 @@ } final Style docStyle = summaryTP.getStyle(StyleContext.DEFAULT_STYLE); - if (mainControl.getPlainFont() != null) { - StyleConstants.setFontFamily(docStyle, mainControl.getPlainFont().getFamily()); - StyleConstants.setFontSize(docStyle, mainControl.getPlainFont().getSize()); - //StyleConstants.setBold(docStyle, true); - } StyleConstants.setForeground(docStyle, Color.black); // now loop through all attributes and write out nonzero ones Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-10-03 12:35:02 UTC (rev 459) @@ -415,13 +415,11 @@ /** * Create the documentation to this GameObject-type. * @return the full html-text to be (parsed and) displayed + * @fixme my HTML is broken */ public String createHtmlDocu() { String text = ""; // String containing the whole html text - // there are two possible text sizes: normal and large - final boolean bigFont = CMainControl.getInstance().isBigFont(); - // write header (not displayed) text += "<HTML>\n<HEAD>\n<META NAME=\"CFJavaEditor\" CONTENT=\"tmp\">\n<TITLE>"; text += "Type: " + typeName; @@ -430,24 +428,12 @@ text += "<H1 align=center color=navy>Type: " + typeName + "</H1>\n"; // title if (desc != null && desc.trim().length() > 0) { - text += "<P><H" + (bigFont ? 2 : 3) + " color=navy>Functionality of " + typeName + ":</H" + (bigFont ? 2 : 3) + ">"; - if (bigFont) { - text += "<font size=\"4\">"; - } + text += "<P><H3 color=navy>Functionality of " + typeName + ":</H3>"; text += desc.trim() + "</P>"; - if (bigFont) { - text += "</font>"; - } } if (use != null && use.trim().length() > 0) { - text += "<P><H" + (bigFont ? 2 : 3) + " color=navy>Notes on Usage:</H" + (bigFont ? 2 : 3) + ">"; - if (bigFont) { - text += "<font size=\"4\">"; - } + text += "<P><H3 color=navy>Notes on Usage:</H3>"; text += use.trim() + "</P>"; - if (bigFont) { - text += "</font>"; - } } /* Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-10-03 12:35:02 UTC (rev 459) @@ -130,9 +130,6 @@ // draw thin blue lines connecting the nodes putClientProperty("JTree.lineStyle", "Angled"); - // font - CMainControl.getInstance().setPlainFont(this); - needSecondLink = new Vector<TreasureTreeNode>(); processSecondLinking = false; @@ -198,11 +195,6 @@ return instance; } - /** Update font for the JTree nodes */ - public void updateFont() { - renderer.updateFont(); - } - /** * @return The parent attribute dialog attached to this dialog. * If no attribute dialog is attached, or this dialog is hidden, @@ -910,18 +902,8 @@ final ImageIcon noarch; // icon for unknown arches - Font plain; // plain (editor-)font - - Font bold; // bold (editor-)font - /** Constructor: Load icons and initialize fonts */ public TreasureCellRenderer() { - plain = CMainControl.getInstance().getPlainFont(); - if (plain == null) { - plain = JFontChooser.getDefaultFont(); - } - bold = new Font(plain.getName(), Font.BOLD, plain.getSize()); - // get icons tlistIcon = cfeditor.CGUIUtils.getSysIcon(IGUIConstants.TILE_TREASURE); tlistOneIcon = cfeditor.CGUIUtils.getSysIcon(IGUIConstants.TILE_TREASUREONE); @@ -931,12 +913,6 @@ noarch = cfeditor.CGUIUtils.getSysIcon(IGUIConstants.TILE_NOARCH); } - /** Set current font provided by MainControl */ - public void updateFont() { - plain = CMainControl.getInstance().getPlainFont(); - bold = new Font(plain.getName(), Font.BOLD, plain.getSize()); - } - /** The cell-drawing method. */ @Override public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { // first use the standard renderer to paint it all @@ -944,7 +920,6 @@ final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; - setFont(plain); if (node.isRoot()) { this.setForeground(Color.gray); setIcon(null); @@ -998,18 +973,6 @@ setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); } - // set bold/plain font style - if (node.getParent() == root) { - if (content.getType() != TreasureObj.FOLDER) { - setFont(bold); - } - } else { - // parent is not root - final TreasureTreeNode parent = (TreasureTreeNode) node.getParent(); - if (parent.getTreasureObj().getType() == TreasureObj.FOLDER) { - setFont(bold); - } - } } return this; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-03 12:35:02 UTC (rev 459) @@ -185,11 +185,6 @@ private boolean autoPopupDocu = false; // time for an automated docu popup? - // fonts used - private Font plainFont = null; // the plain font - - private Font boldFont = null; // the bold font - // buffer managing copy data private final CopyBuffer copybuffer = new CopyBuffer(this); @@ -234,27 +229,6 @@ // initialize pickmap panel (needed early during the loading process) final CPickmapPanel pickmappanel = new CPickmapPanel(); - // apply custom font - final String fontDesc = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_FONT); - if (fontDesc != null) { - int fontsize = 0; // fontsize - - try { - // try to parse fontsize - fontsize = Integer.parseInt(fontDesc.substring(fontDesc.indexOf("|") + 1)); - - // okay, now set fonts - newPlainFont(new Font(fontDesc.substring(0, fontDesc.indexOf("|")), Font.PLAIN, fontsize)); - newBoldFont(new Font(fontDesc.substring(0, fontDesc.indexOf("|")), Font.BOLD, fontsize)); - } catch (final NumberFormatException e) { - } - } - - // set default font for all swing components - if (getPlainFont() != null) { - JFontChooser.setUIFont(getPlainFont()); - } - // initialize the script-editor pad ScriptEditControl.init(getMapDefaultFolder(), this); @@ -415,29 +389,6 @@ return copybuffer; } - /** IMPORTANT: plainFont can be null! */ - public Font getPlainFont() { - return plainFont; - } - - /** IMPORTANT: boldFont can be null! */ - public Font getBoldFont() { - return boldFont; - } - - public void newPlainFont(final Font newfont) { - plainFont = newfont; - } - - public void newBoldFont(final Font newfont) { - boldFont = newfont; - } - - public boolean isBigFont() { - return (getPlainFont() == null ? JFontChooser.getDefaultFont().getSize() : - getPlainFont().getSize()) > 13; - } - void setMapAndArchPosition(final int archid, final Point pos) { currentMap.getMapView().setMapAndArchPosition(archid, pos); } @@ -557,14 +508,6 @@ } /** {@inheritDoc} */ - public JComponent setBoldFont(final JComponent comp) { - if (boldFont != null) { - comp.setFont(boldFont); - } - return comp; - } - - /** {@inheritDoc} */ public FileFilter getScriptFileFilter() { return pythonFileFilter; } @@ -574,20 +517,8 @@ return ".py"; } - /** - * set plain font to the given component - * @param comp component - * @return same component from parameter (but now with accurate font) - */ - public JComponent setPlainFont(final JComponent comp) { - if (plainFont != null) { - comp.setFont(plainFont); - } - return comp; - } - public String msgToHtml(final String msg) { - return JFontChooser.msgToHtml(msg, getPlainFont()); + return JFontChooser.msgToHtml(msg, null); } boolean addArchToMap(final String archname, final Point pos, final int intern, final boolean join) { Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-03 12:35:02 UTC (rev 459) @@ -34,7 +34,6 @@ import cfeditor.menu.SimpleMenuEntry; import cfeditor.menu.SimpleMenuLocation; import java.awt.Event; -import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; @@ -163,8 +162,6 @@ private SimpleMenuEntry m_rand_fill_below; - private SimpleMenuEntry m_font; - private CheckBoxMenuEntry se_monster; private CheckBoxMenuEntry se_exit; @@ -500,8 +497,6 @@ UIManager.getCrossPlatformLookAndFeelClassName()); for (int i = 0; i < aInfos.length; i++) { final CheckBoxMenuEntry menuItem = new CheckBoxMenuEntry(aInfos[i].getName()); - //TODO fix this - //mainControl.setBoldFont(menuItem); if (strSelectedLNFName.compareTo(aInfos[i].getClassName()) == 0) { menuItem.setChecked(true); } @@ -513,52 +508,6 @@ menuManager.addMenuEntry("main.view", SimpleMenuEntry.getSeparator()); - // menu: choose font - m_font = new SimpleMenuEntry("Change Font"); - m_font.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // open font-dialog and let user choose new font - final Font newfont = JFontChooser.showDialog(mainControl.getMainView(), "Choose Font", - mainControl.getPlainFont() == null ? mainControl.getMainView().getFont() : mainControl.getPlainFont()); - if (newfont != null && !(newfont.getName().equals(mainControl.getMainView().getFont().getName()) - && newfont.getSize() == mainControl.getMainView().getFont().getSize())) { - // set new font - mainControl.newPlainFont(new Font(newfont.getName(), Font.PLAIN, newfont.getSize())); - mainControl.newBoldFont(new Font(newfont.getName(), Font.BOLD, newfont.getSize())); - - JFontChooser.setUIFont(mainControl.getPlainFont()); - - // update fonts - mainControl.getMainView().updateMapArchPanelFont(); - updateFont(true); - mainControl.getMainView().updateStatusBarFont(); - mainControl.getMainView().updateArchPanelFont(); - CFTreasureListTree.getInstance().updateFont(); - } else { - // update fonts - mainControl.newPlainFont(JFontChooser.getDefaultFont()); - mainControl.newBoldFont(new Font(JFontChooser.getDefaultFont().getFontName(), Font.BOLD, JFontChooser.getDefaultFont().getSize())); - JFontChooser.setUIFont(mainControl.getPlainFont()); - - mainControl.getMainView().updateMapArchPanelFont(); - updateFont(true); - mainControl.getMainView().updateStatusBarFont(); - mainControl.getMainView().updateArchPanelFont(); - CFTreasureListTree.getInstance().updateFont(); - - // revert to default fonts - mainControl.newPlainFont(null); - mainControl.newBoldFont(null); - CSettings.getInstance(IGUIConstants.APP_NAME).clearProperty(CMainControl.USE_FONT); - } - - mainControl.getMainView().refreshMapArchPanel(); - mainControl.getMainView().refreshMapTileList(); - } - }); - menuManager.addMenuEntry("main.view", m_font); - menuManager.addMenuEntry("main.view", SimpleMenuEntry.getSeparator()); se_monster = new CheckBoxMenuEntry("Show Monsters"); @@ -1413,95 +1362,6 @@ rebuildWindowMenu(); } - /** - * Redraws the whole menu with latest custom fonts - * @param do_redraw if true, menu is redrawn at the end - */ - public void updateFont(final boolean do_redraw) { - //mainControl.setBoldFont(menu_file); - //mainControl.setBoldFont(menu_edit); - //mainControl.setBoldFont(menu_view); - //mainControl.setBoldFont(menu_map); - //mainControl.setBoldFont(menu_pickmaps); - //mainControl.setBoldFont(menu_collect); - //mainControl.setBoldFont(menu_analyze); - //mainControl.setBoldFont(menu_script); - mainControl.setBoldFont(menu_help); - mainControl.setBoldFont(menu_window); - - // TODO fix this - /*mainControl.setBoldFont(m_new); - mainControl.setBoldFont(m_open); - mainControl.setBoldFont(m_close); - mainControl.setBoldFont(m_save); - mainControl.setBoldFont(m_saveAs); - mainControl.setBoldFont(m_revert); - mainControl.setBoldFont(m_options); - mainControl.setBoldFont(m_exit);*/ - - /*mainControl.setBoldFont(m_newPickmap); - mainControl.setBoldFont(m_deletePickmap); - mainControl.setBoldFont(m_savePickmap); - m_ontrol.setBoldFont(m_revertPickmap);*/ - - /*mainControl.setBoldFont(m_collectArch); - mainControl.setBoldFont(m_spellC); - mainControl.setBoldFont(m_viewTreasure);*/ - - //mainControl.setBoldFont(m_scriptMenu); - //mainControl.setBoldFont(m_analyzeMenu); - mainControl.setBoldFont(m_helpMenu); - mainControl.setBoldFont(m_aboutMenu); - - /*mainControl.setBoldFont(m_autojoin); - mainControl.setBoldFont(m_gridToggle); - mainControl.setBoldFont(m_properties); - mainControl.setBoldFont(m_enterExit); - mainControl.setBoldFont(m_enterNorth); - mainControl.setBoldFont(m_enterEast); - mainControl.setBoldFont(m_enterSouth); - mainControl.setBoldFont(m_enterWest); - mainControl.setBoldFont(m_enterUpper); - mainControl.setBoldFont(m_enterLower);*/ - - /*mainControl.setBoldFont(m_undo); - mainControl.setBoldFont(m_redo); - mainControl.setBoldFont(m_clear); - mainControl.setBoldFont(m_cut); - mainControl.setBoldFont(m_copy); - mainControl.setBoldFont(m_paste); - mainControl.setBoldFont(m_replace); - mainControl.setBoldFont(m_fill_above); - mainControl.setBoldFont(m_fill_below);*/ - - /*mainControl.setBoldFont(m_font); - mainControl.setBoldFont(se_monster); - mainControl.setBoldFont(se_exit); - mainControl.setBoldFont(se_background); - mainControl.setBoldFont(se_door); - mainControl.setBoldFont(se_wall); - mainControl.setBoldFont(se_equip); - mainControl.setBoldFont(se_treasure); - mainControl.setBoldFont(se_connected); - mainControl.setBoldFont(m_show_all);*/ - - mainControl.setBoldFont(m_newWindow); - mainControl.setBoldFont(m_closeAll); - - if (do_redraw) { - refresh(); - } - } - - /** Notifies that the application is about to exit. */ - void appExitNotify() { - final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - if (mainControl.getPlainFont() != null) { - settings.setProperty(CMainControl.USE_FONT, mainControl.getPlainFont().getName() + "|" - + mainControl.getPlainFont().getSize()); - } - } - public final class CLNFActionListener implements ActionListener { private final String m_strClassName; Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-10-03 12:35:02 UTC (rev 459) @@ -93,7 +93,6 @@ mainPanel.add(infoPanel, BorderLayout.EAST); staticStatusbar = this; - updateFont(); } /** @@ -117,13 +116,6 @@ levelStatus.setText(string != null ? string : " "); } - /** redraw status bar with latest custom fonts */ - public void updateFont() { - mainControl.setBoldFont(status); - mainControl.setBoldFont(memory); - refresh(); - } - /** Refreshes the memory usage info panel. */ void refresh() { final Runtime runtime = Runtime.getRuntime(); Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-10-03 12:35:02 UTC (rev 459) @@ -421,7 +421,6 @@ archPanel.appExitNotify(); mapArchPanel.appExitNotify(); - menu.appExitNotify(); } /** @@ -449,21 +448,6 @@ archPanel.refresh(); } - /** redraw map arch panel with latest custom fonts */ - void updateMapArchPanelFont() { - mapArchPanel.updateFont(true); - } - - /** redraw status bar with latest custom fonts */ - void updateStatusBarFont() { - statusBar.updateFont(); - } - - /** redraw arch panel with latest custom fonts */ - void updateArchPanelFont() { - archPanel.updateFont(); - } - public void setRevertMenuEnabled(final boolean state) { menu.setRevertEnabled(state); } Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-10-03 12:35:02 UTC (rev 459) @@ -508,9 +508,6 @@ c.gridy = 2; gridbag.setConstraints(archTileText, c); archPanel.add(archTileText); - - // apply fonts and refresh - updateFont(true); } /** @@ -544,7 +541,6 @@ scriptPanel.setLayout(new BoxLayout(scriptPanel, BoxLayout.X_AXIS)); eventList = new JList(); - mainControl.setPlainFont(eventList); // create ScrollPane for jlist scrolling final JScrollPane ssa = new JScrollPane(eventList); @@ -618,39 +614,6 @@ } /** - * update the map arch panel to display the custom font - * @param refresh if true, the window is redrawn after setting the fonts - */ - public void updateFont(final boolean refresh) { - mainControl.setPlainFont(archTextArea); - mainControl.setPlainFont(archFaceField); - mainControl.setPlainFont(archNameField); - - mainControl.setBoldFont(panelDesktop); - - mainControl.setPlainFont(archTileText); - archTileText.setForeground(Color.black); - mainControl.setPlainFont(archInvCount); - archInvCount.setForeground(Color.black); - mainControl.setPlainFont(archMapPos); - archMapPos.setForeground(Color.black); - mainControl.setPlainFont(archTypeText); - archTypeText.setForeground(Color.black); - - mainControl.setBoldFont(submitChange); - mainControl.setBoldFont(submitMultiChange); - mainControl.setBoldFont(invChange); - mainControl.setBoldFont(attrWin); - - // doc needs to be set! - - // refresh if desired - if (refresh) { - refresh(); - } - } - - /** * If an arch is selected, the MapArchPanels (bottom right windows) get * updated. * @return the selected arch @@ -784,11 +747,6 @@ archEdit.setEnabled(true); final Style currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { - if (mainControl.getPlainFont() != null) { - StyleConstants.setFontFamily(currentAttributes, mainControl.getPlainFont().getFamily()); - StyleConstants.setFontSize(currentAttributes, mainControl.getPlainFont().getSize()); - } - // blue: the "special" attributes, differ from the default archetype StyleConstants.setForeground(currentAttributes, Color.blue); if (arch.getObjectText() != null) { Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-10-03 12:35:02 UTC (rev 459) @@ -236,11 +236,7 @@ optionPanel.add(scrollPane2); - if (this.mainControl.isBigFont()) { - optionPanel.setPreferredSize(new Dimension(280, 185)); - } else { - optionPanel.setPreferredSize(new Dimension(240, 185)); - } + optionPanel.setPreferredSize(new Dimension(240, 185)); // set constraints c.weightx = 1.0; Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-10-03 12:35:02 UTC (rev 459) @@ -437,8 +437,6 @@ // In the map-tile-window the object names are displayed // next to the icons - mainControl.setPlainFont(this); - if (arch.getObjName() != null && arch.getObjName().length() > 0) { setText(arch.getObjName()); // special name } else { Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-10-03 12:35:02 UTC (rev 459) @@ -191,7 +191,6 @@ line3.add(colonLabel); line3.add(Box.createVerticalStrut(5)); rfArchName.setForeground(Color.black); - mainControl.setPlainFont(rfArchName); line3.add(iconLabel); line3.add(rfArchName); mainPanel.add(line3); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-03 12:35:02 UTC (rev 459) @@ -745,14 +745,6 @@ return strArchDir; } - /** - * {@inheritDoc} - * This implementation does nothing. - */ - public JComponent setBoldFont(final JComponent comp) { - return comp; - } - /** {@inheritDoc} */ public FileFilter getScriptFileFilter() { return luaFileFilter; Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2006-10-03 12:35:02 UTC (rev 459) @@ -1,6 +1,5 @@ package net.sf.gridarta; -import javax.swing.JComponent; import javax.swing.filechooser.FileFilter; /** @@ -24,13 +23,6 @@ String getArchDefaultFolder(); /** - * Set bold font to the given component. - * @param comp component - * @return same component from parameter (but now with accurate font) - */ - JComponent setBoldFont(JComponent comp); - - /** * Get the FileFilter that matches script files of this implementation's server side scripting language. * @return FileFilter that matches script files of this implementation's server side scripting language. * @see #getScriptSuffix() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |