BWAPI
trunk/bwapi/include/BWAPI/Client/GameData.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "UnitCommand.h"
00004 #include "ForceData.h"
00005 #include "PlayerData.h"
00006 #include "RegionData.h"
00007 #include "UnitData.h"
00008 #include "BulletData.h"
00009 #include "Event.h"
00010 #include "Command.h"
00011 #include "Shape.h"
00012 namespace BWAPIC
00013 {
00014   struct Position
00015   {
00016     Position() {x=0;y=0;}
00017     int x;
00018     int y;
00019   };
00020 }
00021 namespace BWAPI
00022 {
00023   struct unitFinder
00024   {
00025     int unitIndex;
00026     int searchValue;
00027   };
00028   struct GameData
00029   {
00030     //revision and debug will stay at the top of struct so they don't move in memory from revision to revision.
00031     int revision;
00032     bool isDebug;
00033 
00034     int instanceID;
00035     int botAPM_noselects;
00036     int botAPM_selects;
00037 
00038     //forces
00039     int forceCount;
00040     ForceData forces[5];
00041 
00042     //players
00043     int playerCount;
00044     PlayerData players[12];
00045 
00046     //units
00047     int initialUnitCount;
00048     UnitData units[10000];
00049 
00050     //unit table
00051     int unitArray[1700];
00052 
00053     //bullets
00054     BulletData bullets[100];
00055 
00056     // nuke dots
00057     int nukeDotCount;
00058     BWAPIC::Position nukeDots[200];
00059 
00060     int gameType;
00061     int latency;
00062     int latencyFrames;
00063     int latencyTime;
00064     int remainingLatencyFrames;
00065     int remainingLatencyTime;
00066     bool hasLatCom;
00067     bool hasGUI;
00068     int replayFrameCount;
00069     int frameCount;
00070     int elapsedTime;
00071     int countdownTimer;
00072     int fps;
00073     double averageFPS;
00074 
00075     // user input
00076     int mouseX;
00077     int mouseY;
00078     bool mouseState[M_MAX];
00079     bool keyState[K_MAX];
00080     int screenX;
00081     int screenY;
00082 
00083     bool flags[BWAPI::Flag::Max];
00084 
00085     // map
00086     int mapWidth;
00087     int mapHeight;
00088     char mapFileName[261];  //size based on broodwar memory
00089     char mapPathName[261];  //size based on broodwar memory
00090     char mapName[33];      //size based on broodwar memory
00091     char mapHash[41];
00092 
00093     //tile data
00094     int  getGroundHeight[256][256];
00095     bool isWalkable[1024][1024]; 
00096     bool isBuildable[256][256];
00097     bool isVisible[256][256];
00098     bool isExplored[256][256];
00099     bool hasCreep[256][256];
00100     bool isOccupied[256][256];
00101 
00102     unsigned short mapTileRegionId[256][256];
00103     unsigned short mapSplitTilesMiniTileMask[5000];
00104     unsigned short mapSplitTilesRegion1[5000];
00105     unsigned short mapSplitTilesRegion2[5000];
00106 
00107     int regionCount;
00108     RegionData regions[5000];
00109 
00110     // start locations
00111     int startLocationCount;
00112     BWAPIC::Position startLocations[8];
00113 
00114     // match mode
00115     bool isInGame;
00116     bool isMultiplayer;
00117     bool isBattleNet;
00118     bool isPaused;
00119     bool isReplay;
00120 
00121     //selected units
00122     int selectedUnitCount;
00123     int selectedUnits[12];
00124 
00125     // players
00126     int self;
00127     int enemy;
00128     int neutral;
00129 
00130     static const int MAX_EVENTS         = 10000;
00131     static const int MAX_EVENT_STRINGS  =  1000;
00132     static const int MAX_STRINGS        = 20000;
00133     static const int MAX_SHAPES         = 20000;
00134     static const int MAX_COMMANDS       = 20000;
00135     static const int MAX_UNIT_COMMANDS  = 20000;
00136 
00137     //events from server to client
00138     int eventCount;
00139     BWAPIC::Event events[MAX_EVENTS];
00140 
00141     //strings used in events
00142     int eventStringCount;
00143     char eventStrings[MAX_EVENT_STRINGS][256];
00144 
00145     //strings (used in shapes and commands)
00146     int stringCount;
00147     char strings[MAX_STRINGS][256];
00148 
00149     //shapes, commands, unitCommands, from client to server
00150     int shapeCount;
00151     BWAPIC::Shape shapes[MAX_SHAPES];
00152 
00153     int commandCount;
00154     BWAPIC::Command commands[MAX_COMMANDS];
00155 
00156     int unitCommandCount;
00157     BWAPIC::UnitCommand unitCommands[MAX_UNIT_COMMANDS];
00158 
00159     unitFinder xUnitSearch[1700*2];
00160     unitFinder yUnitSearch[1700*2];
00161   };
00162 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines