00001 00008 /* 00009 This file is part of Teapot Colony Wars. 00010 00011 Teapot Colony Wars is free software: you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Teapot Colony Wars is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU General Public License for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with Teapot Colony Wars. If not, see <http://www.gnu.org/licenses/>. 00023 */ 00024 00025 #ifndef COLONY_H 00026 #define COLONY_H 00027 00028 #include <GL/glut.h> 00029 #include <list> 00030 00031 class Pheromone; 00032 class Worshiper; 00033 class ColonyCell; 00034 class Replication; 00035 class Behaviour; 00036 00040 class Colony 00041 { 00042 protected: 00043 00045 Pheromone* _pheromones; 00046 00048 unsigned int _nb_worshipers; 00049 00051 std::list<ColonyCell*> _cells; 00052 00054 Replication* _replicationStrategy; 00055 00057 unsigned int _food; 00058 00060 GLubyte*_colors; 00061 00063 GLuint _tex_name; 00064 00065 public: 00066 00073 Colony(unsigned int food, Replication * replication); 00074 00078 virtual ~Colony(); 00079 00085 void setReplication(Replication * r); 00086 00093 Pheromone* getPheromone(unsigned int i); 00094 00100 unsigned int getNbWorshipers(); 00101 00107 void addCell(ColonyCell* cell); 00108 00115 void getCellIterators(std::list<ColonyCell*>::iterator & begin, 00116 std::list<ColonyCell*>::iterator & end); 00117 00121 std::list<Worshiper*>* getNewWorshipers(); 00122 00131 Worshiper* createWorshiper(unsigned int size, 00132 unsigned int food, Behaviour * b); 00133 00139 void addSurvivor(Worshiper* w); 00140 00146 unsigned int getFood() const; 00147 00153 void incrementFood(unsigned int inc); 00154 00161 bool decrementFood(unsigned int dec); 00162 00168 unsigned int getNbCells(); 00169 00177 void setColor(GLubyte red, GLubyte green, GLubyte blue); 00178 00184 GLubyte* getColor(); 00185 00191 GLuint getTexName(); 00192 00193 }; 00194 00195 #endif // COLONY_H