while((ret = tileset.getTile(tileId++)) == null) if(tileId > tileset.getMaxTileId()) break;
while ((ret = tileset.getTile(tileId++)) == null) { if (tileId > tileset.getMaxTileId()) break; }
    public Tile getTileAtPoint(int x, int y) {        Tile ret;        // TODO: This code only works if one and only one tileset is selected        // from the list.        TileSet tileset = (TileSet)tilesets.get(0);        int twidth = tileset.getTileWidth() + 1;        int theight = tileset.getTileHeight() + 1;        int tx = x / twidth;        int ty = y / theight;        int tilesPerRow = (getWidth() - 1) / twidth;        int tileId = ty * tilesPerRow + tx;        //now that we're in the right "spot", find the next valid tile        while((ret = tileset.getTile(tileId++)) == null) if(tileId > tileset.getMaxTileId()) break;        return ret;    }