MCPcopy Create free account
hub / github.com/bwapi/bwapi / aithread

Class aithread

bwapi/BWScriptEmulator/ScriptThread.h:22–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#define AI_THREAD_WANT_KILLED 0x04
21
22class aithread
23{
24public:
25 // ctors
26 aithread();
27 aithread(WORD wStartBlock, BWAPI::Position location, void *town = NULL);
28
29 // dtor
30 ~aithread();
31
32 // Read data
33 template <class T>
34 T read()
35 {
36 T rval = (T&)pbAIScriptBinary[this->dwScriptOffset];
37 this->dwScriptOffset += sizeof(T);
38 this->dwBytesRead += sizeof(T);
39 return rval;
40 };
41
42 // Helper for tuple reading
43 template <class T, size_t S> struct TupleHelper;
44
45 // Base case
46 template <class T>
47 struct TupleHelper<T,0>
48 {
49 static void readTuple(T &tup, aithread &thread) {};
50 };
51
52 // Recursive
53 template <class T, size_t S>
54 struct TupleHelper
55 {
56 static void readTuple(T &tup, aithread &thread)
57 {
58 TupleHelper<T,S-1>::readTuple(tup,thread);
59 std::get<S-1>(tup) = thread.read<std::tuple_element<S-1,T>::type>();
60 };
61 };
62
63 // Read data as tuple
64 template <class T>
65 void readTuple(T &tup)
66 {
67 TupleHelper<T,std::tuple_size<T>::value>::readTuple(tup, *this);
68 };
69
70 // Execute script
71 void execute();
72
73 // Flags
74 DWORD getFlags() const;
75 void setFlags(DWORD dwFlags);
76 void clearFlags(DWORD dwFlags);
77
78 // Sleep
79 DWORD sleep();

Callers 1

AICreateThreadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected