public class CfMapPatch
extends java.lang.Object
CfMapSquares
.Modifier and Type | Field and Description |
---|---|
static int |
SIZE
Size of patches in x- and y-direction.
|
static int |
SIZE_LOG
Log2 of
SIZE . |
Constructor and Description |
---|
CfMapPatch(@NotNull CfMap map,
int x0,
int y0)
Creates a new (empty) patch.
|
Modifier and Type | Method and Description |
---|---|
void |
clearSquare(int x,
int y)
Clears the content of one square.
|
void |
dirty(int x,
int y)
Marks a square as dirty.
|
int |
getColor(int x,
int y)
Determines the magic map color value of one square.
|
int |
getDarkness(int x,
int y)
Determines the darkness value of one square.
|
@Nullable Face |
getFace(int x,
int y,
int layer)
Determines the face of one square.
|
@Nullable CfMapSquare |
getHeadMapSquare(int x,
int y,
int layer)
Returns the map square of the head of a multi-square object.
|
int |
getSmooth(int x,
int y,
int layer)
Determines the smooth value of one square.
|
@NotNull CfMapSquare |
getSquare(int x,
int y)
Returns one map square.
|
boolean |
isFogOfWar(int x,
int y)
Determines if a square is not up-to-date.
|
boolean |
resetFogOfWar(int x,
int y)
Returns and reset the "fog-of-war" flag of a square.
|
void |
setColor(int x,
int y,
int color)
Sets the magic map color of one square.
|
boolean |
setDarkness(int x,
int y,
int darkness)
Sets the darkness value of one square.
|
void |
setHeadMapSquare(int x,
int y,
int layer,
@Nullable CfMapSquare mapSquare,
boolean setAlways)
Sets the map square containing the head face for a layer.
|
int |
setSmooth(int x,
int y,
int layer,
int smooth)
Sets the smooth value of one square.
|
public static final int SIZE_LOG
SIZE
.public static final int SIZE
public CfMapPatch(@NotNull @NotNull CfMap map, int x0, int y0)
map
- the map this map patch is part ofx0
- the absolute map x-coordinate of the top left corner of this
patchy0
- the absolute map y-coordinate of the top left corner of this
patchpublic void dirty(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarepublic void clearSquare(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarepublic boolean setDarkness(int x, int y, int darkness)
x
- the x-coordinate of the squarey
- the y-coordinate of the squaredarkness
- the darkness value to set; 0=dark, 255=full brightpublic int getDarkness(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarepublic int setSmooth(int x, int y, int layer, int smooth)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer to setsmooth
- the smooth value to setpublic int getSmooth(int x, int y, int layer)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer of the squarepublic void setColor(int x, int y, int color)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarecolor
- the color to setpublic int getColor(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the square@Nullable public @Nullable Face getFace(int x, int y, int layer)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer of the facenull
public void setHeadMapSquare(int x, int y, int layer, @Nullable @Nullable CfMapSquare mapSquare, boolean setAlways)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer for the new head face between 0
and
LAYERS-1
mapSquare
- the map square containing the head face; may be
null
setAlways
- if set, always update the face; if unset, only update
when fog-of-war@Nullable public @Nullable CfMapSquare getHeadMapSquare(int x, int y, int layer)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer to return the head fornull
if this square does not
contain a multi-tailpublic boolean isFogOfWar(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarepublic boolean resetFogOfWar(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the square@NotNull public @NotNull CfMapSquare getSquare(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the square