Crossfire JXClient, Trunk
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
com.realtime.crossfire.jxclient.map.CfMapSquare Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.map.CfMapSquare:
Collaboration graph

Public Member Functions

 CfMapSquare (@NotNull final CfMap map, final int x, final int y)
 
void clear ()
 
void dirty ()
 
int getColor ()
 
int getDarkness ()
 
Face getFace (final int layer)
 
CfMapSquare getHeadMapSquare (final int layer)
 
int getSmooth (final int layer)
 
int getX ()
 
int getY ()
 
boolean isFogOfWar ()
 
boolean resetFogOfWar ()
 
void setColor (final int color)
 
boolean setDarkness (final int darkness)
 
void setFace (final int layer, @Nullable final Face face)
 
void setHeadMapSquare (final int layer, @Nullable final CfMapSquare mapSquare, final boolean setAlways)
 
int setSmooth (final int layer, final int smooth)
 
String toString ()
 

Static Public Attributes

static final int DARKNESS_FULL_BRIGHT = 255
 
static final int DEFAULT_COLOR = -1
 
static final int DEFAULT_DARKNESS = 255
 
static final Face DEFAULT_FACE = null
 
static final int DEFAULT_SMOOTH = 0
 

Private Attributes

int color = DEFAULT_COLOR
 
int darkness = DEFAULT_DARKNESS
 
final Face[] faces = new Face[Map2.NUM_LAYERS]
 
boolean fogOfWar
 
final CfMapSquare[] heads = new CfMapSquare[Map2.NUM_LAYERS]
 
final CfMap map
 
final int[] smooths = new int[Map2.NUM_LAYERS]
 
final int x
 
final int y
 

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

◆ dirty()

void com.realtime.crossfire.jxclient.map.CfMapSquare.dirty ( )

◆ getColor()

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

Returns the magic map color of this square.

Returns
the color

Definition at line 255 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 207 of file CfMapSquare.java.

References com.realtime.crossfire.jxclient.map.CfMapSquare.darkness.

Referenced by com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.commandSentMap(), and com.realtime.crossfire.jxclient.map.CfMapPatch.getDarkness().

Here is the caller graph for this function:

◆ getFace()

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

◆ 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 307 of file CfMapSquare.java.

References com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar, and com.realtime.crossfire.jxclient.map.CfMapSquare.heads.

Referenced by com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.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 235 of file CfMapSquare.java.

References com.realtime.crossfire.jxclient.map.CfMapSquare.smooths.

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

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

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

Sets the magic map color of this square.

Parameters
colorthe new color

Definition at line 243 of file CfMapSquare.java.

References com.realtime.crossfire.jxclient.map.CfMapSquare.color, and com.realtime.crossfire.jxclient.map.CfMapSquare.dirty().

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 192 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 265 of file CfMapSquare.java.

References com.realtime.crossfire.jxclient.map.CfMapSquare.dirty(), and com.realtime.crossfire.jxclient.map.CfMapSquare.faces.

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 291 of file CfMapSquare.java.

References com.realtime.crossfire.jxclient.map.CfMapSquare.dirty(), com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar, and com.realtime.crossfire.jxclient.map.CfMapSquare.heads.

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 218 of file CfMapSquare.java.

References com.realtime.crossfire.jxclient.map.CfMapSquare.dirty(), com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar, and com.realtime.crossfire.jxclient.map.CfMapSquare.smooths.

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

◆ 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 55 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

◆ DEFAULT_FACE

final Face com.realtime.crossfire.jxclient.map.CfMapSquare.DEFAULT_FACE = null
static

◆ 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 50 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

◆ fogOfWar

boolean com.realtime.crossfire.jxclient.map.CfMapSquare.fogOfWar
private

◆ 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 113 of file CfMapSquare.java.

Referenced by com.realtime.crossfire.jxclient.map.CfMapSquare.clear(), com.realtime.crossfire.jxclient.map.CfMapSquare.getHeadMapSquare(), and com.realtime.crossfire.jxclient.map.CfMapSquare.setHeadMapSquare().

◆ map

final CfMap com.realtime.crossfire.jxclient.map.CfMapSquare.map
private

◆ smooths

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

◆ x

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

◆ y

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

The documentation for this class was generated from the following file:
com.realtime.crossfire.jxclient.map.CfMapSquare.CfMapSquare
CfMapSquare(@NotNull final CfMap map, final int x, final int y)
Definition: CfMapSquare.java:128