buildings.h

Go to the documentation of this file.
00001 /*
00002  * buildings.h
00003  *
00004  *  Created on: Jan 9, 2013
00005  *      Author: sushil
00006  */
00007 
00008 #ifndef BUILDINGS_H_
00009 #define BUILDINGS_H_
00010 #include <boost/lexical_cast.hpp>
00011 #include <deque>
00012 #include <ent.h>
00013 #include <enums.h>
00014 #include "unitBuilder.h"
00015 
00016 namespace FastEcslent {
00017         class Engine;
00018         class Building : public Entity {
00019         public:
00020                 //Entity queue
00021 
00022 //              std::deque<EntityType> entityQueue;
00023 //              bool buildableEntities[NENTITYTYPES];
00024 //              //double buildTimeForEntity[NENTITYTYPES];
00025 //              Entity *entityBeingBuilt;
00026 
00027                 Building(Engine *engine, EntityType etype);
00028                 ~Building();
00029 
00030                 virtual void init();
00031 
00032 //              bool enqueue(EntityType entityType);
00033 //              bool removeAtIndex(unsigned int pos);
00034 //              bool removeTail(void);
00035 //              bool cancelEntityBeingBuilt();
00036 
00037         };
00038 
00039         class Barracks : public Building {
00040         public:
00041                 //static int count = 0;
00042                 Barracks(Engine *engine) : Building(engine, BARRACKS){
00043                         meshName = "Barracks.mesh";
00044                         uiname =    "Barracks";
00045                         uiname.append(boost::lexical_cast<std::string>(count++));
00046 
00047                         // properties
00048                         length = feet(550.0f);
00049                         width  = feet(200.0f);
00050                         height = feet(20.0f);
00051                         maxSpeed = knots(0.0f);
00052                         minSpeed = knots(0.0f);
00053                         speedRange = maxSpeed - minSpeed;
00054                         maxAcceleration = feetPerSecondSquared(0.0f);
00055                         maxRotationalSpeed = degreesPerSecond(0.0f);
00056                         turningRadius = 0;
00057                         mass = tons(50);
00058                         selectable = true;
00059                         entityId.side = BLUE;
00060 
00061                         //this->addAspect(new Builder())
00062                         builder = new Builder(this, BUILDER,Ogre::Vector3(-400,0,-400), Ogre::Vector3(400,0,400));
00063                         builder->init();
00064                         this->addAspect(builder);
00065                         
00066 //                        builder->buildableEntities[MARINE]   = true;
00067 //                      builder->buildableEntities[MARAUDER] = true;
00068 //                      builder->buildableEntities[REAPER]   = true;
00069                         //buildableEntities[GHOST] = true;
00070 
00071                 };
00072                 ~Barracks(){};
00073                 //virtual void init(){};
00074         };
00075 
00076         class CommandCenter : public Building {
00077         public:
00078                 CommandCenter(Engine *engine) : Building(engine, COMMANDCENTER){
00079                         // properties
00080                         meshName = "CommandCenter.mesh";
00081                         uiname = "CommandCenter";
00082                         uiname.append(boost::lexical_cast<std::string>(count++));
00083 
00084                         length = feet(550.0f);
00085                         width  = feet(200.0f);
00086                         height = feet(200.0f);
00087                         maxSpeed = knots(0.0f);
00088                         minSpeed = knots(0.0f);
00089                         speedRange = maxSpeed - minSpeed;
00090                         maxAcceleration = feetPerSecondSquared(0.0f);
00091                         maxRotationalSpeed = degreesPerSecond(0.0f);
00092                         turningRadius = 0;
00093                         mass = tons(60);
00094                         selectable = true;
00095                         entityId.side = BLUE;
00096                         //entityType    = COMMANDCENTER;
00097                         builder = new Builder(this, BUILDER, Ogre::Vector3(-400,0,-400), Ogre::Vector3(400,0,400));
00098                         builder->init();
00099                         this->addAspect(builder);
00100 
00101 
00102 //                      builder->buildableEntities[SCV] = true;
00103 
00104                 };
00105                 ~CommandCenter(){};
00106                 //virtual void init(){};
00107         };
00108 
00109         class Factory : public Building {
00110         public:
00111                 Factory(Engine *engine) : Building(engine, FACTORY){
00112                         // properties
00113                         meshName = "Factory.mesh";
00114                         uiname = "Factory";
00115                         uiname.append(boost::lexical_cast<std::string>(count++));
00116 
00117                         length = feet(550.0f);
00118                         width  = feet(200.0f);
00119                         height = feet(15.0f);
00120                         maxSpeed = knots(0.0f);
00121                         minSpeed = knots(0.0f);
00122                         speedRange = maxSpeed - minSpeed;
00123                         maxAcceleration = feetPerSecondSquared(0.0f);
00124                         maxRotationalSpeed = degreesPerSecond(0.0f);
00125                         turningRadius = 0;
00126                         mass = tons(50);
00127                         selectable = true;
00128                         entityId.side = BLUE;
00129                         
00130                         builder = new Builder(this, BUILDER,Ogre::Vector3(-400,0,-400), Ogre::Vector3(400,0,400));
00131                         builder->init();
00132                         this->addAspect(builder);
00133 
00134 //                      builder->buildableEntities[TANK] = true;
00135 //                      builder->buildableEntities[THOR] = true;
00136 //                      builder->buildableEntities[HELLION] = true;
00137 
00138                 };
00139                 ~Factory(){};
00140                 //virtual void init(){};
00141         };
00142 
00143         class Refinery : public Building {
00144         private:
00145 
00146 
00147         public:
00148                 Entity* associatedOilField;
00149                 Refinery(Engine *engine) : Building(engine, REFINERY){
00150                         // properties
00151                         meshName = "Refinery.mesh";
00152                         uiname = "GasRefinery";
00153                         uiname.append(boost::lexical_cast<std::string>(count++));
00154 
00155                         length = feet(550.0f);
00156                         width  = feet(200.0f);
00157                         height = feet(200.0f);
00158                         maxSpeed = knots(0.0f);
00159                         minSpeed = knots(0.0f);
00160                         speedRange = maxSpeed - minSpeed;
00161                         maxAcceleration = feetPerSecondSquared(0.0f);
00162                         maxRotationalSpeed = degreesPerSecond(0.0f);
00163                         turningRadius = 0;
00164                         mass = tons(50);
00165                         selectable = true;
00166                         entityId.side = BLUE;
00167                         associatedOilField = 0;
00168 
00169                 };
00170                 void setAssociatedOilField(Ogre::Vector3 pos);
00171                 ~Refinery(){};
00172                 //virtual void init(){};
00173         };
00174 
00175 
00176         class SupplyDepot : public Building {
00177         public:
00178                 SupplyDepot(Engine *engine) : Building(engine, SUPPLYDEPOT){
00179                         // properties
00180                         meshName = "SupplyDepot.mesh";
00181                         uiname = "SupplyDepot";
00182                         uiname.append(boost::lexical_cast<std::string>(count++));
00183 
00184                         length = feet(550.0f);
00185                         width  = feet(200.0f);
00186                         height = feet(200.0f);
00187                         maxSpeed = knots(0.0f);
00188                         minSpeed = knots(0.0f);
00189                         speedRange = maxSpeed - minSpeed;
00190                         maxAcceleration = feetPerSecondSquared(0.0f);
00191                         maxRotationalSpeed = degreesPerSecond(0.0f);
00192                         turningRadius = 0;
00193                         mass = tons(40);
00194                         selectable = true;
00195                         entityId.side = BLUE;
00196 
00197 
00198                 };
00199                 ~SupplyDepot(){};
00200                 //virtual void init(){};
00201         };
00202 
00203 
00204         class EngineeringBay : public Building {
00205         public:
00206                 EngineeringBay(Engine *engine) : Building(engine, ENGINEERINGBAY){
00207                         // properties
00208                         meshName = "EngineeringBay.mesh";
00209                         uiname = "EngineeringBay";
00210                         uiname.append(boost::lexical_cast<std::string>(count++));
00211 
00212                         length = feet(550.0f);
00213                         width  = feet(200.0f);
00214                         height = feet(200.0f);
00215                         maxSpeed = knots(0.0f);
00216                         minSpeed = knots(0.0f);
00217                         speedRange = maxSpeed - minSpeed;
00218                         maxAcceleration = feetPerSecondSquared(0.0f);
00219                         maxRotationalSpeed = degreesPerSecond(0.0f);
00220                         turningRadius = 0;
00221                         mass = tons(40);
00222                         selectable = true;
00223                         entityId.side = BLUE;
00224 
00225 
00226                 };
00227                 ~EngineeringBay(){};
00228                 //virtual void init(){};
00229         };
00230         class Armory : public Building {
00231         public:
00232                 Armory(Engine *engine) : Building(engine, ARMORY){
00233                         // properties
00234                         meshName = "Armory.mesh";
00235                         uiname = "Armory";
00236                         uiname.append(boost::lexical_cast<std::string>(count++));
00237 
00238                         length = feet(550.0f);
00239                         width  = feet(200.0f);
00240                         height = feet(200.0f);
00241                         maxSpeed = knots(0.0f);
00242                         minSpeed = knots(0.0f);
00243                         speedRange = maxSpeed - minSpeed;
00244                         maxAcceleration = feetPerSecondSquared(0.0f);
00245                         maxRotationalSpeed = degreesPerSecond(0.0f);
00246                         turningRadius = 0;
00247                         mass = tons(40);
00248                         selectable = true;
00249                         entityId.side = BLUE;
00250 
00251 
00252                 };
00253                 ~Armory(){};
00254                 //virtual void init(){};
00255         };
00256 
00257         class Minerals;
00264         class MineralPatch {
00265         private:
00266                 std::vector<Minerals*> minerals;
00267                 int patchID;
00268         public:
00269                 MineralPatch(int id):patchID(id){};
00274                 void addMineral(Minerals *m){
00275                         minerals.push_back(m);
00276                 }
00281                 Minerals* getNextMineral(Minerals *m);
00282 
00286                 int getID(){return patchID;};
00287         };
00288 
00289         class Minerals: public Building {
00290 
00291         public:
00292                 float mineralAmount;
00293                 //mineral patch the mineral belongs to
00294                 int mineralPatchId;
00295                 //The number of miners of this Mineral
00296                 int miners;
00297                 //The entity(SCV) which is currently mining
00298                 Entity * miner;
00299                 Minerals(Engine *eng) : Building(eng, MINERALS) {
00300                         meshName = "Mineral.mesh";
00301                         uiname = "DilithiumCrystals";
00302                         uiname.append(boost::lexical_cast<std::string>(count++));
00303 
00304                         // properties
00305                         length = meters(50.0f);
00306                         width  = meters(50.0f);
00307                         height = meters(50.0f);
00308                         maxSpeed = knots(0.0f);
00309                         minSpeed = knots(0.0f);
00310                         speedRange = maxSpeed - minSpeed + EPSILON;
00311 
00312                         maxAcceleration = feetPerSecondSquared(0.0f);
00313                         maxRotationalSpeed = degreesPerSecond(0.0f);
00314                         turningRadius = 0;
00315                         mass = tons(0);
00316 
00317                         selectable = true;
00318 
00319                         entityId.side = YELLOW;
00320 
00321                         entityState   = ALIVE;
00322                         mineralAmount = 1500;
00323                         miners = 0;
00324                         miner = 0;
00325                         mineralPatchId = 0;
00326                 }
00327         };
00328 
00329 
00330 
00331         class Gas: public Building {
00332 
00333         public:
00334                 float gasAmount;
00335                 Entity * miner;
00336                 Entity * refinary;
00337                 Gas(Engine *eng) : Building(eng, GAS) {
00338                         meshName = "Oil.mesh";
00339                         uiname = "Vespene Oil";
00340                         uiname.append(boost::lexical_cast<std::string>(count++));
00341 
00342                         // properties
00343                         length = meters(50.0f);
00344                         width  = meters(50.0f);
00345                         height = meters(50.0f);
00346                         maxSpeed = knots(0.0f);
00347                         minSpeed = knots(0.0f);
00348                         speedRange = maxSpeed - minSpeed + EPSILON;
00349 
00350                         maxAcceleration = feetPerSecondSquared(0.0f);
00351                         maxRotationalSpeed = degreesPerSecond(0.0f);
00352                         turningRadius = 0;
00353                         mass = tons(0);
00354 
00355                         selectable = true;
00356 
00357                         entityId.side = YELLOW;
00358 
00359                         entityState   = ALIVE;
00360                         gasAmount = 2500; //sc2 (sc1 == 5000)
00361                         miner = 0;
00362                         refinary = 0;
00363                         this->ai->addCommand(new GasFieldCommand(MaintainCommand, this));
00364                 }
00365         };
00366 }
00367 
00368 
00369 #endif /* BUILDINGS_H_ */

Generated on Fri Dec 13 14:54:15 2013 for FastECSLent by  doxygen 1.5.4