Cell Class Reference

#include <Cell.h>

Inheritance diagram for Cell:

Inheritance graph
[legend]
Collaboration diagram for Cell:

Collaboration graph
[legend]

Public Member Functions

virtual ~Cell ()
 Empty Destructor.
virtual void draw ()
 Draw the cell content with OpenGL.
virtual unsigned int getFood ()
 Return the available food quantity.
virtual unsigned int addFood (unsigned int inc)
 Add food to the Cell.
virtual unsigned int subFood (unsigned int inc)
 Subtract food to the Cell.
virtual bool reachable (Worshiper *w)
 Is the Cell reachable ?
virtual std::list< Worshiper * > * getPeople ()
 Return the list of the Worshipers currently on the Cell.
virtual std::map< Pheromone *,
unsigned int > * 
getPheromones ()
 Return the map of Pheromones currently on the Cell, associated to their life-time.
virtual bool addWorshiper (Worshiper *w)
 Add a Worshiper to the Cell.
virtual bool removeWorshiper (const Worshiper *w)
 Remove a Worshiper to the Cell.
virtual void addPheromone (Pheromone *p)
 Add a Pheromone to the Cell.
virtual CellmakeActions ()
 Make the actions needed by the Cell for one iteration.

Protected Member Functions

virtual GLuint getTexName ()
 Return the Cell texture id.
virtual void getColors (GLubyte &red, GLubyte &green, GLubyte &blue)
 Return the color the Cell has to be display with.
 Cell ()
 Empty Constructor.

Static Protected Attributes

static GLuint _tex_name = 0

Detailed Description

< A cell in the World

Definition at line 40 of file Cell.h.


Member Function Documentation

GLuint Cell::getTexName (  )  [protected, virtual]

Return the Cell texture id.

Returns:
the value of _tex_name

Reimplemented in CorpseFood, CorridorCell, GodsGiftFood, InfiniteFood, RenewableFood, and WallCell.

Definition at line 33 of file Cell.cpp.

References _tex_name, and Image::genTexture2D().

Referenced by draw().

00033                         {
00034   if(_tex_name == 0) {
00035     // si besoin est, on charge l'image et on la convertit en texture.
00036     Image texture("./textures/Cell.bmp");
00037     _tex_name = texture.genTexture2D();
00038   }
00039 
00040   return _tex_name;
00041 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Cell::getColors ( GLubyte &  red,
GLubyte &  green,
GLubyte &  blue 
) [protected, virtual]

Return the color the Cell has to be display with.

Parameters:
red the red part of the display color
green the green part of the display color
blue the blue part of the display color

Reimplemented in ColonyCell.

Definition at line 43 of file Cell.cpp.

References COLOR_MAX.

Referenced by draw().

00043                                                                 {
00044   red   = COLOR_MAX;
00045   green = COLOR_MAX;
00046   blue  = COLOR_MAX;
00047 }

Here is the caller graph for this function:

unsigned int Cell::getFood (  )  [virtual]

Return the available food quantity.

Returns:
the quantity of available food on the Cell

Reimplemented in FoodCell.

Definition at line 89 of file Cell.cpp.

Referenced by World::feed(), and VisualContext::haveFood().

00089                            {
00090   return 0;
00091 }

Here is the caller graph for this function:

unsigned int Cell::addFood ( unsigned int  inc  )  [virtual]

Add food to the Cell.

Parameters:
inc the food quantity to add
Returns:
the quantity of food which have really been added

Reimplemented in FoodCell.

Definition at line 93 of file Cell.cpp.

Referenced by World::fight().

00093                                            {
00094   return 0;
00095 }

Here is the caller graph for this function:

unsigned int Cell::subFood ( unsigned int  inc  )  [virtual]

Subtract food to the Cell.

Parameters:
inc the food quantity to substract
Returns:
the quantity of food which have really been substracted

Reimplemented in FoodCell.

Definition at line 97 of file Cell.cpp.

Referenced by World::feed().

00097                                            {
00098   return 0;
00099 }

Here is the caller graph for this function:

bool Cell::reachable ( Worshiper w  )  [virtual]

Is the Cell reachable ?

Parameters:
w the Worshiper that try to access to the Cell
Returns:
true if the Worshiper can access to the Cell, false otherwise

Reimplemented in ColonyCell, CorridorCell, and ReachableCell.

Definition at line 101 of file Cell.cpp.

Referenced by World::addCommand(), and VisualContext::reachable().

00101                                  {
00102   return false;
00103 }

Here is the caller graph for this function:

std::list< Worshiper * > * Cell::getPeople (  )  [virtual]

Return the list of the Worshipers currently on the Cell.

Returns:
the list of the Worshipers

Reimplemented in ReachableCell.

Definition at line 105 of file Cell.cpp.

Referenced by World::feed(), VisualContext::getWorshipers(), World::iteration(), and UntilVictoryFight::resolve().

00105                                      {
00106   return NULL;
00107 }

Here is the caller graph for this function:

std::map< Pheromone *, unsigned int > * Cell::getPheromones (  )  [virtual]

Return the map of Pheromones currently on the Cell, associated to their life-time.

Returns:
the map of Pheromones

Reimplemented in ReachableCell.

Definition at line 109 of file Cell.cpp.

Referenced by VisualContext::getPheromones().

00109                                                       {
00110   return NULL;
00111 }

Here is the caller graph for this function:

bool Cell::addWorshiper ( Worshiper w  )  [virtual]

Add a Worshiper to the Cell.

Parameters:
w the Worshiper to add
Returns:
true if the Worshiper have been correctly added, false otherwise

Reimplemented in ReachableCell.

Definition at line 113 of file Cell.cpp.

Referenced by World::makeCommand().

00113                                     {
00114   return false;
00115 }

Here is the caller graph for this function:

bool Cell::removeWorshiper ( const Worshiper w  )  [virtual]

Remove a Worshiper to the Cell.

Parameters:
w the Worshiper to remove
Returns:
true if the Worshiper have been correctly removed, false otherwise

Reimplemented in ReachableCell.

Definition at line 117 of file Cell.cpp.

Referenced by World::feed(), World::makeCommand(), and UntilVictoryFight::resolve().

00117                                              {
00118   return false;
00119 }

Here is the caller graph for this function:

void Cell::addPheromone ( Pheromone p  )  [virtual]

Add a Pheromone to the Cell.

Parameters:
p the Pheromone to add
Returns:
true if the Pheromone have been correctly added, false otherwise

Reimplemented in ReachableCell.

Definition at line 121 of file Cell.cpp.

Referenced by World::addPheromone().

00121                                     {
00122 
00123 }

Here is the caller graph for this function:

Cell * Cell::makeActions (  )  [virtual]

Make the actions needed by the Cell for one iteration.

Returns:
a pointer to the new Cell which should replace this one

Reimplemented in ColonyCell, CorpseFood, FoodCell, GodsGiftFood, and ReachableCell.

Definition at line 125 of file Cell.cpp.

Referenced by World::iteration().

00125                         {
00126   return this;
00127 }

Here is the caller graph for this function:


Field Documentation

GLuint Cell::_tex_name = 0 [static, protected]

the texture id for Cell rendering

Reimplemented in CorpseFood, CorridorCell, GodsGiftFood, InfiniteFood, RenewableFood, and WallCell.

Definition at line 45 of file Cell.h.

Referenced by getTexName().


The documentation for this class was generated from the following files:
Generated on Sat Feb 2 22:23:09 2008 for Teapot Colony Wars by  doxygen 1.5.4