-
Notifications
You must be signed in to change notification settings - Fork 271
/
Server.h
executable file
·75 lines (61 loc) · 1.79 KB
/
Server.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#include <windows.h>
#include <vector>
#include <unordered_map>
namespace BWAPI
{
// Forwards
struct GameData;
struct GameTable;
class Event;
class ForceInterface;
typedef ForceInterface* Force;
class PlayerInterface;
typedef PlayerInterface* Player;
class UnitInterface;
typedef UnitInterface* Unit;
class Server
{
public:
Server();
~Server();
Server(const Server &other) = delete;
Server(Server &&other) = delete;
void update();
bool isConnected() const;
int addEvent(const BWAPI::Event& e);
int addString(const char* text);
void clearAll();
int getForceID(Force force);
Force getForce(int id) const;
int getPlayerID(Player player);
Player getPlayer(int id) const;
int getUnitID(Unit unit);
Unit getUnit(int id) const;
GameData *data = nullptr;
private:
void onMatchStart();
void checkForConnections();
void initializeSharedMemory();
void updateSharedMemory();
void callOnFrame();
void processCommands();
void setWaitForResponse(bool wait);
HANDLE pipeObjectHandle = nullptr;
HANDLE mapFileHandle = nullptr;
HANDLE gameTableFileHandle = nullptr;
GameTable* gameTable = nullptr;
int gameTableIndex = -1;
bool connected = false;
bool localOnly = false;
std::vector<Force> forceVector;
std::unordered_map<Force, int> forceLookup;
std::vector<Player> playerVector;
std::unordered_map<Player, int> playerLookup;
std::vector<Unit> unitVector;
std::unordered_map<Unit, int> unitLookup;
PSID pEveryoneSID = nullptr;
PACL pACL = nullptr;
PSECURITY_DESCRIPTOR pSD = nullptr;
};
}