Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.map.CfMapSquare Class Reference

Represents a square in a CfMap. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.map.CfMapSquare:

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...
 

Detailed Description

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.

Author
Andreas Kirschbaum

Definition at line 39 of file CfMapSquare.java.

Constructor & Destructor Documentation

◆ CfMapSquare()

com.realtime.crossfire.jxclient.map.CfMapSquare.CfMapSquare ( @NotNull final CfMap  map,
final int  x,
final int  y 
)

Creates a new (empty) square.

Parameters
mapthe map this map square is part of
xthe absolute map x-coordinate of the top left corner of this patch
ythe 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.

Member Function Documentation

◆ clear()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dirty()

◆ getColor()

int com.realtime.crossfire.jxclient.map.CfMapSquare.getColor ( )

Returns the magic map color of this square.

Returns
the color

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().

+ Here is the caller graph for this function:

◆ getDarkness()

int com.realtime.crossfire.jxclient.map.CfMapSquare.getDarkness ( )

Returns the darkness value of this square.

Returns
the darkness value of the square; 0=dark, 255=full bright

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().

+ Here is the caller graph for this function:

◆ getFace()

◆ getHeadMapSquare()

CfMapSquare com.realtime.crossfire.jxclient.map.CfMapSquare.getHeadMapSquare ( final int  layer)

Returns the map square of the head of a multi-square object.

Parameters
layerthe layer to return the head for
Returns
the head map square, or
null
if this square does not contain a multi-tail

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().

+ Here is the caller graph for this function:

◆ getSmooth()

int com.realtime.crossfire.jxclient.map.CfMapSquare.getSmooth ( final int  layer)

Returns the smooth value of this square.

Parameters
layerthe layer between
0
and
LAYERS-1
Returns
the smooth value of the square

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().

+ Here is the caller graph for this function:

◆ getX()

int com.realtime.crossfire.jxclient.map.CfMapSquare.getX ( )

Returns the absolute map x-coordinate of this square.

Returns
the x-coordinate

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().

+ Here is the caller graph for this function:

◆ getY()

int com.realtime.crossfire.jxclient.map.CfMapSquare.getY ( )

Returns the absolute map y-coordinate of this square.

Returns
the y-coordinate

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().

+ Here is the caller graph for this function:

◆ isFogOfWar()

boolean com.realtime.crossfire.jxclient.map.CfMapSquare.isFogOfWar ( )

Determines if the square is not up-to-date.

Returns
whether this square contains fog-of-war data

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().

+ Here is the caller graph for this function:

◆ resetFogOfWar()

boolean com.realtime.crossfire.jxclient.map.CfMapSquare.resetFogOfWar ( )

Returns and resets the "fog-of-war" flag.

Returns
whether this square's fog-of-war state has been reset

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setColor()

boolean com.realtime.crossfire.jxclient.map.CfMapSquare.setColor ( final int  color)

Sets the magic map color of this square.

Parameters
colorthe new color
Returns
whether fog-of-war has been cleared

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDarkness()

boolean com.realtime.crossfire.jxclient.map.CfMapSquare.setDarkness ( final int  darkness)

Sets the darkness value of this square.

Parameters
darknessthe new darkness value between
0
and
255
; 0=dark, 255=full bright
Returns
whether fog-of-war has been cleared

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFace()

void com.realtime.crossfire.jxclient.map.CfMapSquare.setFace ( final int  layer,
@Nullable final Face  face 
)

Sets the face of a layer.

Parameters
layerthe layer for the new face between
0
and
LAYERS-1
facethe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHeadMapSquare()

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.

Parameters
layerthe layer for the new head face between
0
and
LAYERS-1
mapSquarethe map square containing the head face; may be
null
setAlwaysif 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSmooth()

int com.realtime.crossfire.jxclient.map.CfMapSquare.setSmooth ( final int  layer,
final int  smooth 
)

Sets the smooth value of this square.

Parameters
layerthe layer between
0
and
LAYERS-1
smooththe new smooth value
Returns
whether fog-of-war has been cleared (1) or whether the smooth value has changed (2)

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toString()

String com.realtime.crossfire.jxclient.map.CfMapSquare.toString ( )

Member Data Documentation

◆ color

int com.realtime.crossfire.jxclient.map.CfMapSquare.color = DEFAULT_COLOR
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().

◆ darkness

int com.realtime.crossfire.jxclient.map.CfMapSquare.darkness = DEFAULT_DARKNESS
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().

◆ DARKNESS_FULL_BRIGHT

final int com.realtime.crossfire.jxclient.map.CfMapSquare.DARKNESS_FULL_BRIGHT = 255
static

◆ DEFAULT_COLOR

final int com.realtime.crossfire.jxclient.map.CfMapSquare.DEFAULT_COLOR = -1
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().

◆ DEFAULT_DARKNESS

final int com.realtime.crossfire.jxclient.map.CfMapSquare.DEFAULT_DARKNESS = 255
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().

◆ DEFAULT_FACE

◆ DEFAULT_SMOOTH

final int com.realtime.crossfire.jxclient.map.CfMapSquare.DEFAULT_SMOOTH = 0
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().

◆ faces

final Face [] com.realtime.crossfire.jxclient.map.CfMapSquare.faces = new Face[Map2.NUM_LAYERS]
private

The faces (of head-parts) of all layers as sent by the server.

Definition at line 105 of file CfMapSquare.java.

◆ fogOfWar

boolean com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar
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().

◆ heads

final CfMapSquare [] com.realtime.crossfire.jxclient.map.CfMapSquare.heads = new CfMapSquare[Map2.NUM_LAYERS]
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.

◆ map

final CfMap com.realtime.crossfire.jxclient.map.CfMapSquare.map
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().

◆ smooths

final int [] com.realtime.crossfire.jxclient.map.CfMapSquare.smooths = new int[Map2.NUM_LAYERS]
private

The smooth values of all layers as sent by the server.

Definition at line 118 of file CfMapSquare.java.

◆ x

final int com.realtime.crossfire.jxclient.map.CfMapSquare.x
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().

◆ y

final int com.realtime.crossfire.jxclient.map.CfMapSquare.y
private

The documentation for this class was generated from the following file: