BWAPI
trunk/bwapi/BWAPI/Source/BWAPI/Server.h
Go to the documentation of this file.
00001 #pragma once
00002 #include <windows.h>
00003 #include <BWAPI/Client/GameData.h>
00004 #include <BWAPI/Client/GameTable.h>
00005 #include <BWAPI/Client/Event.h>
00006 #include <BWAPI.h>
00007 #include <vector>
00008 #include <map>
00009 namespace BWAPI
00010 {
00011   class Server
00012   {
00013   public:
00014     Server();
00015     ~Server();
00016     void update();
00017     bool isConnected();
00018     int addEvent(BWAPI::Event e);
00019     int addString(const char* text);
00020     int getForceID(Force* force);
00021     Force* getForce(int id);
00022     int getPlayerID(Player* player);
00023     Player* getPlayer(int id);
00024     int getUnitID(Unit* unit);
00025     Unit* getUnit(int id);
00026     GameData* data;
00027     void clearAll();
00028   private:
00029     void onMatchStart();
00030     void checkForConnections();
00031     void initializeSharedMemory();
00032     void updateSharedMemory();
00033     void callOnFrame();
00034     void processCommands();
00035     void setWaitForResponse(bool wait);
00036     HANDLE pipeObjectHandle;
00037     HANDLE mapFileHandle;
00038     HANDLE gameTableFileHandle;
00039     GameTable* gameTable;
00040     int gameTableIndex;
00041     bool connected;
00042     bool localOnly;
00043     std::vector<Force*> forceVector;
00044     std::map<Force*, int> forceLookup;
00045 
00046     std::vector<Player*> playerVector;
00047     std::map<Player*, int> playerLookup;
00048 
00049     std::vector<Unit*> unitVector;
00050     std::map<Unit*, int> unitLookup;
00051   };
00052 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines