00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #ifndef GAMEMGR_H_
00009 #define GAMEMGR_H_
00010 #include <const.h>
00011 #include <enums.h>
00012 #include <buildings.h>
00013 
00014 namespace FastEcslent {
00015 
00016         typedef struct { 
00017                 int gas;
00018                 int minerals;
00019         } Resources;
00020 
00021         typedef struct { 
00022                 int minerals;
00023                 int gas;
00024                 int supply; 
00025                 int buildTime;
00026                 int HotKey;
00027                 int transportSize;
00028                 int sightRange;
00029 
00030 
00031                 int hitPoints;
00032                 float armor;
00033                 float damage;
00034                 int   targetPriority;
00035                 float cooldown;
00036                 float range;
00037 
00038 
00039                 float speed;
00040                 float acc;
00041                 float dec;
00042                 float rotSpeed;
00043                 float collisionRadius;
00044 
00045                 EntityType neededTypes[MaxNeededTypes]; 
00046                 int nNeededTypes; 
00047 
00048         } GameEntTypeProperties;
00049 
00050 
00051         class Engine;
00052 
00053         class GameMgr : public Mgr {
00054 
00055         private:
00056                 int gameNumber;
00057                 std::vector<MineralPatch*> mineralPatches;
00058 
00059         public:
00060 
00061                 Options options;
00062                 
00063                 int popCap[NPLAYERS];
00064                 int pop[NPLAYERS];
00065                 int currentPopCap[NPLAYERS];
00066                 int currentEntityCounts[NPLAYERS][NENTITYTYPES];
00067                 Entity *playerEnts[NPLAYERS][PerPlayerMaxEnts];
00068                 int     playerNEnts[NPLAYERS];
00069 
00070                 GameEntTypeProperties entTypeData[NENTITYTYPES];
00071                 Resources resources[NPLAYERS];
00072 
00073 
00074 
00075                 GameMgr();
00076                 GameMgr(Engine *eng, Options opts);
00077 
00078                 void init();
00079                 void tick(double dtime);
00080 
00081                 bool preReqExists(EntityType entType);
00082                 bool notExceedPopCap(Identity entId);
00083                 void setupEntityBuildTimes();
00084                 void setupEntitySupply();
00085 
00086                 
00087                 void WaterCraft();
00088                 void makeBaseForSidePlayer(Side side, Player player, Ogre::Vector3 location, float offset, float yawOffset);
00089                 std::vector<Entity*> createNEntitiesRadial(EntityType entType, int n, Side side, Player player, Ogre::Vector3 location, float offset, float yawOffset, int yawOffsetMultiplier = 1);
00090                 void createMineralPatch(int n, Side side, Player player, Ogre::Vector3 location, float offset, float yawOffset, int yawOffsetMultiplier = 1);
00091                 void startMining(Side side, Player player);
00092                 Entity* findClosestEntityOfTypeWithinDistance(EntityType entityType, Ogre::Vector3 pos, float distance, Side side, Player player);
00093 
00094 
00095         
00096                 void game0();
00097                 void tester();
00098         };
00099 
00100 }
00101 
00102 
00103 #endif