From: <chr...@us...> - 2006-12-17 15:22:54
|
Revision: 1143 http://svn.sourceforge.net/gridarta/?rev=1143&view=rev Author: christianhujer Date: 2006-12-17 07:22:49 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Some unification. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-17 15:16:42 UTC (rev 1142) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-17 15:22:49 UTC (rev 1143) @@ -201,12 +201,10 @@ archetype = this.gameObject.getArchetype(); // check if the type of the object is present in the definitions - CFArchType tmp = archTypeList.getHead().getNext(); //typeNr = 0; // for invalid types, we take "type 0" - type = tmp; boolean typeFound = false; int i = 0; - for (; tmp != null; tmp = tmp.getNext()) { + for (final CFArchType tmp : archTypeList) { if (tmp.getTypeNr() == this.gameObject.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers @@ -254,6 +252,9 @@ } i++; } + if (!typeFound) { + type = archTypeList.getArchType(0); + } // get the type data //type = archTypeList.getType(typeNr); @@ -309,9 +310,9 @@ final String[] namelist = new String[archTypeList.getLength()]; // list of typenames // read all type names - CFArchType tmp = archTypeList.getHead().getNext(); - for (int i = 0; tmp != null; tmp = tmp.getNext(), i++) { - namelist[i] = " " + tmp.getTypeName(); + int i = 0; + for (final CFArchType tmp : archTypeList) { + namelist[i++] = " " + tmp.getTypeName(); } // the active type appears selected in the box Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-17 15:16:42 UTC (rev 1142) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-17 15:22:49 UTC (rev 1143) @@ -341,6 +341,10 @@ return archTypeList.iterator(); } + public CFArchType getArchType(final int n) { + return archTypeList.get(n); + } + /** * Lookup the name of an archtype. * @param typeNr type number Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-17 15:16:42 UTC (rev 1142) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-17 15:22:49 UTC (rev 1143) @@ -83,9 +83,9 @@ /* Build Panel */ CArchPanelPan(final CArchPanel controlPanel, final CMainControl mainControl) { + super(new BorderLayout()); this.mainControl = mainControl; archPanel = controlPanel; - setLayout(new BorderLayout()); panelDesktop = new JPanel(); panelDesktop.setLayout(new BorderLayout()); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-17 15:16:42 UTC (rev 1142) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-17 15:22:49 UTC (rev 1143) @@ -605,7 +605,7 @@ final String trueVal = attrib.getMisc()[0]; if (trueVal.equals("0")) { final String attrString = gameObject.getAttributeString(nameOld); - input = new JCheckBox(attrib.getNameNew(), attrString.length() == 0 || "0".equals(attrString)); + input = new JCheckBox(attrib.getNameNew(), attrString.length() == 0 || attrString.equals("0")); } else { input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeString(nameOld).equals(trueVal)); } @@ -672,7 +672,7 @@ case FACENAME: case ANIMNAME: { final String dtxt; - if ("name".equalsIgnoreCase(nameOld)) { + if (nameOld.equalsIgnoreCase("name")) { if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { dtxt = gameObject.getObjName(); } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { @@ -680,7 +680,7 @@ } else { dtxt = archetype.getArchetypeName(); } - } else if ("face".equalsIgnoreCase(nameOld)) { + } else if (nameOld.equalsIgnoreCase("face")) { if (gameObject.getFaceRealName() != null && gameObject.getFaceRealName().length() > 0) { dtxt = gameObject.getFaceRealName(); } else { @@ -810,7 +810,7 @@ newAttr = new DialogAttrib<JTextField>(attrib); // textfield (no direct input, text is set by the treasurelist dialog) String treasureName = gameObject.getAttributeString(nameOld); - if (treasureName.trim().length() == 0 || "none".equalsIgnoreCase(treasureName.trim())) { + if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; } final JTextField input = new JTextField(" " + treasureName, TEXTFIELD_COLUMNS); @@ -1138,7 +1138,7 @@ final String inline = ((DialogAttrib<JTextField>) attr).input.getText().trim(); if (inline != null) { - if ("name".equalsIgnoreCase(attr.ref.getNameOld())) { + if (attr.ref.getNameOld().equalsIgnoreCase("name")) { // special case #1: "name"-textfield if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { if (!inline.equals(archetype.getObjName())) { @@ -1177,7 +1177,7 @@ break; case TEXT: { // a String attribute - if ("msg".equalsIgnoreCase(attr.ref.getNameOld()) && ((DialogAttrib<JTextArea>) attr).input.getText().trim().length() > 0) { + if (attr.ref.getNameOld().equalsIgnoreCase("msg") && ((DialogAttrib<JTextArea>) attr).input.getText().trim().length() > 0) { newMsg = ((DialogAttrib<JTextArea>) attr).input.getText().trim(); } } @@ -1248,7 +1248,7 @@ if (!isNone && !CFTreasureListTree.containsTreasureList(inline) && !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld()))) { // The user has specified a WRONG treasurelist name, and it does not come // from the default gameObject. -> Error and out. - showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "\'" + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); + showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "'" + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |