BWAPI
MapSector.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "defines.h"
00004 
00005 #define MINERAL_SECTOR_VALUE            1
00006 #define GEYSER_SECTOR_VALUE                     0
00007 #define BASE_SECTOR_VALUE                       20
00008 #define NOT_EXPLORED_SECTOR_VALUE       50
00009 
00010 class MapSector
00011 {
00012 protected:
00013         TilePosition _position;
00014         TilePosition _centerPosition;
00015 
00016         int _posX, _posY;
00017 
00018         int _sectorWidth;
00019         int _sectorHeight;
00020 
00021         int _lastVisible;
00022 
00023         TilePositionMap _positions;
00024         TilePositionMap _walkablePositions;
00025         TilePositionMap _notVisibleWalkablePositions;
00026 
00027         UnitMemorySet _unitMemories;
00028         UnitMemorySet _minerals;
00029         UnitMemorySet _geysers;
00030         UnitMemorySet _enemies;
00031 
00032         AgentSet _agents;
00033 
00034         bool hasUndetecteds;
00035 
00036         double _resourceValue;
00037         double _enemyValue;
00038         double _possibleEnemyValue;
00039 
00040         double _airValuePercentage;
00041         double _undetectedValuePercentage;
00042 
00043         double _walkablePercentage;
00044         double _visibilityPercentage;
00045 
00046         int _buildingCount;
00047 
00048         int _deathCount;
00049 
00050         ExploreSectorTask* _exploreSectorTask;
00051 
00052         int _assaultSectorTaskCount;
00053 
00054         void refreshResources();
00055         void refreshEnemies();
00056         void refreshBuildingCount();
00057 
00058         Environment* _env;
00059 
00060 public:
00061         MapSector(TilePosition position, Environment* env);
00062         MapSector(int x, int y, Environment* env);
00063         virtual ~MapSector();
00064 
00065         void initialize();
00066         void refresh();
00067 
00068         Environment* getEnvironment();
00069 
00070         void calculateResourceValue();
00071         double getResourceValue();
00072 
00073         void calculateEnemyValue();
00074         double getEnemyValue();
00075 
00076         void incPossibleEnemyValue();
00077         void resetPossibleEnemyValue();
00078 
00079         int getBuildingCount();
00080 
00081         void incDeathCount();
00082         int getDeathCount();
00083 
00084         void addUnitMemory(UnitMemory* memory);
00085         void removeUnitMemory(UnitMemory* memory);
00086 
00087         UnitMemorySet* getEnemies();
00088 
00089         void addAgent(Agent* agent);
00090         void removeAgent(Agent* agent);
00091 
00092         UnitMemorySet* getMinerals();
00093 
00094         AgentSet* getAgents();
00095         
00096         double getAirValuePercentage();
00097         double getUndetectedValuePercentage();
00098 
00099         int getLastVisible();
00100         int getTimeNotVisible();
00101 
00102         double getWalkablePercentage();
00103         double getVisibilityPercentage();
00104 
00105         TilePositionMap* getPositions();
00106         TilePositionMap* getWalkablePositions();
00107         TilePositionMap* getNotVisibleWalkablePositions();
00108 
00109         TilePosition getCenterPosition();
00110         TilePosition getPosition();
00111 
00112         bool isWalkableFromStart();
00113         double getDistanceFromStart();
00114         double getCornerDistance();
00115 
00116         double getDistance(Position pos);
00117         double getDistance(TilePosition pos);
00118 
00119         void markExplored();
00120 
00121         void setExploreSectorTask(ExploreSectorTask* task);
00122         ExploreSectorTask* getExploreSectorTask();
00123 
00124         void incAssaultSectorTaskCount();
00125         void decAssaultSectorTaskCount();
00126         int getAssaultSectorTaskCount();
00127 
00128         bool isInSector(Unit* unit);
00129         bool isInSector(Position pos);
00130         bool isInSector(TilePosition pos);
00131 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines