From: <aki...@us...> - 2011-12-15 19:22:05
|
Revision: 9116 http://gridarta.svn.sourceforge.net/gridarta/?rev=9116&view=rev Author: akirschbaum Date: 2011-12-15 19:21:58 +0000 (Thu, 15 Dec 2011) Log Message: ----------- Extract code into functions. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-15 19:18:23 UTC (rev 9115) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2011-12-15 19:21:58 UTC (rev 9116) @@ -81,13 +81,21 @@ @Override public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { final FaceProvider faceProvider = super.read(errorView, invObjects); + loadSmoothFaces(errorView); + return faceProvider; + } + + /** + * Loads all smooth faces. + * @param errorView the error view for reporting problems + */ + private void loadSmoothFaces(final ErrorView errorView) { try { final URL url = IOUtils.getResource(configurationDirectory, IGUIConstants.SMOOTH_FILE); SmoothFacesLoader.load(url, smoothFaces, errorView); } catch (final IOException ex) { errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, IGUIConstants.SMOOTH_FILE + ": " + ex.getMessage()); } - return faceProvider; } } // class CollectedResourcesReader Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:18:23 UTC (rev 9115) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java 2011-12-15 19:21:58 UTC (rev 9116) @@ -122,6 +122,16 @@ @Override public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { archetypeSet.setLoadedFromArchive(true); + loadAnimations(errorView); + loadArchetypes(errorView, invObjects); + return faceObjects.loadFacesCollection(errorView, collectedDirectory); + } + + /** + * Loads all animations. + * @param errorView the error view for reporting problems + */ + private void loadAnimations(@NotNull final ErrorView errorView) { Map<String, String> animations = null; try { final URL url = IOUtils.getResource(collectedDirectory, animTreeFile); @@ -134,6 +144,14 @@ errorView.addWarning(ErrorViewCategory.ANIMTREE_FILE_INVALID, animTreeFile + ": " + ex.getMessage()); } loadAnimationsFromCollect(errorView, animations == null ? Collections.<String, String>emptyMap() : animations); + } + + /** + * Loads all archetypes. + * @param errorView the error view for reporting problems + * @param invObjects all read archetypes are added to this list + */ + private void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final List<G> invObjects) { try { final int archetypeCount = archetypeSet.getArchetypeCount(); @@ -165,7 +183,6 @@ } catch (final IOException ex) { errorView.addWarning(ErrorViewCategory.ARCHETYPES_FILE_INVALID, archetypesFile + ": " + ex.getMessage()); } - return faceObjects.loadFacesCollection(errorView, collectedDirectory); } } // class AbstractCollectedResourcesReader This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |