Gridarta Editor
net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Reference

Tracks a MapModel for light emitting game objects. More...

+ Inheritance diagram for net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
+ Collaboration diagram for net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Public Member Functions

 LightMapModelTracker (@NotNull final MapModel< G, A, R > mapModel)
 Creates a new instance. More...
 
void mapSizeChanging (@NotNull final Size2D newSize, @NotNull final Size2D oldSize)
 Called whenever the tracked map is about to change size. More...
 
void mapSquaresChanged (@NotNull final Iterable< MapSquare< G, A, R >> mapSquares)
 Called whenever some game objects have changed. More...
 

Private Member Functions

void setLightRadius (@NotNull final MapSquare< G, A, R > mapSquare, final int lightRadius)
 Updates the light radius of a map square. More...
 
void updateLightRadius (@NotNull final MapSquare< G, A, R > mapSquare)
 Recalculates information about light emitting game objects in a map square. More...
 

Private Attributes

final MapModel< G, A, R > mapModel
 The tracked MapModel. More...
 
final Point point = new Point()
 A temporary point. More...
 
final Point point2 = new Point()
 A temporary point. More...
 

Static Private Attributes

static final int MAX_LIGHT_RADIUS = 4
 The maximal supported light radius. More...
 

Detailed Description

Tracks a MapModel for light emitting game objects.

Whenever such a game object is added to, removed from, or modified while on the map, all affected map squares are updated.

Author
Andreas Kirschbaum

Definition at line 35 of file LightMapModelTracker.java.

Constructor & Destructor Documentation

◆ LightMapModelTracker()

net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.LightMapModelTracker ( @NotNull final MapModel< G, A, R >  mapModel)

Creates a new instance.

Parameters
mapModelthe tracked map model

Definition at line 65 of file LightMapModelTracker.java.

Member Function Documentation

◆ mapSizeChanging()

void net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapSizeChanging ( @NotNull final Size2D  newSize,
@NotNull final Size2D  oldSize 
)

Called whenever the tracked map is about to change size.

Parameters
newSizethe new map size
oldSizethe current map size

Definition at line 74 of file LightMapModelTracker.java.

Referenced by net.sf.gridarta.model.mapmodel.DefaultMapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.resizeMapInt().

+ Here is the caller graph for this function:

◆ mapSquaresChanged()

void net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapSquaresChanged ( @NotNull final Iterable< MapSquare< G, A, R >>  mapSquares)

◆ setLightRadius()

void net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setLightRadius ( @NotNull final MapSquare< G, A, R >  mapSquare,
final int  lightRadius 
)
private

Updates the light radius of a map square.

The light radius is the maximal light radius of all light emitting game objects in the map square.

Parameters
mapSquarethe map square to update
lightRadiusthe new light radius to set

Definition at line 125 of file LightMapModelTracker.java.

Referenced by net.sf.gridarta.model.mapmodel.LightMapModelTracker< G, A, R >.mapSizeChanging(), and net.sf.gridarta.model.mapmodel.LightMapModelTracker< G, A, R >.updateLightRadius().

+ Here is the caller graph for this function:

◆ updateLightRadius()

void net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.updateLightRadius ( @NotNull final MapSquare< G, A, R >  mapSquare)
private

Recalculates information about light emitting game objects in a map square.

Parameters
mapSquarethe map square

Definition at line 108 of file LightMapModelTracker.java.

Referenced by net.sf.gridarta.model.mapmodel.LightMapModelTracker< G, A, R >.mapSquaresChanged().

+ Here is the caller graph for this function:

Member Data Documentation

◆ mapModel

final MapModel<G, A, R> net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapModel
private

◆ MAX_LIGHT_RADIUS

final int net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.MAX_LIGHT_RADIUS = 4
staticprivate

The maximal supported light radius.

The return values of GameObject#getLightRadius() is clipped to this value.

Definition at line 41 of file LightMapModelTracker.java.

◆ point

final Point net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.point = new Point()
private

A temporary point.

Stored in a field to avoid reallocations.

Definition at line 53 of file LightMapModelTracker.java.

◆ point2

final Point net.sf.gridarta.model.mapmodel.LightMapModelTracker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.point2 = new Point()
private

A temporary point.

Stored in a field to avoid reallocations.

Definition at line 59 of file LightMapModelTracker.java.


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