Field Class Reference

Represents a field in the grid of the level. More...

#include <Field.h>

Inherits Object.

Inheritance diagram for Field:

Inheritance graph
[legend]
Collaboration diagram for Field:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Field ()
 Standard constructor.
virtual ~Field ()
 Standard destructor.
int renderChild (Vector3d p_pos, Level *p_level, double p_deltasize=1.0)
 Renders the Object on the field at the given position.
int select (std::string p_filename)
 Selects the Texture to aply corresponding to energy value.
virtual int render (Vector3d p_pos, double p_deltasize=1.0)
 Renders the texture.
virtual FieldgetField ()
 Returns a pointer to itself.

Public Attributes

Unitunit
 Holds the Object on the Field.
int energy
 Holds the energy of the field.
int xCoord
 Holds the x-coordinate in the grid.
int yCoord
 Holds the x-coordinate in the grid.
std::string textureName
 Holds the name of the Texture used.
bool isVisible
 Holds the Information if the Field is visable.
bool isSettleRange
 Holds the Information if the fiel is settlerange.

Static Public Attributes

static int s_selectedFieldID = -1
 Holds the id of the selected Field.
static ObjectshadowTexture = 0
 Holds the shadow texture.

Detailed Description

Represents a field in the grid of the level.

It can contain a unit.

Definition at line 30 of file Field.h.


Constructor & Destructor Documentation

Field::Field (  ) 

Standard constructor.

Definition at line 30 of file Field.cpp.

References isSettleRange, isVisible, Object::size, and unit.

Field::~Field (  )  [virtual]

Standard destructor.

Definition at line 38 of file Field.cpp.


Member Function Documentation

int Field::renderChild ( Vector3d  p_pos,
Level p_level,
double  p_deltasize = 1.0 
)

Renders the Object on the field at the given position.

Parameters:
p_pos Position on the screen where the object should be rendered.
p_level Pointer to the level instance.
p_deltasize Size multiplier. Default = 1.0
Returns:
0 for success.

Definition at line 54 of file Field.cpp.

References isVisible, Unit::render(), and unit.

Referenced by Interface::render().

Here is the call graph for this function:

int Field::select ( std::string  p_filename  ) 

Selects the Texture to aply corresponding to energy value.

Parameters:
p_filename Filename for the texture to load.
Returns:
0 for success.

Definition at line 66 of file Field.cpp.

References energy, isSettleRange, Texture::loadAndBind(), and textureName.

Referenced by Unit::leechEnergy().

Here is the call graph for this function:

int Field::render ( Vector3d  p_pos,
double  p_deltasize = 1.0 
) [virtual]

Renders the texture.

Parameters:
p_pos Position on the screen where the object should be rendered.
p_deltasize Size multiplier. Default = 1.0
Returns:
0 for success.

Reimplemented from Object.

Definition at line 43 of file Field.cpp.

References isVisible, Object::render(), Texture::render(), and shadowTexture.

Referenced by Interface::render().

Here is the call graph for this function:

Field * Field::getField (  )  [virtual]

Returns a pointer to itself.

Returns:
This pointer.

Reimplemented from Texture.

Definition at line 86 of file Field.cpp.


Member Data Documentation

Unit* Field::unit

Holds the Object on the Field.

Definition at line 80 of file Field.h.

Referenced by EventDeleteUnit::compute(), EventComputeUnit::compute(), Field(), Unit::generate(), renderChild(), FunctionHandler::select(), FunctionHandler::selectBonus(), FunctionHandler::setSpawnDestination(), FunctionHandler::settle(), FunctionHandler::standardAction(), and FunctionHandler::terminate().

int Field::energy

Holds the energy of the field.

Definition at line 85 of file Field.h.

Referenced by Unit::compute(), Unit::leechEnergy(), select(), and FunctionHandler::settle().

int Field::xCoord

Holds the x-coordinate in the grid.

Definition at line 90 of file Field.h.

Referenced by FunctionHandler::isConnected(), and FunctionHandler::standardAction().

int Field::yCoord

Holds the x-coordinate in the grid.

Definition at line 95 of file Field.h.

Referenced by FunctionHandler::isConnected(), and FunctionHandler::standardAction().

int Field::s_selectedFieldID = -1 [static]

Holds the id of the selected Field.

Definition at line 100 of file Field.h.

Referenced by Interface::render(), FunctionHandler::select(), FunctionHandler::selectBonus(), FunctionHandler::setSpawnDestination(), FunctionHandler::settle(), FunctionHandler::standardAction(), and FunctionHandler::terminate().

std::string Field::textureName

Holds the name of the Texture used.

Definition at line 105 of file Field.h.

Referenced by Unit::leechEnergy(), and select().

bool Field::isVisible

Holds the Information if the Field is visable.

Definition at line 110 of file Field.h.

Referenced by Field(), render(), and renderChild().

bool Field::isSettleRange

Holds the Information if the fiel is settlerange.

Definition at line 115 of file Field.h.

Referenced by Field(), select(), and FunctionHandler::settle().

Object * Field::shadowTexture = 0 [static]

Holds the shadow texture.

Definition at line 120 of file Field.h.

Referenced by Level::load(), and render().


The documentation for this class was generated from the following files:
Generated on Tue Jul 17 22:02:23 2007 for C0re by  doxygen 1.5.2