-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompatWrappers.cpp
More file actions
62 lines (49 loc) · 1.31 KB
/
CompatWrappers.cpp
File metadata and controls
62 lines (49 loc) · 1.31 KB
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
#include "CompatWrappers.h"
#include "Globals.h"
#if SOURCE_ENGINE >= SE_ORANGEBOX
bool IsFlagSet(ConCommandBase *cmd, int flag) {
return cmd->IsFlagSet(flag);
}
void InsertServerCommand(const char *buf) {
engine->InsertServerCommand(buf);
}
ConCommandBase *FindCommandBase(const char *name) {
return icvar->FindCommandBase(name);
}
ConCommand *FindCommand(const char *name) {
return icvar->FindCommand(name);
}
#else
bool IsFlagSet(ConCommandBase *cmd, int flag) {
return cmd->IsBitSet(flag);
}
void InsertServerCommand(const char *buf) {
engine->InsertServerCommand(buf);
}
ConCommandBase *FindCommandBase(const char *name) {
ConCommandBase *pBase = icvar->GetCommands();
while(pBase) {
if (strcmp(pBase->GetName(), name) == 0) {
if (!pBase->IsCommand()) {
return NULL;
}
return pBase;
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
}
return NULL;
}
ConCommand *FindCommand(const char *name) {
ConCommandBase *pBase = icvar->GetCommands();
while (pBase) {
if (strcmp(pBase->GetName(), name) == 0) {
if (!pBase->IsCommand()) {
return NULL;
}
return static_cast<ConCommand *>(pBase);
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
}
return NULL;
}
#endif //SOURCE_ENGINE >= SE_ORANGEBOX