-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathG422_OAPI.cpp
More file actions
130 lines (88 loc) · 1.94 KB
/
G422_OAPI.cpp
File metadata and controls
130 lines (88 loc) · 1.94 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#define ORBITER_MODULE
#include "G422.h"
#include "G422_DVC.h"
HINSTANCE thisDLL;
//G422_DRAWRES G422DrawRes;
DLLCLBK void InitModule(HINSTANCE mod)
{
thisDLL = mod;
//
//
// initOne = false;
}
DLLCLBK void ExitModule(HINSTANCE mod)
{
//
/*
oapiReleaseFont(G422DrawRes.mfdLabelsFont);
oapiReleasePen(G422DrawRes.spSet[0]);
oapiReleasePen(G422DrawRes.spSet[1]);
oapiReleasePen(G422DrawRes.spSet[2]);
oapiReleaseBrush(G422DrawRes.brSet[0]);
oapiReleaseBrush(G422DrawRes.brSet[1]);
oapiReleaseBrush(G422DrawRes.brSet[2]);
*/
/*
for (int i=0; i<VC_SWITCH_COUNT; ++i)
{
VCSwitchDef &swDef = VC_swDefs[i];
delete swDef.mgRot;
}
*/
thisDLL = NULL;
//initOne = false;
}
DLLCLBK VESSEL* ovcInit(OBJHANDLE vsl_hndl, int fltModel)
{
return new G422(vsl_hndl, fltModel);
}
DLLCLBK void ovcExit(VESSEL* vsl)
{
if (vsl)
delete (G422*) vsl;
}
// utility functions for reading from the CFG file
//
void StringExplode(string str, string separator, vector<string>* results)
{
int found;
found = str.find_first_of(separator);
while(found != string::npos){
if(found > 0){
results->push_back(str.substr(0,found));
}
str = str.substr(found+1);
found = str.find_first_of(separator);
}
if(str.length() > 0){
results->push_back(str);
}
}
//
//
void StringTrimWS(string &str)
{
str.erase(0, str.find_first_not_of(' '));
str.erase(0, str.find_first_not_of('\t'));
str.erase(str.find_last_not_of(' ') + 1);
str.erase(str.find_last_not_of('\t') + 1);
}
void StringToLower(string &str)
{
for (int i=0;i<str.length();i++)
if (str[i] >= 0x41 && str[i] <= 0x5A) str[i] = str[i] + 0x20;
}
int parseInt(string &str)
{
int val;
stringstream ssVal(str);
ssVal >> val;
return val;
}
double parseDouble(string &str)
{
double val;
stringstream ssVal(str);
ssVal >> val;
return val;
}