BWAPI
|
00001 /* 00002 * GameStateDB.h 00003 * 00004 * The GameStateDB is a singleton object whose responsibility is to store 00005 * the current state of the game and provide a querying mechanism for it. 00006 */ 00007 #pragma once 00008 #include <map> 00009 #include <string> 00010 00011 typedef std::map<GameStateEnum, std::string> GameState; 00012 00013 enum GameStateEnum 00014 { 00015 TotalUnitCount, 00016 WorkerCount, 00017 FriendlyUnitCount, 00018 EnemyUnitCount, 00019 MineralsDiscovered, 00020 GeysersDiscovered, 00021 TO_BE_EXPANDED 00022 }; 00023 00024 00025 class GameStateDB 00026 { 00027 private: 00028 GameState currentState, lastState; 00029 00030 public: 00031 Value& query(const GameStateEnum& key); 00032 00033 private: 00034 00035 // GameStateDB is singleton, hence private ctors/assignment 00036 GameStateDB(); 00037 GameStateDB(const GameStateDB& other); 00038 void operator=(const GameStateDB& other); 00039 };