Crossfire JXClient, Trunk
R20561
|
Represents a square in a CfMap. More...
Public Member Functions | |
CfMapSquare (@NotNull final CfMap map, final int x, final int y) | |
Creates a new (empty) square. More... | |
void | clear () |
Marks this square as 'fog-og-war'. More... | |
void | dirty () |
Marks this square as dirty, i.e., needing redraw. More... | |
int | getColor () |
Returns the magic map color of this square. More... | |
int | getDarkness () |
Returns the darkness value of this square. More... | |
Face | getFace (final int layer) |
Returns the face of a layer. More... | |
CfMapSquare | getHeadMapSquare (final int layer) |
Returns the map square of the head of a multi-square object. More... | |
int | getSmooth (final int layer) |
Returns the smooth value of this square. More... | |
int | getX () |
Returns the absolute map x-coordinate of this square. More... | |
int | getY () |
Returns the absolute map y-coordinate of this square. More... | |
boolean | isFogOfWar () |
Determines if the square is not up-to-date. More... | |
boolean | resetFogOfWar () |
Returns and resets the "fog-of-war" flag. More... | |
boolean | setColor (final int color) |
Sets the magic map color of this square. More... | |
boolean | setDarkness (final int darkness) |
Sets the darkness value of this square. More... | |
void | setFace (final int layer, @Nullable final Face face) |
Sets the face of a layer. More... | |
void | setHeadMapSquare (final int layer, @Nullable final CfMapSquare mapSquare, final boolean setAlways) |
Sets the map square containing the head face for a layer. More... | |
int | setSmooth (final int layer, final int smooth) |
Sets the smooth value of this square. More... | |
String | toString () |
Static Public Attributes | |
static final int | DARKNESS_FULL_BRIGHT = 255 |
The darkness value for a full bright square. More... | |
static final int | DEFAULT_COLOR = -1 |
The default magic map color for newly created squares. More... | |
static final int | DEFAULT_DARKNESS = 255 |
The default darkness value for newly created squares. More... | |
static final Face | DEFAULT_FACE = null |
The default face value for newly creates squares. More... | |
static final int | DEFAULT_SMOOTH = 0 |
The default smooth value for newly created squares. More... | |
Private Attributes | |
int | color = DEFAULT_COLOR |
The magic map color of the square. More... | |
int | darkness = DEFAULT_DARKNESS |
The darkness value of the square in the range [0..255]. More... | |
final Face [] | faces = new Face[Map2.NUM_LAYERS] |
The faces (of head-parts) of all layers as sent by the server. More... | |
boolean | fogOfWar |
Flag used to defer clearing the values: when a. More... | |
final CfMapSquare [] | heads = new CfMapSquare[Map2.NUM_LAYERS] |
If this square contains a non-head part of a multi-square object this points to the head square. More... | |
final CfMap | map |
The CfMap this map square is part of. More... | |
final int [] | smooths = new int[Map2.NUM_LAYERS] |
The smooth values of all layers as sent by the server. More... | |
final int | x |
The absolute x-coordinate of this square in its CfMap. More... | |
final int | y |
The absolute y-coordinate of this square in its CfMap. More... | |
Represents a square in a CfMap.
A square comprises of Map2#NUM_LAYERS faces as well as a darkness value.
This class assumes that the "head" part of a face is the part the server did sent. This is the bottom-right part for multi-square objects. Not that this definition is inconsistent to what the server assumes as the head part of an object.
Definition at line 39 of file CfMapSquare.java.
com.realtime.crossfire.jxclient.map.CfMapSquare.CfMapSquare | ( | @NotNull final CfMap | map, |
final int | x, | ||
final int | y | ||
) |
Creates a new (empty) square.
map | the map this map square is part of |
x | the absolute map x-coordinate of the top left corner of this patch |
y | the absolute map y-coordinate of the top left corner of this patch |
Definition at line 128 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.map, com.realtime.crossfire.jxclient.map.CfMapSquare.x, and com.realtime.crossfire.jxclient.map.CfMapSquare.y.
void com.realtime.crossfire.jxclient.map.CfMapSquare.clear | ( | ) |
Marks this square as 'fog-og-war'.
The values will be still returned until a new value will be set.
Definition at line 161 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.dirty().
Referenced by com.realtime.crossfire.jxclient.map.CfMapPatch.clearSquare().
void com.realtime.crossfire.jxclient.map.CfMapSquare.dirty | ( | ) |
Marks this square as dirty, i.e., needing redraw.
Definition at line 153 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMap.squareModified().
Referenced by com.realtime.crossfire.jxclient.map.CfMapSquare.clear(), com.realtime.crossfire.jxclient.map.CfMapPatch.dirty(), com.realtime.crossfire.jxclient.map.CfMapSquare.resetFogOfWar(), com.realtime.crossfire.jxclient.map.CfMapSquare.setColor(), com.realtime.crossfire.jxclient.map.CfMapSquare.setDarkness(), com.realtime.crossfire.jxclient.map.CfMapSquare.setFace(), com.realtime.crossfire.jxclient.map.CfMapSquare.setHeadMapSquare(), and com.realtime.crossfire.jxclient.map.CfMapSquare.setSmooth().
int com.realtime.crossfire.jxclient.map.CfMapSquare.getColor | ( | ) |
Returns the magic map color of this square.
Definition at line 258 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.color.
Referenced by com.realtime.crossfire.jxclient.map.CfMapPatch.getColor().
int com.realtime.crossfire.jxclient.map.CfMapSquare.getDarkness | ( | ) |
Returns the darkness value of this square.
Definition at line 206 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.darkness.
Referenced by com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.commandSentMap(), and com.realtime.crossfire.jxclient.map.CfMapPatch.getDarkness().
Face com.realtime.crossfire.jxclient.map.CfMapSquare.getFace | ( | final int | layer | ) |
Returns the face of a layer.
layer | the layer to return the face |
Definition at line 281 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.commandSentMap(), com.realtime.crossfire.jxclient.map.CfMapPatch.getFace(), com.realtime.crossfire.jxclient.gui.map.SmoothingRenderer.paintSmooth(), com.realtime.crossfire.jxclient.gui.map.AbstractGUIMap.redrawSquare(), com.realtime.crossfire.jxclient.map.CfMap.setFaceInternal(), and com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.toString().
CfMapSquare com.realtime.crossfire.jxclient.map.CfMapSquare.getHeadMapSquare | ( | final int | layer | ) |
Returns the map square of the head of a multi-square object.
layer | the layer to return the head for |
Definition at line 308 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.commandSentMap(), com.realtime.crossfire.jxclient.map.CfMapPatch.getHeadMapSquare(), com.realtime.crossfire.jxclient.gui.map.AbstractGUIMap.redrawSquare(), and com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.toString().
int com.realtime.crossfire.jxclient.map.CfMapSquare.getSmooth | ( | final int | layer | ) |
Returns the smooth value of this square.
layer | the layer between 0 LAYERS-1 |
Definition at line 234 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMapPatch.getSmooth(), and com.realtime.crossfire.jxclient.gui.map.SmoothingRenderer.paintSmooth().
int com.realtime.crossfire.jxclient.map.CfMapSquare.getX | ( | ) |
Returns the absolute map x-coordinate of this square.
Definition at line 138 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.x.
Referenced by com.realtime.crossfire.jxclient.gui.map.AbstractGUIMap.redrawSquare().
int com.realtime.crossfire.jxclient.map.CfMapSquare.getY | ( | ) |
Returns the absolute map y-coordinate of this square.
Definition at line 146 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.y.
Referenced by com.realtime.crossfire.jxclient.gui.map.AbstractGUIMap.redrawSquare().
boolean com.realtime.crossfire.jxclient.map.CfMapSquare.isFogOfWar | ( | ) |
Determines if the square is not up-to-date.
Definition at line 322 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar.
Referenced by com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.commandSentMap(), and com.realtime.crossfire.jxclient.map.CfMapPatch.isFogOfWar().
boolean com.realtime.crossfire.jxclient.map.CfMapSquare.resetFogOfWar | ( | ) |
Returns and resets the "fog-of-war" flag.
Definition at line 330 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.dirty().
Referenced by com.realtime.crossfire.jxclient.map.CfMapPatch.resetFogOfWar().
boolean com.realtime.crossfire.jxclient.map.CfMapSquare.setColor | ( | final int | color | ) |
Sets the magic map color of this square.
color | the new color |
Definition at line 243 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.color, com.realtime.crossfire.jxclient.map.CfMapSquare.dirty(), and com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar.
Referenced by com.realtime.crossfire.jxclient.map.CfMapPatch.setColor().
boolean com.realtime.crossfire.jxclient.map.CfMapSquare.setDarkness | ( | final int | darkness | ) |
Sets the darkness value of this square.
darkness | the new darkness value between 0 255 |
Definition at line 191 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.darkness, com.realtime.crossfire.jxclient.map.CfMapSquare.dirty(), and com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar.
Referenced by com.realtime.crossfire.jxclient.map.CfMapPatch.setDarkness().
void com.realtime.crossfire.jxclient.map.CfMapSquare.setFace | ( | final int | layer, |
@Nullable final Face | face | ||
) |
Sets the face of a layer.
layer | the layer for the new face between 0 LAYERS-1 |
face | the face to set |
Definition at line 268 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.dirty().
Referenced by com.realtime.crossfire.jxclient.map.CfMap.setFaceInternal().
void com.realtime.crossfire.jxclient.map.CfMapSquare.setHeadMapSquare | ( | final int | layer, |
@Nullable final CfMapSquare | mapSquare, | ||
final boolean | setAlways | ||
) |
Sets the map square containing the head face for a layer.
layer | the layer for the new head face between 0 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 |
Definition at line 294 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.dirty().
Referenced by com.realtime.crossfire.jxclient.map.CfMapPatch.setHeadMapSquare().
int com.realtime.crossfire.jxclient.map.CfMapSquare.setSmooth | ( | final int | layer, |
final int | smooth | ||
) |
Sets the smooth value of this square.
layer | the layer between 0 LAYERS-1 |
smooth | the new smooth value |
Definition at line 217 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.dirty(), and com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar.
Referenced by com.realtime.crossfire.jxclient.map.CfMapPatch.setSmooth().
String com.realtime.crossfire.jxclient.map.CfMapSquare.toString | ( | ) |
Definition at line 345 of file CfMapSquare.java.
References com.realtime.crossfire.jxclient.map.CfMapSquare.y.
|
private |
The magic map color of the square.
Set to DEFAULT_COLOR if none is known.
Definition at line 99 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMapSquare.getColor(), and com.realtime.crossfire.jxclient.map.CfMapSquare.setColor().
|
private |
The darkness value of the square in the range [0..255].
0=dark, 255=full bright=DARKNESS_FULL_BRIGHT.
Definition at line 93 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMapSquare.getDarkness(), and com.realtime.crossfire.jxclient.map.CfMapSquare.setDarkness().
|
static |
The darkness value for a full bright square.
Definition at line 59 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.gui.map.DarknessColors.getDarknessColor(), and com.realtime.crossfire.jxclient.gui.map.AbstractGUIMap.redrawSquare().
|
static |
The default magic map color for newly created squares.
Definition at line 54 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMap.getColor().
|
static |
The default darkness value for newly created squares.
Definition at line 44 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMap.getDarkness(), and com.realtime.crossfire.jxclient.map.CfMap.setFace().
|
static |
The default face value for newly creates squares.
Definition at line 65 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.commandSentMap(), com.realtime.crossfire.jxclient.map.CfMap.getFace(), com.realtime.crossfire.jxclient.map.CfMap.setDarkness(), com.realtime.crossfire.jxclient.map.CfMap.setFace(), com.realtime.crossfire.jxclient.map.CfMap.setMagicMap(), and com.realtime.crossfire.jxclient.map.CfMap.setSmooth().
|
static |
The default smooth value for newly created squares.
Definition at line 49 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMap.getSmooth().
|
private |
The faces (of head-parts) of all layers as sent by the server.
Definition at line 105 of file CfMapSquare.java.
|
private |
Flag used to defer clearing the values: when a.
is cleared, the old values remain valid until at least one field is re-set.
Definition at line 87 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMapSquare.isFogOfWar(), com.realtime.crossfire.jxclient.map.CfMapSquare.setColor(), com.realtime.crossfire.jxclient.map.CfMapSquare.setDarkness(), and com.realtime.crossfire.jxclient.map.CfMapSquare.setSmooth().
|
private |
If this square contains a non-head part of a multi-square object this points to the head square.
Definition at line 112 of file CfMapSquare.java.
|
private |
The CfMap this map square is part of.
Definition at line 71 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMapSquare.CfMapSquare().
|
private |
The smooth values of all layers as sent by the server.
Definition at line 118 of file CfMapSquare.java.
|
private |
The absolute x-coordinate of this square in its CfMap.
Definition at line 76 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMapSquare.CfMapSquare(), and com.realtime.crossfire.jxclient.map.CfMapSquare.getX().
|
private |
The absolute y-coordinate of this square in its CfMap.
Definition at line 81 of file CfMapSquare.java.
Referenced by com.realtime.crossfire.jxclient.map.CfMapSquare.CfMapSquare(), com.realtime.crossfire.jxclient.map.CfMapSquare.getY(), and com.realtime.crossfire.jxclient.map.CfMapSquare.toString().