#include <Cell.h>
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 Cell * | makeActions () |
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 |
Definition at line 40 of file Cell.h.
GLuint Cell::getTexName | ( | ) | [protected, virtual] |
Return the Cell texture id.
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 }
void Cell::getColors | ( | GLubyte & | red, | |
GLubyte & | green, | |||
GLubyte & | blue | |||
) | [protected, virtual] |
Return the color the Cell has to be display with.
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().
unsigned int Cell::getFood | ( | ) | [virtual] |
Return the available food quantity.
Reimplemented in FoodCell.
Definition at line 89 of file Cell.cpp.
Referenced by World::feed(), and VisualContext::haveFood().
unsigned int Cell::addFood | ( | unsigned int | inc | ) | [virtual] |
Add food to the Cell.
inc | the food quantity to add |
Reimplemented in FoodCell.
Definition at line 93 of file Cell.cpp.
Referenced by World::fight().
unsigned int Cell::subFood | ( | unsigned int | inc | ) | [virtual] |
Subtract food to the Cell.
inc | the food quantity to substract |
Reimplemented in FoodCell.
Definition at line 97 of file Cell.cpp.
Referenced by World::feed().
bool Cell::reachable | ( | Worshiper * | w | ) | [virtual] |
Is the Cell reachable ?
Reimplemented in ColonyCell, CorridorCell, and ReachableCell.
Definition at line 101 of file Cell.cpp.
Referenced by World::addCommand(), and VisualContext::reachable().
std::list< Worshiper * > * Cell::getPeople | ( | ) | [virtual] |
Return the list of the Worshipers currently on the Cell.
Reimplemented in ReachableCell.
Definition at line 105 of file Cell.cpp.
Referenced by World::feed(), VisualContext::getWorshipers(), World::iteration(), and UntilVictoryFight::resolve().
std::map< Pheromone *, unsigned int > * Cell::getPheromones | ( | ) | [virtual] |
Return the map of Pheromones currently on the Cell, associated to their life-time.
Reimplemented in ReachableCell.
Definition at line 109 of file Cell.cpp.
Referenced by VisualContext::getPheromones().
bool Cell::addWorshiper | ( | Worshiper * | w | ) | [virtual] |
w | the Worshiper to add |
Reimplemented in ReachableCell.
Definition at line 113 of file Cell.cpp.
Referenced by World::makeCommand().
bool Cell::removeWorshiper | ( | const Worshiper * | w | ) | [virtual] |
Remove a Worshiper to the Cell.
w | the Worshiper to remove |
Reimplemented in ReachableCell.
Definition at line 117 of file Cell.cpp.
Referenced by World::feed(), World::makeCommand(), and UntilVictoryFight::resolve().
void Cell::addPheromone | ( | Pheromone * | p | ) | [virtual] |
p | the Pheromone to add |
Reimplemented in ReachableCell.
Definition at line 121 of file Cell.cpp.
Referenced by World::addPheromone().
Cell * Cell::makeActions | ( | ) | [virtual] |
Make the actions needed by the Cell for one iteration.
Reimplemented in ColonyCell, CorpseFood, FoodCell, GodsGiftFood, and ReachableCell.
Definition at line 125 of file Cell.cpp.
Referenced by World::iteration().
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().