-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhelper.cpp
59 lines (46 loc) · 1.07 KB
/
helper.cpp
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
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include "helper.h"
#include <BWTA.h>
#include <BWAPI.h>
#include "micropather.h"
#include "heatmap.h"
BWAPI::Game* getGame()
{
return BWAPI::Broodwar;
}
extern bool analyzed; // XXX
extern bool analysis_just_finished; // XXX
void analyzeMap()
{
BWTA::analyze();
analyzed = true;
analysis_just_finished = true;
}
DWORD WINAPI analyzeMapThreaded_routine()
{
analyzeMap();
return 0;
}
void analyzeMapThreaded()
{
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)analyzeMapThreaded_routine, NULL, 0, NULL);
}
bool isAnalyzed()
{
return analyzed;
}
void sendText(const char* text)
{
if (!BWAPI::Broodwar)
{
printf("Error: Trying to sendText when game not initialized yet!\n[%s]\n", text);
return;
}
if (strlen(text) >= 80)
{
printf("Error: Trying to print text longer than 80 characters (this will crash revisions 3208 or less)\n[%s]\n", text);
return;
}
BWAPI::Broodwar->sendText("%s", text);
}