Skip to content

Commit

Permalink
Null tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-short committed Nov 13, 2015
1 parent bca7819 commit 60725a6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/net/buddat/wgenerator/TileMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,10 @@ void importBiomeImage(BufferedImage biomesImage) {
int r = buffer.getElem((x+y*mapSize)*3+2);
int g = buffer.getElem((x+y*mapSize)*3+1);
int b = buffer.getElem((x+y*mapSize)*3+0);
setType(x,y,getTileType(r,g,b));
Tile tileType= getTileType(r,g,b);
if (tileType != null) {
setType(x,y,tileType);
}
}
}

Expand All @@ -487,12 +490,14 @@ public static Tile getTileType(int r, int g, int b) {
if (tile == null) {
continue;
}
Color c = getTileColor(tile);
if (r == c.getRed() && g == c.getGreen() && b == c.getBlue()) {
Color color = getTileColor(tile);
if (color == null) {
continue;
} else if (r == color.getRed() && g == color.getGreen() && b == color.getBlue()) {
return tile;
}
}
return Tile.TILE_DIRT;
return null;
}

public static Color getTileColor(Tile tile) {
Expand Down Expand Up @@ -570,7 +575,7 @@ public static Color getTileColor(Tile tile) {
case TILE_BUSH_THORN:
return new Color(41,58,21);
default:
return new Color(0,0,0);
return null;

}
}
Expand Down

0 comments on commit 60725a6

Please sign in to comment.