[tiled] r611 - in trunk/src/tiled: core io/xml mapeditor/actions view

svn@biggeruniverse.com svn at biggeruniverse.com
Sat Apr 22 10:06:13 PDT 2006


Author: bjorn
Date: 2006-04-22 12:06:12 -0500 (Sat, 22 Apr 2006)
New Revision: 611

Modified:
   trunk/src/tiled/core/TileSet.java
   trunk/src/tiled/io/xml/XMLMapTransformer.java
   trunk/src/tiled/mapeditor/actions/CloneLayerAction.java
   trunk/src/tiled/view/MapView.java
Log:
Restoring Java 1.4 compatibility as pointed out by Adam Turk.

Modified: trunk/src/tiled/core/TileSet.java
===================================================================
--- trunk/src/tiled/core/TileSet.java	2006-04-22 16:27:15 UTC (rev 610)
+++ trunk/src/tiled/core/TileSet.java	2006-04-22 17:06:12 UTC (rev 611)
@@ -75,30 +75,30 @@
         // IOException will propagate upwards when file cannot be found
         tilebmpFile = new File(imgFilename);
         tilebmpFileLastModified = tilebmpFile.lastModified();
-        importTileBitmap(ImageIO.read(tilebmpFile), cutter, createTiles);
+
+        BufferedImage tilebmp = ImageIO.read(tilebmpFile);
+        if (tilebmp == null) {
+            throw new Exception("Failed to load " + tilebmpFile);
+        }
+
+        importTileBitmap(tilebmp, cutter, createTiles);
     }
 
     /**
      * Creates a tileset from a buffered image. Tiles are cut by the passed
      * cutter.
      *
-     * @param tilebmp     the image to be used
-     * @param cutter      != null
+     * @param tilebmp     the image to be used, must not be null
+     * @param cutter      the tile cutter, must not be null
      * @param createTiles set to <code>true</code> to have the function create
      *                    Tiles
-     * @throws Exception
      */
     public void importTileBitmap(BufferedImage tilebmp, TileCutter cutter,
-                                 boolean createTiles) throws Exception
+                                 boolean createTiles)
     {
-        if (tilebmp == null) {
-            throw new Exception("Failed to load " + tilebmpFile);
-        }
+        assert (tilebmp != null);
+        assert (cutter != null);
 
-        if (cutter == null) {
-        	throw new Exception("No cutter!");
-        }
-
         tileDimensions = new Rectangle(cutter.getDimensions());
         tileSetImage = tilebmp;
 

Modified: trunk/src/tiled/io/xml/XMLMapTransformer.java
===================================================================
--- trunk/src/tiled/io/xml/XMLMapTransformer.java	2006-04-22 16:27:15 UTC (rev 610)
+++ trunk/src/tiled/io/xml/XMLMapTransformer.java	2006-04-22 17:06:12 UTC (rev 611)
@@ -353,10 +353,10 @@
                             sourcePath = tilesetBaseDir + imgSource;
                         }
 
-                        logger.info("Importing "+sourcePath+"...");
-                        
+                        logger.info("Importing " + sourcePath + "...");
+
                         BufferedImage tilesetImage = ImageIO.read(new File(sourcePath));
-                        
+
                         if (transStr != null) {
                             // In this case, the tileset image needs special
                             // handling for transparency
@@ -375,7 +375,7 @@
                             img.getGraphics().drawImage(trans, 0, 0, null);
 
                             tilesetImage = img;
-                            
+
                             set.setTransparentColor(color);
                         }
 
@@ -384,7 +384,7 @@
                             !hasTileElements);
 
                         set.setTilesetImageFilename(sourcePath);
-                        
+
                     } else {
                         set.addImage(unmarshalImage(child, tilesetBaseDir),
                                 Integer.parseInt(getAttributeValue(child, "id")));

Modified: trunk/src/tiled/mapeditor/actions/CloneLayerAction.java
===================================================================
--- trunk/src/tiled/mapeditor/actions/CloneLayerAction.java	2006-04-22 16:27:15 UTC (rev 610)
+++ trunk/src/tiled/mapeditor/actions/CloneLayerAction.java	2006-04-22 17:06:12 UTC (rev 611)
@@ -43,7 +43,7 @@
                 MapLayer clone = (MapLayer) currentLayer.clone();
                 String newName = Resources.getString(
                         "action.layer.duplicate.newlayer.name");
-                clone.setName(MessageFormat.format(newName, clone.getName()));
+                clone.setName(MessageFormat.format(newName, new Object[]{clone.getName()}));
                 currentMap.addLayer(clone);
             } catch (CloneNotSupportedException ex) {
                 ex.printStackTrace();

Modified: trunk/src/tiled/view/MapView.java
===================================================================
--- trunk/src/tiled/view/MapView.java	2006-04-22 16:27:15 UTC (rev 610)
+++ trunk/src/tiled/view/MapView.java	2006-04-22 17:06:12 UTC (rev 611)
@@ -203,7 +203,7 @@
      * layers.
      *
      * @param g the Graphics2D object to paint to
-     * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
+     * @see javax.swing.JComponent#paintComponent(Graphics)
      * @see MapLayer
      * @see SelectionLayer
      */
@@ -292,7 +292,7 @@
     	Iterator li = m.getLayers();
     	MapLayer layer;
     	double currentZoom = zoom;
-    	
+
     	while (li.hasNext()) {
             if ((layer = (MapLayer)li.next()) != null) {
                 float opacity = layer.getOpacity() * mapOpacity;
@@ -313,7 +313,7 @@
             }
         }
     }
-    
+
     /**
      * Draws a TileLayer. Implemented in a subclass.
      *




More information about the tiled-commit mailing list