00001 #ifndef PORTION_H 00002 #define PORTION_H 1 00003 00004 #include <GL/glut.h> 00005 #include "pheromone.h" 00006 #include "ant.h" 00007 #include "plant.h" 00008 00010 struct antList { 00011 antList *next; 00012 ant *ptr; 00013 }; 00014 00016 class portion { 00017 protected: 00018 GLfloat antColor[4]; 00019 GLfloat antColorAlt[4]; 00020 GLfloat portionColor[4]; 00021 GLfloat treeColor[4]; 00022 GLfloat leavesColor[4]; 00023 GLfloat antRadius; 00024 antList *firstAnt; 00026 void updateP(long int updateStamp); 00029 public: 00030 char hemisphere; 00031 bool walkable; 00032 double coordinates[9]; 00034 int foundNeighbors; 00037 portion **neighbors; 00038 int index; 00039 plant *thisPlant; 00041 pheromone *pheromones[2]; 00049 portion(double *coordinates, int index); 00051 bool belongsPoint(double x, double y, double z); 00052 virtual ~portion(); 00054 virtual void update(long int updateStamp) =0; 00060 void displayAnt(bool printNames); 00063 void displayPlant(); 00066 void setColor(); 00069 virtual double getFood(); 00074 virtual double modifyFood(double modifier); 00076 virtual bool isColony() =0; 00082 virtual void displayPheromones(char pheromoneType); 00085 void move(ant *myAnt, portion *to); 00094 portion *sensePheromones(char type, char antHemisphere, portion 00095 *previousPortion); 00100 portion *senseBasicInstinct(portion *previousPortion); 00101 #ifdef DEBUG_ANT 00102 void markPortionEaten(); 00103 #endif 00104 }; 00105 #endif
1.2.15