flood fill room discovery

This commit is contained in:
ondra
2014-04-28 14:05:47 +02:00
parent c5374f5f6e
commit 7f7b58733d
11 changed files with 108 additions and 52 deletions
+31 -16
View File
@@ -2,26 +2,26 @@ package mightypork.rogue.world;
public class Sides {
//@formatter:off
public static final byte NW = (byte) 0b10000000;
public static final byte N = 0b01000000;
public static final byte N = 0b01000000;
public static final byte NE = 0b00100000;
public static final byte E = 0b00010000;
public static final byte E = 0b00010000;
public static final byte SE = 0b00001000;
public static final byte S = 0b00000100;
public static final byte S = 0b00000100;
public static final byte SW = 0b00000010;
public static final byte W = 0b00000001;
public static final byte W = 0b00000001;
public static final byte CARDINAL = N|S|E|W;
public static final byte DIAGONAL = NE|NW|SE|SW;
public static final byte CARDINAL = N | S | E | W;
public static final byte DIAGONAL = NE | NW | SE | SW;
public static final byte NW_CORNER = W|NW|N;
public static final byte NE_CORNER = E|NE|N;
public static final byte SW_CORNER = W|SW|S;
public static final byte SE_CORNER = E|SE|S;
public static final byte NW_CORNER = W | NW | N;
public static final byte NE_CORNER = E | NE | N;
public static final byte SW_CORNER = W | SW | S;
public static final byte SE_CORNER = E | SE | S;
private final static Coord[] side = {
//@formatter:off
public final static Coord[] allSides = {
Coord.make(-1, -1),
Coord.make(0, -1),
Coord.make(1, -1),
@@ -31,13 +31,28 @@ public class Sides {
Coord.make(-1, 1),
Coord.make(-1, 0)
};
public final static Coord[] cardinalSides = {
Coord.make(0, -1),
Coord.make(1, 0),
Coord.make(0, 1),
Coord.make(-1, 0)
};
//@formatter:on
/**
* Get element from all sides
*
* @param i side index
* @return the side coord
*/
public static Coord get(int i)
{
return side[i]; // FIXME Coord is mutable
return allSides[i]; // FIXME Coord is mutable
}
public static byte bit(int i)
{
return (byte) (1 << (7 - i));