-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodules.h
47 lines (37 loc) · 883 Bytes
/
modules.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
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef void* func_t(void);
struct TriggerS
{
string Word;
int Module;
};
class Module {
public:
virtual void OnAnyMessage() {}
virtual void OnMessage() {}
};
extern vector<Module*> ModuleList;
class ModulesClass {
public:
bool LoadModule(string FileName_);
bool UnloadModule(int ID);
bool UnloadModule(string FileName_);
void Register(string Trigger_, int ModID);
int GetTriggerCount() { return Trigger.size(); }
string GetTriggerWord(int ID) { return Trigger[ID].Word; }
int GetTriggerModule(int ID) { return Trigger[ID].Module; }
private:
vector <string> FileName;
vector <void *> LibHandle;
vector <TriggerS> Trigger;
};
extern ModulesClass Modules;
#define INIT_MOD(y) \
extern "C" Module * InitModule(int id) \
{ \
return new y(id); \
}
#define STR_MOD_PATH "modules/"