BWAPI
Skynet/Skynet/PlayerTracker.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "Interface.h"
00004 
00005 #include "Singleton.h"
00006 #include "Unit.h"
00007 #include "UnitGroup.h"
00008 
00009 class PlayerTrackerClass
00010 {
00011 public:
00012         PlayerTrackerClass(){}
00013 
00014         void onBegin();
00015         void update();
00016 
00017         void onPlayerLeft(Player player);
00018         void onDiscover(Unit unit);
00019         void onMorphRenegade(Unit unit, Player previousPlayer, BWAPI::UnitType previousType);
00020 
00021         void updatePlayers();
00022 
00023         bool isEnemyRace(BWAPI::Race race);
00024 
00025         std::set<Player> getEnemies(Player player = BWAPI::Broodwar->self()) const;
00026         std::set<Player> getAllies(Player player = BWAPI::Broodwar->self()) const;
00027 
00028         bool playerHasReseached(Player player, BWAPI::TechType tech);
00029         bool enemyHasReseached(BWAPI::TechType tech);
00030 
00031         int playerUnitCount(BWAPI::UnitType unit, Player player = BWAPI::Broodwar->self()) const;
00032         int enemyUnitCount(BWAPI::UnitType unit, Player player = BWAPI::Broodwar->self()) const;
00033 
00034         const std::vector<UnitGroup> &getEnemyClusters() { return mEnemyClusters; }
00035 
00036 private:
00037         std::set<Player> mEnemies;
00038         std::set<Player> mAllies;
00039 
00040         std::map<BWAPI::Race, bool> mEnemyRaceInfo;
00041 
00042         std::map<Player, bool> mPlayerHasOffensiveUnitsNeedDetection;
00043 
00044         std::map<Player, std::set<BWAPI::TechType>> mResearched;
00045 
00046         std::vector<UnitGroup> mEnemyClusters;
00047 
00048         bool mShowDebugInfo;
00049 };
00050 
00051 typedef Singleton<PlayerTrackerClass> PlayerTracker;
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines