From: <aki...@us...> - 2008-08-15 20:04:31
|
Revision: 4857 http://gridarta.svn.sourceforge.net/gridarta/?rev=4857&view=rev Author: akirschbaum Date: 2008-08-15 20:04:36 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:04:36 UTC (rev 4857) @@ -56,44 +56,6 @@ } /** {@inheritDoc} */ - @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) - public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { - final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); - boolean inAnim = false; - String animName = null; - final StringBuilder animText = new StringBuilder(); - String line2; - int lineNumber; - for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { - final String line = line2.trim(); - if (line.startsWith("#")) { - /* ignore comment lines. */ - } else if (line.startsWith("anim ")) { - if (inAnim) { - throw new AnimationParseException("mina", line, lineNumber); - } - inAnim = true; - animName = line.substring("anim ".length()); - animText.setLength(0); - } else if ("mina".equals(line)) { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } - inAnim = false; - addAnimationObject(animName, animText.toString(), path); - } else { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } - animText.append(line).append('\n'); - } - } - if (inAnim) { - throw new AnimationParseException("mina", null, lineNumber); - } - } - - /** {@inheritDoc} */ public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { } Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:04:36 UTC (rev 4857) @@ -57,44 +57,6 @@ } /** {@inheritDoc} */ - @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) - public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { - final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); - boolean inAnim = false; - String animName = null; - final StringBuilder animText = new StringBuilder(); - String line2; - int lineNumber; - for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { - final String line = line2.trim(); - if (line.startsWith("#")) { - /* ignore comment lines. */ - } else if (line.startsWith("anim ")) { - if (inAnim) { - throw new AnimationParseException("mina", line, lineNumber); - } - inAnim = true; - animName = line.substring("anim ".length()); - animText.setLength(0); - } else if ("mina".equals(line)) { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } - inAnim = false; - addAnimationObject(animName, animText.toString(), path); - } else { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } - animText.append(line).append('\n'); - } - } - if (inAnim) { - throw new AnimationParseException("mina", null, lineNumber); - } - } - - /** {@inheritDoc} */ public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(animTreeFile), IOUtils.MAP_ENCODING)); try { Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:04:36 UTC (rev 4857) @@ -19,6 +19,7 @@ package net.sf.gridarta.gameobject.anim; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -109,4 +110,42 @@ return animMap; } + /** {@inheritDoc} */ + @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) + public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { + final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); + boolean inAnim = false; + String animName = null; + final StringBuilder animText = new StringBuilder(); + String line2; + int lineNumber; + for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { + final String line = line2.trim(); + if (line.startsWith("#")) { + /* ignore comment lines. */ + } else if (line.startsWith("anim ")) { + if (inAnim) { + throw new AnimationParseException("mina", line, lineNumber); + } + inAnim = true; + animName = line.substring("anim ".length()); + animText.setLength(0); + } else if ("mina".equals(line)) { + if (!inAnim) { + throw new AnimationParseException("anim ...", line, lineNumber); + } + inAnim = false; + addAnimationObject(animName, animText.toString(), path); + } else { + if (!inAnim) { + throw new AnimationParseException("anim ...", line, lineNumber); + } + animText.append(line).append('\n'); + } + } + if (inAnim) { + throw new AnimationParseException("mina", null, lineNumber); + } + } + } // class AbstractAnimationObjects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |