00001
00002
00003
00004
00005
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
00015 namespace FastEcslent {
00016 class Engine;
00017 class Building : public Entity {
00018 public:
00019
00020
00021 std::deque<EntityType> entityQueue;
00022 bool buildableEntities[NENTITYTYPES];
00023
00024 Entity *entityBeingBuilt;
00025
00026 Building(Engine *engine, EntityType etype);
00027 ~Building();
00028
00029 virtual void init();
00030
00031 bool enqueue(EntityType entityType);
00032 bool removeAtIndex(unsigned int pos);
00033 bool removeTail(void);
00034 bool cancelEntityBeingBuilt();
00035
00036 };
00037
00038 class Barracks : public Building {
00039 public:
00040
00041 Barracks(Engine *engine) : Building(engine, BARRACKS){
00042 meshName = "Barracks.mesh";
00043 uiname = "Barracks";
00044 uiname.append(boost::lexical_cast<std::string>(count++));
00045
00046
00047 length = feet(550.0f);
00048 width = feet(200.0f);
00049 height = feet(200.0f);
00050 maxSpeed = knots(0.0f);
00051 minSpeed = knots(0.0f);
00052 speedRange = maxSpeed - minSpeed;
00053 maxAcceleration = feetPerSecondSquared(0.0f);
00054 maxRotationalSpeed = degreesPerSecond(0.0f);
00055 turningRadius = 0;
00056 mass = tons(50);
00057 selectable = true;
00058 entityId.side = BLUE;
00059
00060 buildableEntities[MARINE] = true;
00061 buildableEntities[MARAUDER] = true;
00062 buildableEntities[REAPER] = true;
00063
00064
00065 };
00066 ~Barracks(){};
00067
00068 };
00069
00070 class CommandCenter : public Building {
00071 public:
00072 CommandCenter(Engine *engine) : Building(engine, COMMANDCENTER){
00073
00074 meshName = "CommandCenter.mesh";
00075 uiname = "CommandCenter";
00076 uiname.append(boost::lexical_cast<std::string>(count++));
00077
00078 length = feet(550.0f);
00079 width = feet(200.0f);
00080 height = feet(200.0f);
00081 maxSpeed = knots(0.0f);
00082 minSpeed = knots(0.0f);
00083 speedRange = maxSpeed - minSpeed;
00084 maxAcceleration = feetPerSecondSquared(0.0f);
00085 maxRotationalSpeed = degreesPerSecond(0.0f);
00086 turningRadius = 0;
00087 mass = tons(60);
00088 selectable = true;
00089 entityId.side = BLUE;
00090
00091
00092
00093 buildableEntities[SCV] = true;
00094
00095 };
00096 ~CommandCenter(){};
00097
00098 };
00099
00100 class Factory : public Building {
00101 public:
00102 Factory(Engine *engine) : Building(engine, FACTORY){
00103
00104 meshName = "Factory.mesh";
00105 uiname = "Factory";
00106 uiname.append(boost::lexical_cast<std::string>(count++));
00107
00108 length = feet(550.0f);
00109 width = feet(200.0f);
00110 height = feet(200.0f);
00111 maxSpeed = knots(0.0f);
00112 minSpeed = knots(0.0f);
00113 speedRange = maxSpeed - minSpeed;
00114 maxAcceleration = feetPerSecondSquared(0.0f);
00115 maxRotationalSpeed = degreesPerSecond(0.0f);
00116 turningRadius = 0;
00117 mass = tons(50);
00118 selectable = true;
00119 entityId.side = BLUE;
00120
00121 buildableEntities[TANK] = true;
00122 buildableEntities[THOR] = true;
00123 buildableEntities[HELLION] = true;
00124
00125 };
00126 ~Factory(){};
00127
00128 };
00129
00130 class Refinery : public Building {
00131 public:
00132 Refinery(Engine *engine) : Building(engine, REFINERY){
00133
00134 meshName = "Refinery.mesh";
00135 uiname = "GasRefinery";
00136 uiname.append(boost::lexical_cast<std::string>(count++));
00137
00138 length = feet(550.0f);
00139 width = feet(200.0f);
00140 height = feet(200.0f);
00141 maxSpeed = knots(0.0f);
00142 minSpeed = knots(0.0f);
00143 speedRange = maxSpeed - minSpeed;
00144 maxAcceleration = feetPerSecondSquared(0.0f);
00145 maxRotationalSpeed = degreesPerSecond(0.0f);
00146 turningRadius = 0;
00147 mass = tons(50);
00148 selectable = true;
00149 entityId.side = BLUE;
00150
00151
00152 };
00153 ~Refinery(){};
00154
00155 };
00156
00157
00158 class SupplyDepot : public Building {
00159 public:
00160 SupplyDepot(Engine *engine) : Building(engine, SUPPLYDEPOT){
00161
00162 meshName = "SupplyDepot.mesh";
00163 uiname = "SupplyDepot";
00164 uiname.append(boost::lexical_cast<std::string>(count++));
00165
00166 length = feet(550.0f);
00167 width = feet(200.0f);
00168 height = feet(200.0f);
00169 maxSpeed = knots(0.0f);
00170 minSpeed = knots(0.0f);
00171 speedRange = maxSpeed - minSpeed;
00172 maxAcceleration = feetPerSecondSquared(0.0f);
00173 maxRotationalSpeed = degreesPerSecond(0.0f);
00174 turningRadius = 0;
00175 mass = tons(40);
00176 selectable = true;
00177 entityId.side = BLUE;
00178
00179
00180 };
00181 ~SupplyDepot(){};
00182
00183 };
00184
00185
00186 class EngineeringBay : public Building {
00187 public:
00188 EngineeringBay(Engine *engine) : Building(engine, ENGINEERINGBAY){
00189
00190 meshName = "EngineeringBay.mesh";
00191 uiname = "EngineeringBay";
00192 uiname.append(boost::lexical_cast<std::string>(count++));
00193
00194 length = feet(550.0f);
00195 width = feet(200.0f);
00196 height = feet(200.0f);
00197 maxSpeed = knots(0.0f);
00198 minSpeed = knots(0.0f);
00199 speedRange = maxSpeed - minSpeed;
00200 maxAcceleration = feetPerSecondSquared(0.0f);
00201 maxRotationalSpeed = degreesPerSecond(0.0f);
00202 turningRadius = 0;
00203 mass = tons(40);
00204 selectable = true;
00205 entityId.side = BLUE;
00206
00207
00208 };
00209 ~EngineeringBay(){};
00210
00211 };
00212 class Armory : public Building {
00213 public:
00214 Armory(Engine *engine) : Building(engine, ARMORY){
00215
00216 meshName = "Armory.mesh";
00217 uiname = "Armory";
00218 uiname.append(boost::lexical_cast<std::string>(count++));
00219
00220 length = feet(550.0f);
00221 width = feet(200.0f);
00222 height = feet(200.0f);
00223 maxSpeed = knots(0.0f);
00224 minSpeed = knots(0.0f);
00225 speedRange = maxSpeed - minSpeed;
00226 maxAcceleration = feetPerSecondSquared(0.0f);
00227 maxRotationalSpeed = degreesPerSecond(0.0f);
00228 turningRadius = 0;
00229 mass = tons(40);
00230 selectable = true;
00231 entityId.side = BLUE;
00232
00233
00234 };
00235 ~Armory(){};
00236
00237 };
00238
00239 class Minerals;
00246 class MineralPatch{
00247 private:
00248 std::vector<Minerals*> minerals;
00249 public:
00254 void addMineral(Minerals *m){
00255 minerals.push_back(m);
00256 }
00261 Minerals* getNextMineral(Minerals *m);
00262 };
00263
00264 class Minerals: public Building {
00265
00266 public:
00267 float mineralAmount;
00268
00269 MineralPatch* patch;
00270
00271 int miners;
00272
00273 Entity * miner;
00274 Minerals(Engine *eng) : Building(eng, MINERALS) {
00275 meshName = "Mineral.mesh";
00276 uiname = "DilithiumCrystals";
00277 uiname.append(boost::lexical_cast<std::string>(count++));
00278
00279
00280 length = meters(2.0f);
00281 width = meters(2.0f);
00282 height = meters(4.0f);
00283 maxSpeed = knots(0.0f);
00284 minSpeed = knots(0.0f);
00285 speedRange = maxSpeed - minSpeed + EPSILON;
00286
00287 maxAcceleration = feetPerSecondSquared(0.0f);
00288 maxRotationalSpeed = degreesPerSecond(0.0f);
00289 turningRadius = 0;
00290 mass = tons(0);
00291
00292 selectable = true;
00293
00294 entityId.side = YELLOW;
00295
00296 entityState = ALIVE;
00297 mineralAmount = 1500;
00298 miners = 0;
00299 miner = 0;
00300 patch = 0;
00301 }
00302 };
00303
00304
00305
00306 class Gas: public Building {
00307
00308 public:
00309 float gasAmount;
00310 Gas(Engine *eng) : Building(eng, GAS) {
00311 meshName = "Oil.mesh";
00312 uiname = "Vespene Oil";
00313 uiname.append(boost::lexical_cast<std::string>(count++));
00314
00315
00316 length = meters(2.0f);
00317 width = meters(2.0f);
00318 height = meters(4.0f);
00319 maxSpeed = knots(0.0f);
00320 minSpeed = knots(0.0f);
00321 speedRange = maxSpeed - minSpeed + EPSILON;
00322
00323 maxAcceleration = feetPerSecondSquared(0.0f);
00324 maxRotationalSpeed = degreesPerSecond(0.0f);
00325 turningRadius = 0;
00326 mass = tons(0);
00327
00328 selectable = false;
00329
00330 entityId.side = YELLOW;
00331
00332 entityState = ALIVE;
00333 gasAmount = 2500;
00334
00335 }
00336 };
00337 }
00338
00339
00340 #endif